Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 03/18/24 in all areas

  1. Stefan Glienke

    Anonymous methods as interfaces

    Yes you can, the first post in this thread contains the code doing exactly that. In fact, until some version a few years ago it was possible to call Invoke. Still, if the method reference type has {$M+} enabled you can get RTTI for its Invoke method and dynamically invoke it. And there are more than one (Spring) libraries that do that. Also please let's get the terminology right - this is something that hugely annoys the heck out of me - because when talking about this subject everything is being called anonymous method but is incorrect. TProc = refererence to procedure; This is a method reference type - yes, even the official documentation is a mishmash. There is nothing anonymous about this type - it has a name: TProc. procedure Foo; begin end; var p: TProc; begin p := Foo; end. Again there is no anonymous method in this code - the variable p of the method reference type TProc is being assigned. The variable has a name and thus also is not anonymous. var p: TProc; begin p := procedure begin end; end. Now we have an anonymous method - the code block assigned to p has no name. This is an anonymous method that is assigned to the method reference variable p. Also see: https://en.wikipedia.org/wiki/Closure_(computer_programming)#Anonymous_functions https://en.wikipedia.org/wiki/Anonymous_function
  2. Attila Kovacs

    Assign Null value to date mySQL

    FieldByName('STAT_CLOSED_DATE').Clear;
  3. Stefan Glienke

    Anonymous methods as interfaces

    As someone using this "feature", I can tell you that the moment they break it I will pester them with issue reports until they revert this "fix". There has been another hidden "feature" in the past: adding operator overloads to records via helper when they are named in a particular way - since a few Delphi versions you can do that natively by declaring operator overloads on record helpers without this "hack" - but the hack still works. Since there is no official language specification and it's basically "if it compiles, it's valid code" I assume this to be added to the documentation rather than to be changed. Embarcadero has not changed things that are worse for backward compatibility reasons in the past so I assume they won't touch this either. The more important thing they should address with anonymous methods is this: not allocating any heap memory when no capturing is happening. The code would look similar to that for the comparers for intrinsic types in System.Generics.Defaults.pas
  4. ANN: New version of StyleControls VCL v 5.75 with Skia VCL interaction for Lottie Animations just released. https://www.almdev.com In new version we added TscGPGlyphContainerButton control, which uses any TControl as Glyph inside. Also we created special demo for RAD Studio Athens with Skia VCL controls and TscGPGlyphContainerButton (TskAnimationImage with Lottie animations and TskSvg control - really new level of UI in your applications)...
  5. Lars Fosdal

    How to check for Delphi update?

    If there is a new version or patch for the IDE, it also will show up on the Welcome page.
  6. Lars Fosdal

    Variable not initialized?

    Frequent scenario function Test: integer; var i: integer; begin try i := 1; // do something finally; Result := i; end; end; i needs to be initialized before the try block.
  7. Dave Nottage

    How to check for Delphi update?

    This is GetIt Package Manager configured to show what patches/hotfixes are available, and an arrow pointing to what to select to show whether updates are available:
  8. Anders Melander

    Embed line number at design time??

    This one maybe: https://blog.synopse.info/?post/2011/04/14/Enhanced-logging-in-SynCommons via: https://stackoverflow.com/a/7216537/2249664
  9. DelphiUdIT

    2 seperate installs of Indy in the one IDE?

    It wasn't for you my reply. You are from TeamB and an MVP Embarcadero, I have nothing to explain, signaling some issue may be but sure not explain to you. The post was for @Adam and for other readers.
×