DTL vs. STL - Mixins for sort()?

Ivan Hernandez Ivan_member at pathlink.com
Tue May 2 13:37:54 PDT 2006


There was some comments about:

>> 1) It seems like things like sort, reverse, etc. are being attached as
>> member functions rather than seperate functions. One of the nicest
>> things about the STL is that you only have to write sort once, rather
>> than attach it to every container. This seems more like a step backwards
>> than a step forwards.. any particular reason?

asserting that D Templates are not instantiated like in C++ and that's why the
sort() is being implemented on each collection class. But I think that's not a
problem. sort() is a generic fuction, and it should work with any collection
type. Couldn't it be implemented as a mixin?

I'm not really aware of mixin limitations on D, but it should work in other
languages, be theirs typings dynamic like Ruby or Python, or static as Sather
and Eiffel (all four of them allowing for code inclusion within a class).





More information about the Digitalmars-d-dtl mailing list