-
Content Count
1352 -
Joined
-
Last visited
-
Days Won
129
Stefan Glienke last won the day on March 12
Stefan Glienke had the most liked content!
Community Reputation
1887 ExcellentTechnical Information
-
Delphi-Version
Delphi 10.1 Berlin
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Is it still not possible to create self-contained executables with Java? If so it would be nice because that would remove the requirement for the JRE.
-
https://docwiki.embarcadero.com/Libraries/Athens/en/System.SysUtils.TStringHelper.TrimLeft
-
Anonymous methods as interfaces
Stefan Glienke replied to EugeneK's topic in RTL and Delphi Object Pascal
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 -
Anonymous methods as interfaces
Stefan Glienke replied to EugeneK's topic in RTL and Delphi Object Pascal
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 -
SHA1 is dead. I suggest using SHA2 or SHA3 even if it is "just" for a file checksum. If you want performance-optimized implementations I would suggest using mormot2. uses mormot.core.buffers, mormot.crypt.secure; ... HashFile(myFileName, THashAlgo.hfSHA256); Fun fact: mormot2 SHA256 is faster than RTL SHA1.
-
RTTI Context can't find an interface
Stefan Glienke replied to Sonjli's topic in RTL and Delphi Object Pascal
Nice, never heard of it before but I enjoy looking at libraries that have Spring as their dependency I submitted some improvement suggestions in the area we discussed here. -
RTTI Context can't find an interface
Stefan Glienke replied to Sonjli's topic in RTL and Delphi Object Pascal
It is because the compiler does not keep typeinfo of types that are only used as generic parameters in generic types in the public typeinfo list (which is what FindType with a qualified name iterates). If you had included the code for that Unmarshal I could probably give more advice on how to implement it best given that you seem to have support for spring collections in there -
Delphi and "Use only memory safe languages"
Stefan Glienke replied to Die Holländer's topic in General Help
This would be called Tracing garbage collection. But as Dalija already explained the crux is not which way of automatic memory reclamation is being used but the fact that it would be a mix of different ones that don't play together nicely. -
RTTI Context can't find an interface
Stefan Glienke replied to Sonjli's topic in RTL and Delphi Object Pascal
Why look up the type by full-qualified name in the first place? Every spring collection has the ElementType property that returns a PTypeInfo. -
Yes, it can if you are using resource DLLs - see https://docwiki.embarcadero.com/RADStudio/Athens/en/Localizing_Applications
-
challenge Offical launch of the 1 Billion Row Challenge in Object Pascal
Stefan Glienke replied to Gustavo 'Gus' Carreno's topic in Tips / Blogs / Tutorials / Videos
So assuming that your code scales linearly it will only take 92 days for 1 billion rows- 32 replies
-
- object-pascal
- free-pascal
-
(and 1 more)
Tagged with:
-
What new features would you like to see in Delphi 13?
Stefan Glienke replied to PeterPanettone's topic in Delphi IDE and APIs
Looks like nobody ever corrected that statement with the introduction of generics - because then even changes in the implementation section are an interface breaking change. They experienced that themself with the 10.2.2 update where some bug in TArray.Sort<T> was fixed which caused issues so the update was pulled and corrected iirc. -
What new features would you like to see in Delphi 13?
Stefan Glienke replied to PeterPanettone's topic in Delphi IDE and APIs
Niklaus Wirth just turned over in his grave about this proposal. -
Delphi and "Use only memory safe languages"
Stefan Glienke replied to Die Holländer's topic in General Help
With the exception that ARC is one of the worst ways of doing that - here are some reasons. -
Interesting take on Binary search (FYI)
Stefan Glienke replied to Tommi Prami's topic in Algorithms, Data Structures and Class Design
This is nothing new - it's called Eytzinger Layout.