On 05/28/2014 03:10 PM, Jonathan M Davis via Digitalmars-d-announce wrote:
> On Tue, 27 May 2014 06:42:41 -1000
> Andrei Alexandrescu via Digitalmars-d-announce
> <firstname.lastname@example.org> wrote:
> > https://news.ycombinator.com/newest (search that page, if not found
> > click "More" and search again)
> > https://www.facebook.com/dlang.org/posts/855022447844771
> > https://twitter.com/D_Programming/status/471330026168651777
> Fortunately, for the most part, I think that we've avoided the types of
> inconsistencies that Scott describes for C++, but we do definitely
> of our own. The ones that come to mind at the moment are:
> 1. The order of the dimensions of multi-dimensional static arrays is
> in comparison to what most everyone expects.
However, those expectations are based on the inside-out syntax of C.
Naturally, wanting to be consistent, especially compared to C, D should
deviate from that syntax.
> int foo;
That is sane: It is alwasy "first the type then the size":
Following from that rule (i.e. first type, then size), how would I have
an array of 3 elements where each element is an array of 4 elements.
Let's see... Each element is int. There:
Then, I want an array of 3 of those. There:
This is one of the commonish arguments in the D forums that I have the
strongest opinion because there is no problem with D's syntax at all. It
It is consistent even when indexing. The index is for the array:
a; // the first element of a; it is an int
b; // the first element of b; it is an int
I don't see any problem at all. :)
Remembering that there is no such thing as a multi-dimensional array in
D (nor C), it just follows naturally:
b; // the second int of the first int
> is the same as
> int foo;
That's beyond ridiculous. I am glad that D avoided that problem for both
function pointers and arrays.
> and has the same dimensions as
> auto bar = new int(6, 5, 4);
That makes perfect sense to me, because this is a function API, not D
syntax. There is no ambiguity in saying "you go deeper into the element
sizes as you provide the arguments."