Sorry if it will look like a rant but it got me thinking today. Who at Emba thought it is good idea to inherit IEnumerable from IEnumerable and IEnumerator from IEnumerator??? And why all containers from Generics.Collections, Classes, etc are not implementing those interfaces?

Comments

  1. Wondered that many times myself. It works great for .NET languages like C# where everything is an object but it never made sense to me to do it with native Delphi, where primitive types do not descend from TObject. You'll find that most third party libraries that use IEnumerable redefine it so it can be used with any type.

    ReplyDelete
  2. Obviously the same kind of person that did all the other copy and paste jobs from C# without thinking about the fact that Delphi does not have a rooted type system.

    ReplyDelete
  3. All the more reason to use the collections in the Spring for Delphi framework.

    ReplyDelete
  4. I think it would be good if the community would have one collection library we could build our things on so different libraries are compatible to each other. But often there are some details that differ between these collection implementations (thinking just of Spring, Coll and DSharp).
    Things like the binary size of generics make it even harder to design something that everyone is happy with.
    As Spring committer and DSharp author I am open to suggestions.

    ReplyDelete
  5. Stefan Glienke Totally agree with you. Till now I mostly used Spring collections, probably because they were released earlier than DSharp IIRC. I think it would be very good if those 2 frameworks could be merged. They both are very useful and also have some duplicated functionality.

    ReplyDelete
  6. Linas Naginionis Absolutely! However in Spring the collections have the problem of making your binary size explode if you have many of them because the "extension methods" are part of the interface (and therefor cannot be smartlinked out if not used) and Delphi does no code folding for generics. Thats why I tried to keep the DSharp implementation small and put these extension methods (like known from .Net Enumerable) in a separate unit (as you don't need Where() and alike everywhere).

    Another thing is the different implementation of IEvent which basically makes these collections incompatible for now. I have been thinking of possible ways to merge the collections of Spring and DSharp (without breaking any or at least as little as possible code out there).

    That is why I would like to get some feedback on this to define some specs on what these collection types should be like.

    ReplyDelete

Post a Comment