Should we remove int[$] before 2.067?
Meta via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jan 30 12:33:23 PST 2015
On Friday, 30 January 2015 at 14:47:22 UTC, Andrei Alexandrescu
wrote:
> 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.
I'm somewhat neutral on [$], although I think it is useful. I
like the partial type deduction feature and think we should keep
that. It makes a lot of array declarations more concise, and
subjectively, I think it feels like a natural extension of what D
already does with auto.
I think if you showed someone auto declarations and then showed
them something like auto[] arr = [...], their likely reaction
would be "well of course that works". Although maybe I'm too
familiar with D at this point and that's not the case at all.
> 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.
If you're talking about Bearophile's proposed [1, 2]s syntax,
he's been pushing that for a long time, possibly before [$].
More information about the Digitalmars-d
mailing list