Jump to content

David Heffernan

Members
  • Content Count

    3710
  • Joined

  • Last visited

  • Days Won

    185

Posts posted by David Heffernan


  1.  

    6 minutes ago, Lars Fosdal said:

    Can you offer an example?

    TList<T>

     

    FWIW my codebase doesn't use the RTL generic collections. It uses a collections library that I wrote, that amongst other things has collection classes that allow access to items via references to the underlying records for exactly this situation.

     

    I think that you are making valid points, but you aren't pinning the blame in quite the right place. I don't think the issue is with value types per se. To my mind the issues are more about limitations of the standard RTL collection classes.

    • Like 1

  2. 3 hours ago, Rollo62 said:

    I really don't like to have  a  TStringListF for right file handling, a TStringListS for right stream handling, a TStringListKV for right Key/Value handling.

    Files are a special case of streams. And they are orthogonal to collections of strings. A string list is the wrong class for key/value pairs. 

     

    I don't think you need string list interposers for any of these things. 

    • Like 1

  3. 1 hour ago, Rollo62 said:

    @David Heffernan

    More trouble means I have to make all these components work in the designer now, I think there is no neat trick w/o registering them.

    Also they are no more compatible classes, which could be used as "Xyz is TButton".

    You just put them in a designtime package, install it, and then use them. That's what I do. I don't find it at all onerous.

    • Like 1

  4. 7 minutes ago, Rollo62 said:

    But what would be the alternative, to have a separate layer of self-defined components, on top of the existing ones.

    Yes.

     

    7 minutes ago, Rollo62 said:

    That would basically do the same job as the interposers, but would cause a LOT more trouble in designing the forms.

    No, it's no trouble at all.

    • Like 1

  5. 32 minutes ago, Lars Fosdal said:

    Which is why I don't use dictionaries with records. It is rare that I load up a dictionary and do not need to change some of the content later.
    If I was insistent on doing records, I would probably write code that ordered the array by the key and did binary lookup to a pointer to the record.

    How is it any different from holding them in TList<T>?

    • Like 1

  6. 1 hour ago, Mahdi Safsafi said:

    There is another way without specifying explicitly the generic type param and it generates the same output. Internally slice requires dst(open array type), src(pointer type) and of course a count(integer type). It uses src to get the pointer and dst info to compute the offset meaning you can provide a fake declaration for the source:

    
     type TOpenArray = array[0 .. 0] of Byte;
     POpenArray  = ^TOpenArray ;
     MergeSort(Slice(POpenArray(@values[mid])^, len - mid));

     

    What does this offer over what Stefan posted in his article? 


  7. If you are not working in A, B and C then you simply should never see any conflicts. My guess is that someone in your organisation is using git incorrectly. No reason at all that you should have any troubles with all this in a single repo. 

    • Like 2
×