On Friday, 7 July 2017 at 00:58:57 UTC, jmh530 wrote:
On Friday, 7 July 2017 at 00:39:32 UTC, Meta wrote:


(https://github.com/dlang/dmd/pull/3615)

Of course this could also get confusing pretty fast. I wish we at least had the `int[$]` syntax but it's not a huge loss.

Thanks for posting the link. Made for interesting reading.

This was another link on the same topic:
http://forum.dlang.org/post/bewroetnschakoqjz...@forum.dlang.org

Yeah, it's one of those features that seemed very nice and I, at the very least, was disappointed that it didn't get in (of course Bearophile was as well). I don't really agree with Andrei's reason for vetoing the feature (the part about adding this feature being a slippery slope, not the power to complexity ratio), but looking back on it there are a few peculiarities with this syntax. For example, `immutable[] i = [0]` has the type `immutable(int)[]`, but to get `immutable(int[])` you have to do `immutable i = [0]`. I'd say that a beginner looking at this code would assume the opposite (although it's a very easy rule to learn). It's one of the problems D has with this syntax as opposed to C++, which has the ability to declare head-const arrays/pointers.

Reply via email to