Consistency, Templates, Constructors, and D3

F i L witte2008 at gmail.com
Mon Aug 27 08:16:02 PDT 2012


foobar wrote:
> I'd expect something like:
>
> [ ... ]

Ya, you could always have the Array constructor pass on 
construction Parameters as well, and I think your examples make 
sense.


> P.S
> I saw in a different language (Nimrod?) the syntax for array!T 
> is "[T]" which I like a bit more than D's "T[]" but this isn't 
> that important for the discussion at hand.

actually, Nimrod arrays look like:

     var a : array[0..5, int]
     var a = [0, 1, 2, 3, 4] # shorthand

and dynamic arrays (sequences):

     var s : seq[int]
     var s = @[0, 1, 2, 3, 4] # shorthand


D has the best array syntax, IMO. Especially with AA shorthands:

     auto aa = ['one':1, 'two':2, ... ];

I think that's pretty much prefect that way it is.


More information about the Digitalmars-d mailing list