View Issue Details

IDProjectCategoryView StatusLast Update
0038937LazarusLazUtilspublic2021-06-02 11:37
ReporterMarco van de Voort Assigned ToMaxim Ganetsky  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Fixed in Version2.2 
Summary0038937: deprecate uitypes
DescriptionUitypes is in FPC since FPC 3.2.0 as "system.uitypes" (rtl-objpas), and also includes the "web colors", like delphi does.

I suggest to deprecate uitypes immediately by aliasing the types and have a deprecated "use system.uitypes" message on the unit for a few release rounds.

Then some future branch can clean it out.

TagsNo tags attached.
Fixed in Revision65164
LazTarget-
Widgetset
Attached Files

Activities

Bart Broersma

2021-05-27 10:43

developer   ~0131044

I hope this is not the beginning of a mandatory namespace notation for all units in the uses clause?

Sven Barth

2021-05-27 11:38

manager   ~0131047

FPC 3.2.0 also supports the -FN<x> parameter, so if you supply -FNSystem then you can continue to use UITypes instead of System.UITypes.

Marco van de Voort

2021-05-27 11:45

manager   ~0131048

But in this case both System.UITypes and UITypes already exist, this bugreport is about fixing that.

UITypes contains among others "TColor" and friends, so this would make it easier for arbitrary graphics libraries to use these types without Lazarus links (lcl or lazutils)

Maxim Ganetsky

2021-05-31 22:27

developer   ~0131104

Last edited: 2021-05-31 22:29

View 2 revisions

Is attached patch correct? With these changes Lazarus IDE does not compile anymore with the errors like:

packagedefs.pas(3150,9) Ошибка: Identifier not found "mtConfirmation"

I have FPC 3.2.2.

Maxim Ganetsky

2021-05-31 22:31

developer   ~0131105

uitypes-aliases.patch (1,952 bytes)   
Index: uitypes.pas
===================================================================
--- uitypes.pas	(revision 65157)
+++ uitypes.pas	(working copy)
@@ -1,4 +1,4 @@
-unit UITypes;
+unit UITypes deprecated 'Use System.UITypes instead (available since FPC 3.2.0)';
 
 {$mode objfpc}{$H+}
 
@@ -5,34 +5,33 @@
 interface
 
 uses
-  Classes, SysUtils;
+  System.UITypes;
 
 type
   // Message dialog related
-  TMsgDlgType    = (mtWarning, mtError, mtInformation, mtConfirmation, mtCustom);
-  TMsgDlgBtn     = (mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore,
-                    mbAll, mbNoToAll, mbYesToAll, mbHelp, mbClose);
-  TMsgDlgButtons = set of TMsgDlgBtn;
+  TMsgDlgType    = System.UITypes.TMsgDlgType;
+  TMsgDlgBtn     = System.UITypes.TMsgDlgBtn;
+  TMsgDlgButtons = set of System.UITypes.TMsgDlgBtn;
 
   // ModalResult
-  TModalResult = low(Integer)..high(Integer);
-  PModalResult = ^TModalResult;
+  TModalResult = System.UITypes.TModalResult;
+  PModalResult = System.UITypes.PModalResult;
 
 const
   // Used for ModalResult
