-
Content Count
3416 -
Joined
-
Last visited
-
Days Won
113
Everything posted by Lars Fosdal
-
Delphi pitfalls: Enumerated types and for loops
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
I did mean dynamic arrays. My bad.- 39 replies
-
- pitfall
- enumerated type
-
(and 1 more)
Tagged with:
-
Delphi pitfalls: Enumerated types and for loops
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
Off-topic: There is another oddity with enumerations with explicit ordinal values. TEnum = (plough = 5, foo = 9, bar = 14, wtf = 1000); The above is valid, but wtf can't be used in a set. Makes me wonder if it would be better to generally do sets as dynamic arrays, instead of today's implementation of sets. I guess it would be more expensive.- 39 replies
-
- pitfall
- enumerated type
-
(and 1 more)
Tagged with:
-
Right you are, @dummzeuch : Problem solved.
-
To where are you trying to save the file?
-
Now I am suddenly not so happy about the Parnassus integration in 10.3. It murdered my 10.2 Parnassus plugins.
-
I think it could be fantastic if it was possible to design custom property lists per class. The first time a class is seen, it could be added to a list of class property configs, with all the props present. In a config dialog somewhere, it could be possible to enable/disable each prop. The filter could even use digits 0..9 to select one of multiple configurations per class. Naturally, if it could be installed with default filters for many of the standard components, that would be nice. I really like the idea - more than I like quick edit. Nice work!
-
Very odd. I did have 10.3 from November installed and did a reinstall and the uninstall hung at the end. Perhaps I need to redo it 😕 - or wait until the new laptop arrives. I do love that Parnassus Bookmarks and Navigator is included, though!
-
Installed 10.3.1 using the web installer. Something looks strange. No 10.3.1 mention. Installed update is 10.2 update 2?
-
version control system Version Control System
Lars Fosdal replied to Soji's topic in Delphi IDE and APIs
He lives at https://twitter.com/uscle?lang=en- 49 replies
-
- git
- subversion
-
(and 1 more)
Tagged with:
-
version control system Version Control System
Lars Fosdal replied to Soji's topic in Delphi IDE and APIs
How does SourceTree and Github Desktop compare?- 49 replies
-
- git
- subversion
-
(and 1 more)
Tagged with:
-
Delphi pitfalls: Enumerated types and for loops
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
Declared: TEnum = (plough, foo, bar, wtf) Test order: [wtf, plough, bar, foo] Looping an Enum Set 1 wtf 5 plough 9 foo 14 bar Looping an Enum Array 1 wtf 5 plough 14 bar 9 foo Press Enter: You are right, @Stefan Glienke -I am so logging off now 😄- 39 replies
-
- pitfall
- enumerated type
-
(and 1 more)
Tagged with:
-
Delphi pitfalls: Enumerated types and for loops
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
Wow, I didn't notice that! And it is not related to declaration order, nor ordinal value. That is a bit disturbing.- 39 replies
-
- pitfall
- enumerated type
-
(and 1 more)
Tagged with:
-
Delphi pitfalls: Enumerated types and for loops
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
The inconsistent behavior between the two variations of enumerated types is another pitfall, I guess.- 39 replies
-
- pitfall
- enumerated type
-
(and 1 more)
Tagged with:
-
Delphi pitfalls: Enumerated types and for loops
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
Or pitfall 😛- 39 replies
-
- pitfall
- enumerated type
-
(and 1 more)
Tagged with:
-
Delphi pitfalls: Enumerated types and for loops
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
Off-topic - I actually do reverse for in loops with a custom enumerator which starts on top and decrements instead.- 39 replies
-
- pitfall
- enumerated type
-
(and 1 more)
Tagged with:
-
Delphi pitfalls: Enumerated types and for loops
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
@Uwe Raabe Are you saying that for ix := Low(Array) to High(Array) do begin v := Array[ix]; is predictable - while for v in Array is not predictable ?- 39 replies
-
- pitfall
- enumerated type
-
(and 1 more)
Tagged with:
-
Delphi pitfalls: Enumerated types and for loops
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
I wonder how it behaves if I have a set enumerated type with hard coded ordinal values? Edit Change the declaration to TEnum = (plough = 5, foo = 9, bar = 14, wtf = 1); Now the set behaves just like the array.- 39 replies
-
- pitfall
- enumerated type
-
(and 1 more)
Tagged with:
-
Delphi pitfalls: Enumerated types and for loops
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
Except it is rare to see a TList or any other object structure "hardcoded" in plain sight, while arrays of simple types are not hard to read nor uncommon.- 39 replies
-
- pitfall
- enumerated type
-
(and 1 more)
Tagged with:
-
Delphi pitfalls: Enumerated types and for loops
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
For a list or any other object enumeration interface, I'd agree - but for an open array or a TArray?- 39 replies
-
- pitfall
- enumerated type
-
(and 1 more)
Tagged with:
-
Delphi pitfalls: Enumerated types and for loops
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
It is pretty quick to miss that "detail". They look the same, so unless you really pay attention to the type element type - there is little to tell you that you are looking at a set and not a list.- 39 replies
-
- pitfall
- enumerated type
-
(and 1 more)
Tagged with:
-
Pitfalls of Anonymous methods and capture
Lars Fosdal posted a topic in RTL and Delphi Object Pascal
Code that looks correct, and appear to compile alright, but which doesn't execute well. Can you spot the error? See my blog post for a link to a SCCE. var Handler: THandlerClass; hType: THandlers; begin Broker.Clear; for hType in [foo, bar] do begin case hType of foo: Handler := TFoo.Create; bar: Handler := TBar.Create; end; Broker.AddHandler(Handler.OnHandle); end; end; https://larsfosdal.blog/2019/02/08/delphi-pitfalls-of-anonymous-methods-and-capture/ -
Pitfalls of Anonymous methods and capture
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
Close, its a Self-Contained Compilable Example, sometimes also called a SSCCE, i.e. a Short SCCE. I'll rewrite the article for better readability. -
How to pass an unknown record to a function as argument
Lars Fosdal replied to John Kouraklis's topic in RTL and Delphi Object Pascal
Is this related to databases? -
Pitfalls of Anonymous methods and capture
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
There is one, but you "wasn't about to download some project from a file sharing site" (i.e. a zip file with source code from Google Drive) -
Pitfalls of Anonymous methods and capture
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
@David Heffernan If you added me to your Ignore list here on DP, I would be totally fine with that.