Function calls

bearophile bearophileHUGS at lycos.com
Sun Jan 31 14:07:31 PST 2010


dsimcha:
> Yea, can anyone even come up with a good Devil's Advocate argument in favor of
> leaving these in?  The best one I can think of is that, since arrays in D are
> builtin, the basic functionality for them should also be builtin so they feel
> "first-class".  This is a pretty weak argument.  The builtins made sense early on,
> but now they are slow, inflexible and not substantially easier to use than the
> std.algorithm functions.

I don't know. The built-in sort is certified broken, very slow, and too much rigid. But I like the idea of a language that has built-in some very common operations, especially if it already has built-in data structures (like dynamic arrays and associative arrays. Associative arrays are a complex data structure).
The good thing of the built in sort is that if you have to sort small groups of many different types of data, you don't need to import algorithms and your binary doesn't inflate because of all those different instances of the sort templated function.

In the end I think that:
- The sort method from the dynamic arrays can be removed;
- The reverse method can be kept;
- More useful methods can be added to the associative arrays, I have written about this in the past few times.

Bye,
bearophile



More information about the Digitalmars-d mailing list