Array literals are weird.

Blatnik blatblatnik at gmail.com
Tue May 4 10:09:59 UTC 2021


On Tuesday, 4 May 2021 at 01:59:48 UTC, norm wrote:
> https://github.com/dlang/dmd/pull/3615
>
> ```d
> auto a[$] = [1,2,3];
> ```
>
> I was disappointed it never got accepted but I am sure there 
> were good reasons. At the time I think it was "this should be a 
> library solution" and that was probably where `staticArray` 
> came from

Oh that is pretty disappointing...

I actually intuitively tried to do this while I was learning D. 
So IMO it fits the language perfectly.

It looks like it wasn't merged because Andrei and Walter thought 
it complicates the language needlessly 
(https://github.com/dlang/dmd/pull/3615#issuecomment-72397283).

There's still this DIP: 
https://github.com/dlang/DIPs/blob/master/DIPs/DIP1039.md & 
https://forum.dlang.org/thread/ucqyqkvaznbxkasvdjpx@forum.dlang.org?page=3.


More information about the Digitalmars-d mailing list