Discussion Thread: DIP 1039--Static Arrays with Inferred Length--Community Review Round 1

Patrick Schluter Patrick.Schluter at bbox.fr
Wed Jan 6 15:57:45 UTC 2021


On Wednesday, 6 January 2021 at 14:03:14 UTC, Mathias LANG wrote:
> On Wednesday, 6 January 2021 at 13:48:52 UTC, angel wrote:
>> On Wednesday, 6 January 2021 at 09:24:28 UTC, Mike Parker 
>> wrote:
>>
>>> The Feedback Thread is here:
>>> https://forum.dlang.org/post/qglydztoqxhhcurvbxhs@forum.dlang.org
>>
>> Why not "int[auto] arr = [1, 2, 3]" ?
>> IMHO auto keyword is less ambiguous than $.
>
> Someone else could misunderstand `auto` to mean partial type 
> deduction on associative array, e.g. `int[auto] arr = ["Hello": 
> ubyte(1), "World": ubyte(2)];`.
> Personally, I think `$` is very natural here, but I also didn't 
> consider `auto` before.

$ is very much appropriate imho, as it implies the length of the 
array. auto suggests a type (or storage class) and has only 
barely a link with arrays.



More information about the Digitalmars-d-announce mailing list