Jump to content

Stefan Glienke

  • Content Count

  • Joined

  • Last visited

  • Days Won


Stefan Glienke last won the day on September 11

Stefan Glienke had the most liked content!

Community Reputation

802 Excellent

Technical Information

  • Delphi-Version
    Delphi 10.1 Berlin

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Nope - with classes you are dealing with reference types - in this case you are pointing to a location inside the dynamic array being used as storage inside the list - any reallocation can change that. True - however there is a difference between a language level feature and simply giving out some pointers to memory not directly under your control. ref return in C# for example has very strict rules to avoid running into any kind of problems.
  2. Because the API now provides read by ref access which already makes it possible to changes values (which was the point) but also set by ref which does not store the ref but dereferences and assigns it. Also the regular Items property is now hidden and cannot be used. While it might be the easy solution it's not a good one in my book. In fact I think there is not even a good one unless language support. What prevents anyone from keeping around a reference that they retrieved from the Items property and then something in the list changes and boom.
  3. And there the trouble starts - why on earth should the byref property be writeable.
  4. You are simplifying things here - yes some collections such as list<T> can easily give ref access to its items but other collections might not. Working around the fact that you are dealing with value type semantics by accessing items by ref (or even giving raw access to the storage array such as the List property in the RTL TList<T> does) is borderline imo.
  5. My number one argument for constraining on class in a generic type argument when possible is that you then can build most of the generic in a non generic layer and just put a small generic layer on top. That makes for less bloat.
  6. Stefan Glienke

    Filter Exception causing debugger errors

    All that I am using which would be mostly 10.1 and 10.4 - I would guess its related to the type of the exception - I usually see this with hardware exceptions such as AV or SO.
  7. Stefan Glienke

    Filter Exception causing debugger errors

    Since the introduction of the Filter Exception expert I am often getting this error during debugging: You can easily reproduce this when causing some AV - for example by simply making a new console application and executing this code: PInteger(1234)^ := 42; Turn off the Filter Exceptions expert and this will properly show: I don't have any filters specified in the configuration of the expert.
  8. Stefan Glienke

    On the use of Interposers

    And that is why SRP goes down the drain, cyclomatic complexity increases, potential bugs increase, stuff gets broken - mostly in such swiss army knife classes. And what is complete - that differs for everyone.
  9. Stefan Glienke

    On the use of Interposers

    Topic splitting can easily done by mods. Personally I would welcome if this was done more often so different things can continue being discussed in their own threads.
  10. Stefan Glienke

    On the use of Interposers

    Correct, that's why you close the IDE before you switch the branch
  11. Stefan Glienke

    On the use of Interposers

    If you are referring to switching between different versions of them I can only suggest putting those (yes the binaries, so dcu, dcp, bpl) into vcs - git lfs for example does a fine job.
  12. Stefan Glienke

    On the use of Interposers

    I would never use interposer classes for that but simply run a one time search and replace for all occurences of the third party controls with my own.
  13. Stefan Glienke

    On the use of Interposers

    Interposer classes are only good for components/controls that you already placed on forms because you can keep using them as is while you would need to replace a lets say TButton with TMyAwesomeButton. Where I also like to use them is for extending DUnit as I can use my unit with the TTestCase class then instead of the DUnit one and add functionality - but I would stay away from using it on RTL classes. Funny story: just yesterday we had a sudden compile error from a unit that was not touched in months. A class that was implementing an interface and the compiler complained about missing 2 method implementations. Turned out it was caused by the fact that a junior had added a TAction interposer class into a form unit. That unit was used in the unit which now failed - because those interface methods had TAction in their signature and now they did not match anymore.
  14. Stefan Glienke

    DUNIT X memory leak checking

    Take a look at the screenshot you posted yourself...
  15. Stefan Glienke

    What is wrong with TStringList

    Loading an entire file into a TStringList is a bad way to begin with tbh yet often the most easy way because there are no nice to use alternatives out of the box.