Leaderboard
Popular Content
Showing content with the highest reputation on 07/31/25 in all areas
-
A Conditional Ternary Operator for the Delphi
EugeneK posted a topic in RTL and Delphi Object Pascal
Conditional operator coming in Delphi 13 https://blogs.embarcadero.com/coming-in-rad-studio-13-a-conditional-ternary-operator-for-the-delphi-language/ It is not clear from blog post are both expressions evaluated every time or based on condition? I think is most important thing about this feature. -
A Conditional Ternary Operator for the Delphi
Kryvich replied to EugeneK's topic in RTL and Delphi Object Pascal
Great! This is a very long awaited addition for me. I hope they also add a case statement for string types -
ANN: July Updates for Pascal Analyzer, Pascal Expert and Pascal Browser
Peganza posted a topic in Delphi Third-Party
We have released new updates of all products: Pascal Analyzer 9.17 Pascal Expert 9.17 Pascal Browser 3.5.38 It is possible to download evaluation versions, and also to view the entire documentation online. Go to Peganza for more information. If you are new to the products, we recommend our Youtube video (18 minutes) that describes Pascal Analyzer, with examples and a short demo. These are the changelogs for these updates: Pascal Analyzer 9.17.0 July 15, 2025 fixed an issue with STWA5-"Possible bad pointer usage" improved parsing of constant declarations new section in Warnings Report, WARN64-"Misformed call to Format function" checks if calls have the correct number of arguments and that the types are correct fixed a problem with CONV30-"Private can be changed to strict private" and CONV31-"Protected can be changed to strict protected" fixed issue with WARN46-"Local variables that are set but not later used" WARN3-"Variables that are referenced but never set" does not warn for variables of type TFormatSettings, needs extended analysis to provide accurate warnings fixed an edge-case error that could affect STWA6-"Possible bad typecast" Pascal Expert 9.17.0 July 15, 2025 fixed an issue with STWA5-"Possible bad pointer usage" improved parsing of constant declarations new section in Warnings Report, WARN64-"Misformed call to Format function" checks if calls have the correct number of arguments and that the types are correct fixed a problem with CONV30-"Private can be changed to strict private" and CONV31-"Protected can be changed to strict protected" fixed issue with WARN46-"Local variables that are set but not later used" WARN3-"Variables that are referenced but never set" does not warn for variables of type TFormatSettings, needs extended analysis to provide accurate warnings fixed an edge-case error that could affect STWA6-"Possible bad typecast" Pascal Browser 3.5.38 July 15, 2025 improved parsing of constant declarations -
A Conditional Ternary Operator for the Delphi
dummzeuch replied to EugeneK's topic in RTL and Delphi Object Pascal
I wonder whether there will be a code formatter that supports this. Given that they deprecated the existing one since Delphi 11, I somehow doubt it. -
A Conditional Ternary Operator for the Delphi
Remy Lebeau replied to EugeneK's topic in RTL and Delphi Object Pascal
Actually, a patch was already created for FreePascal to add this very same conditional operator (FPC already had an IfThen() intrinsic); https://forum.lazarus.freepascal.org/index.php/topic,71398.msg556926.html#msg556926 -
A Conditional Ternary Operator for the Delphi
Anders Melander replied to EugeneK's topic in RTL and Delphi Object Pascal
Yeah, right 🤦♂️ More syntactic sugar, the compiler codegen is still a joke, and we still haven't got SIMD intrinsics. The only time I've ever wished for a ternary operator was when porting C code and being in a rush. But I wouldn't mind all this fluff (since I don't have to use it) - if they would also throw an occasional bone to those of us that need low level performance. Yes, but you don't have to use it. -
A Conditional Ternary Operator for the Delphi
omnibrain replied to EugeneK's topic in RTL and Delphi Object Pascal
Wow, I hated the ternary operator in every language I encountered so far. But this one with pascal keywords seems almost bearable. But, I'm sure it will bring all sorts of new anti-patterns to Delphi. And I don't think a language saddled with 'with' needs any more anti-patterns. -
A Conditional Ternary Operator for the Delphi
Patrick PREMARTIN replied to EugeneK's topic in RTL and Delphi Object Pascal
The beta is under NDA, we can't talk except when we are authorized... or after an official post like for the ternary operator. Many new (and updated) things are in the Ganymede beta(s), not sure all will be released for 13.0 Florence. Stay tuned. 😉 -
A Conditional Ternary Operator for the Delphi
DelphiUdIT replied to EugeneK's topic in RTL and Delphi Object Pascal
In the example thay gave, the equivalent expression is a typical IF, so we can deduce that the new expression also behaves in this way: the part not affected by the condition will not be evaluated. Of course, only they or the release can confirm this. -
A Conditional Ternary Operator for the Delphi
Tommi Prami replied to EugeneK's topic in RTL and Delphi Object Pascal
On this atleast syuntax is readable X := if Left < 100 then 22 else 45; For example C-syntax is not what I really can say that I like. int result = (x > 5) ? 10 : 20; even worse if writte like this int result=(x>5)?10:20; Syntax highlighting saves a bit for sure but still easy to miss those... One character operator thingies... -Tee- -
Yes, thats nice and useful, you can also extend this a bit, to avoid dangling pointers. See these rough ideas ... destructor TAnonProc.Destroy; begin if (Owner is TButton) and (TMethod(TButton(Owner).OnClick).Data = Self) then begin TButton( Owner ).OnClick := nil; // Ensure to remove dangling Pointer end; inherited; end; or you could even separate the Owner from the Observer type TAnonProc = class(TComponent) private FProc: TProc<TObject>; procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure OnSender(Sender: TObject); public constructor Create(AOwner, AObserved: TComponent; AProc: TProc<TObject>); end; constructor TAnonProc.Create(AOwner, AObserved: TComponent; AProc: TProc<TObject>); begin inherited Create(AOwner); // Owner = Form FProc := AProc; AObserved.FreeNotification(Self); // register observer if AObserved is TButton then TButton(AObserved).OnClick := OnSender; end; procedure TAnonProc.Notification(AComponent: TComponent; Operation: TOperation); begin if (Operation = opRemove) and (AComponent is TButton) then begin TButton(AComponent).OnClick := nil; // Clear the Pointer end; inherited; end; procedure TAnonProc.OnSender(Sender: TObject); begin if Assigned(FProc) then FProc(Sender); end; //.......................... TAnonProc.Create(Self, Button1, procedure(Sender: TObject) begin Caption := 'Click!'; end);
-
wuppdi Welcome Page for Delphi 11 Alexandria?
gkobler replied to PeterPanettone's topic in Delphi IDE and APIs
V 1.2.2.B44 is now also available for D11.x -
A Conditional Ternary Operator for the Delphi
@AT replied to EugeneK's topic in RTL and Delphi Object Pascal
Good news. Thank you Remy for keeping us informed! However, Next improvements can bring more value in the Delphi and FreePascal languages: As I pointed earlier - pure generic function declaration can help much. generic constrains by type sets like it implemented in the GoLang. generate smarter code for generic methods. Now the code duplicates for all types. Implementing 1 and 2 allows to implement regular functions like: iif<T>(Condition: boolean; A, B: T): T; overload; inline; begin if Condition then Result:=A else Result:=B; end; max<T: number>(A,B: T); overload; inline; begin if A=>B then Result:=A else Result:=B; end; min<T: enum>(A,B: T); inline; begin if A<=B then Result:=A else Result:=B; end; etc. P.S. number, enum, etc. are could be group sets which union group of compatible types. -
Broken Project Path References due to Misused “Save As” in Delphi (RAD Studio)
limelect replied to Badnaf's topic in FMX
@Gabor64738 No, I think another way First, throw away all the files except the DPR fmx res and pas. Now load the DPR. Usually, this will be OK. If not, there is another option. Edit the DPR so All the paths will only be the file names. With that said, you have here are all the project files. And lastly, if this did not help, make a new project (name the new main to the old main) and also the project name to the old one. Change (copy) pas and fmx of the old main to the new one, then add all other pas files to the project. Doen. -
if Obj <> nil then Obj.Free
Anders Melander replied to EugeneK's topic in ICS - Internet Component Suite
Delphi 1 ; procedure TObject.Free ObjectFree: MOV BX,SP LES DI,SS:[BX+4] MOV AX,ES OR AX,DI JE @@1 MOV AL,1 PUSH AX PUSH ES PUSH DI LES DI,ES:[DI] CALL ES:[DI].vtDestroy @@1: RETF 4 Delphi 2 procedure TObject.Free; asm TEST EAX,EAX JE @@exit MOV ECX,[EAX] MOV DL,1 CALL dword ptr [ECX].vtDestroy @@exit: end;