[Issue 13556] inconsistent 'new' syntax for arrays

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat May 30 15:13:12 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=13556

dennis.m.ritchie at mail.ru changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dennis.m.ritchie at mail.ru

--- Comment #7 from dennis.m.ritchie at mail.ru ---
(In reply to Kenji Hara from comment #3)
> (In reply to bearophile_hugs from comment #1)
> > I suspect that the array creation syntax is an unfixable mess.
> > 
> > new int[256][256] can also be generate a pointer to fixed size array
> > int[256][256].
> 
> I think all dynamic array allocation should be writtten as:
> 
>     int[][](1, 2)
> 
> Current ambituity syntax new int[2][1] should be deprecated, removed,
> and then we can reuse it for static array allocation.

Now D is used for a multidimensional array syntax :)

auto arrray = new int[][][][][][][][][][][](4, 8, 6, 13 /* ... The length of
the other subarrays on request */);

I suggest to implement such a syntax for declaring multidimensional arrays:

auto array = new int[11](4, 8, 6, 13 /* .... The length of the other subarrays
on request */);

P.S. The syntax for declaring multidimensional arrays, needs work!

--


More information about the Digitalmars-d-bugs mailing list