array cast should be supported corrected

bearophile bearophileHUGS at lycos.com
Wed Aug 6 14:10:33 PDT 2008


Frank Benoit:
> The programmer always needs to know what the concequences are. With this 
> argumentation the string concatenation ~ should also be banned from the 
> language, because hidden heap allocation has always unbound execution time.

Here I agree with Walter, a good language *must* act as much transparently as humanly possible, otherwise the life of the programmer becomes miserable (the only problems I find in D are when I mix GC-managed pointers with GC-unmanaged pointers in data structures, this leads to complex situations because I haven't written the GC, I don't know much about how its internals work, so in those situations for me it's *not* transparent).

But D is a language designed to prevent programmer bugs when possible, so a simple solution is to make the compiler raise a compilation error at compile time in those situations.
Then, if people want it, it can optionally be added a different kind of cast to D, maybe an array_cast(), that is known to work in O(n).

Bye,
bearophile



More information about the Digitalmars-d mailing list