[Issue 13556] inconsistent 'new' syntax for arrays

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Sep 29 01:18:09 PDT 2014


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

Ketmar Dark <ketmar at ketmar.no-ip.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ketmar at ketmar.no-ip.org

--- Comment #2 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
(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].
this can be easily fixed: `new [256][256]` => `new [][](256, 256)`, and `new
([256])[256]` => `new [256][](256)`.

i.e. to generate array of 256 `ubyte[256]` one can add parens. this way
`[256][256]` will be intuitive and '256*ubyte[256]' is possible.

or just kill then `new [n]` syntax altogether, so people will not try `new
[n][m]`.

--


More information about the Digitalmars-d-bugs mailing list