Inferring static array size

rkompass rkompass at gmx.de
Fri May 3 07:48:01 UTC 2024


On Tuesday, 30 April 2024 at 05:51:24 UTC, NotYouAgain wrote:
> On Tuesday, 30 April 2024 at 02:20:39 UTC, electricface wrote:
>> On Sunday, 28 April 2024 at 16:08:11 UTC, Richard (Rikki) 
>> Andrew Cattermole wrote:
>>> On 28/04/2024 10:17 PM, ryuukk_ wrote:
>>>> |_| should be enough
>>>
>>> ``_`` is a valid identifier that may point to a length.
>>>
>>> So that isn't usable.
>>
>> I think it's better to represent the automatically calculated 
>> length using `..` .
>>
>> ```
>> int[..] a = [1,2,3,4,5]
>> ```
>
> Yes, I like this more.
>
> Someone please submit a DIP.

I actually find this counterintuitive. Because [..] in my 
intuition looks like a dynamic array. But it's about creating a 
static array.

How about
`int[#] a = [1,2,3,4,5]` ?


More information about the dip.ideas mailing list