-  mrNone = 0;
-  mrOK = mrNone + 1;
-  mrCancel = mrNone + 2;
-  mrAbort = mrNone + 3;
-  mrRetry = mrNone + 4;
-  mrIgnore = mrNone + 5;
-  mrYes = mrNone + 6;
-  mrNo = mrNone + 7;
-  mrAll = mrNone + 8;
-  mrNoToAll = mrNone + 9;
-  mrYesToAll = mrNone + 10;
-  mrClose = mrNone + 11;
-  mrLast = mrClose;
+  mrNone = System.UITypes.mrNone;
+  mrOK = System.UITypes.mrOK;
+  mrCancel = System.UITypes.mrCancel;
+  mrAbort = System.UITypes.mrAbort;
+  mrRetry = System.UITypes.mrRetry;
+  mrIgnore = System.UITypes.mrIgnore;
+  mrYes = System.UITypes.mrYes;
+  mrNo = System.UITypes.mrNo;
+  mrAll = System.UITypes.mrAll;
+  mrNoToAll = System.UITypes.mrNoToAll;
+  mrYesToAll = System.UITypes.mrYesToAll;
+  mrClose = System.UITypes.mrClose;
+  mrLast = System.UITypes.mrLast;
 
   // String representation of ModalResult values
   ModalResultStr: array[mrNone..mrLast] of shortstring = (
uitypes-aliases.patch (1,952 bytes)   

Juha Manninen

2021-06-01 05:29

developer   ~0131111

I guess mtConfirmation and such must be moved to a new unit. It must be in LazUtils because it can be used in a console program, too.
The deprecated message should be inside an IFDEF for FPC 3.2.2 and higher.

Marco van de Voort

2021-06-01 06:16

manager   ~0131112

Last edited: 2021-06-01 06:17

View 2 revisions

You need to alias all items of the enums too.

- the changes are already in 3.2.0, so if 3.0.4 is no longer supported (trunk/a future new fixes branch), that can be done without much ifdef.

Maxim Ganetsky

2021-06-01 22:02

developer   ~0131115

Please test and close if OK.

Don Siders

2021-06-01 22:17

reporter   ~0131117

This ends support for the 3.0.4 compiler. It that intentional?

jamie philbrook

2021-06-01 22:23

reporter   ~0131118

I guess I am stuck on older laz then because 3.2.0 does not work for me..

Thanks for that. have a good day..

Maxim Ganetsky

2021-06-01 22:29

developer   ~0131119

We usually support two last FPC releases, currently they will be FPC 3.2.0 and FPC 3.2.2.

jamie philbrook

2021-06-01 22:54

reporter   ~0131120

Sorry, but 3.2.0 has broken issues, especially in the INLINE . its broke now..

This has been brought up many times and flack thrown at me..

INLINE is a very useful feature and it works very well with 3.0.4.

Also there are other issues I haven't yet figured out yet. which works fine in 3.0.4 but not in 3.2.0 and I haven't seen anything yet with 3.2.2 that has addressed these problems..

 all that has happen is now bloater code base due to broken INLINE and somethings just not working without reason, yet.

 Do as you want, I am just a little guy here to people.

 I moved a large code base back over to D10.4 before I went any future when I saw what happen, this code base will not work due to lots of work done in DLL's using INLINES to speed things up because its a CPU intense app.

 Thank you much for your effects. I can still use this as proof of concept and do the real work in D.

Sven Barth

2021-06-02 07:22

manager   ~0131121

No, it's not broken. It's simply that you assumed things that the compiler does not guarantee and we also showed you that Delphi doesn't either, but you completely ignored such posts. The problem is your code and your assumptions.

jamie philbrook

2021-06-02 09:57

reporter   ~0131122

Last edited: 2021-06-02 09:59

View 2 revisions

all presented code works with Delphi.

I had someone test code last night with 3.3.1 and guess what, it works again?

I have not had them test with 3.2.2 , I don't have either here but I will fine someone willing to test it that does.

I guess the final answer is , if it works with Delphi and not fpc then Delphi must be broke

I will admit Delphi has some issue with their components but I've never really found much wrong with their compiler.

Thanks for clarifying that, I'll remember to put that on my list as "I code like no one else"

Have a good day.

Sven Barth

2021-06-02 11:37

manager   ~0131123

Again, what we said was that you can't guarantee that your code always works in Delphi just like you can't guarantee that it works in FPC, because you're simply abusing implementation details. Your code might work as is right now, but a small change, maybe an unrelated change of yours might lead to Delphi's optimizer finding a better strategy which might lead to a completely different result for your code.
The fact alone that your code does not work if inline is removed is a red flag in and of itself, because the presence or absence of inline is not supposed to change the behaviour of the code. It could very well be that you code will fail if compiled with one of Delphi's NextGen compilers cause they're based on LLVM and they make drastic use of undefined behaviour to optimize better.

Issue History

Date Modified Username Field Change
2021-05-27 10:39 Marco van de Voort New Issue
2021-05-27 10:43 Bart Broersma Note Added: 0131044
2021-05-27 11:38 Sven Barth Note Added: 0131047
2021-05-27 11:45 Marco van de Voort Note Added: 0131048
2021-05-31 22:27 Maxim Ganetsky Note Added: 0131104
2021-05-31 22:27 Maxim Ganetsky File Added: uitypes-aliases.pas
2021-05-31 22:29 Maxim Ganetsky Note Edited: 0131104 View Revisions
2021-05-31 22:29 Maxim Ganetsky Assigned To => Maxim Ganetsky
2021-05-31 22:29 Maxim Ganetsky Status new => feedback
2021-05-31 22:29 Maxim Ganetsky LazTarget => -
2021-05-31 22:31 Maxim Ganetsky File Deleted: uitypes-aliases.pas
2021-05-31 22:31 Maxim Ganetsky Note Added: 0131105
2021-05-31 22:31 Maxim Ganetsky File Added: uitypes-aliases.patch
2021-06-01 05:29 Juha Manninen Note Added: 0131111
2021-06-01 06:16 Marco van de Voort Note Added: 0131112
2021-06-01 06:16 Marco van de Voort Status feedback => assigned
2021-06-01 06:17 Marco van de Voort Note Edited: 0131112 View Revisions
2021-06-01 22:02 Maxim Ganetsky Status assigned => resolved
2021-06-01 22:02 Maxim Ganetsky Resolution open => fixed
2021-06-01 22:02 Maxim Ganetsky Fixed in Version => 2.2
2021-06-01 22:02 Maxim Ganetsky Fixed in Revision => 65164
2021-06-01 22:02 Maxim Ganetsky Note Added: 0131115
2021-06-01 22:17 Don Siders Note Added: 0131117
2021-06-01 22:23 jamie philbrook Note Added: 0131118
2021-06-01 22:29 Maxim Ganetsky Note Added: 0131119
2021-06-01 22:54 jamie philbrook Note Added: 0131120
2021-06-02 07:22 Sven Barth Note Added: 0131121
2021-06-02 09:57 jamie philbrook Note Added: 0131122
2021-06-02 09:59 jamie philbrook Note Edited: 0131122 View Revisions
2021-06-02 11:37 Sven Barth Note Added: 0131123