static array with inferred size

Steven Schveighoffer schveiguy at yahoo.com
Fri Sep 22 12:19:32 UTC 2017


On 9/22/17 3:55 AM, Dominikus Dittes Scherkl wrote:
> On Thursday, 21 September 2017 at 13:58:14 UTC, Timon Gehr wrote:
>> On 21.09.2017 12:33, Per Nordlöw wrote:
>>> On Wednesday, 20 September 2017 at 18:41:51 UTC, Timon Gehr wrote:
>>>>> Can that be done without breakages? -- Andrei
>>>>
>>>> No.
>>>
>>> Are thinking about
>>>
>>>      typeof([1,2])
>>>
>>> changing from
>>>
>>>      int[]
>>>
>>> to
>>>      int[2]
>>>
>>> ?
>>
>> Yes, and everything that entails, for example:
>>
>> auto x = [1,2];
>> x ~= 3; // goes from ok to `error: cannot append int to int[2]`.
> 
> Ok, breaks code, but I like it. Much better than the current behaviour.

Don't fall in love with it. It's not going to happen, as this would be 
too much breakage for almost no gain.

Much as I want a way to statically infer a static array size, this is 
not the answer.

-Steve


More information about the Digitalmars-d mailing list