Should we remove int[$] before 2.067?
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jan 30 06:47:22 PST 2015
As discussed in this forum, Kenji has authored
https://github.com/D-Programming-Language/dmd/pull/3615 which has been
recently merged.
By this I am proposing we revert that decision, and quickly - before
2.067 is released lest we'll need to support it forever. Here's why.
One simple litmus test for a new language feature is "it can't be done
within the current language". That's a good yardstick; coupled with the
importance of the task, it forms a compelling reason for adding the
feature. There's nuance to that, e.g. it can be done but it's onerously
difficult; or the feature is so frequently needed, dedicated language is
warranted.
The recent int[$] feature seems to fail that test. That feature, and in
fact more, can be done trivially with library code:
http://dpaste.dzfl.pl/f49a97e35974.
In my opinion these particular features are not frequent enough to
warrant dedicated syntax.
Furthermore, one other unpleasant aftermath of int[$] is that new syntax
begets more new syntax. The proverbial ink was not yet dry on the #3615
merge when a new, new syntax was proposed in this forum, this time for
statically-allocated statically-sized arrays. Far as I can tell the main
argument is "you have to write longer code" without it.
I am not okay with that - at all.
D is a great language with many awesome features. Too many, in some
people's opinion. We must get into the habit of using D's ample
orchestra to create new music, not add a new instrument for every tune.
So I am think we should consider reverting
https://github.com/D-Programming-Language/dmd/pull/3615 and adding the
appropriate functions to std.array.
Please advise.
Andrei
More information about the Digitalmars-d
mailing list