Why I (Still) Won't Use D
Christopher Wright
dhasenan at gmail.com
Thu Mar 27 20:05:37 PDT 2008
Michiel Helvensteijn wrote:
> Qt softens the blow by having a implicit constructor that takes an
> std::string and a member-function toStdString().
And the various string classes I've seen for D (usually called Text)
have constructors or implicit casts from the various builtin string types.
> By hard-coding certain behaviors in the core language, you've taken away the
> freedom of the programmer to choose these hirself. Like the growth-rate of
> dynamic arrays. Or the sorting algorithm used by the .sort property. Or the
> datastructure returned by the .keys property of associative arrays.
No, it just means that most reasonable usage will have much cleaner
syntax. It just means that code is more interoperable and more portable.
If a programmer wants more control over their basic data structures,
they can write their own or find a library solution. But for most
applications, for most libraries, D's builtin arrays do at least as well
as Java's or C#'s list classes, and its associative arrays as well as
their dictionaries. And if these were library types, the exact same
properties would hold.
Of course, a huge bonus for having these built in is that you can have
literals. In C#, you don't have dictionary literals; at my job we have a
hack that looks like:
-Using.Values["key", value]["key2", value2];
That's horrible compared to just ["key": value, "key2": value2];.
More information about the Digitalmars-d
mailing list