auto arr = [1, 2, 3] should be a static array, not a GC allocated array

wjoe invalid at example.com
Thu Jul 14 20:42:41 UTC 2022


On Thursday, 14 July 2022 at 19:39:17 UTC, H. S. Teoh wrote:
> On Thu, Jul 14, 2022 at 12:18:34PM -0700, Ali Çehreli via 
> Digitalmars-d wrote:
>> On 7/14/22 11:55, H. S. Teoh wrote:
>> 
>> > Maybe int[static array] would make it much more obvious to 
>> > newbies. ;-)
>> 
>> Looks good but 'array' is a legal identifier. :( Luckily 
>> nothing some creative acrostic can't fix:
>> 
>>   int[static alias,ref,return,assert,'y'] arr;
> [...]
>> Ok, too much silliness for one day. I stop here.
> [...]
>
> But but but... this is proposed syntax for automatically 
> detecting the length of a static array.  At the very least, it 
> should spell out this fact:
>
> 	int[auto static pragma(array, length)] arr;
>
> The pragma, of course, is to provide a context where legal 
> identifiers have special meaning. :-D
>
> On a serious note, though, int[$] is ideal.
>
>
> T

auto[staticsupercalifragilisticexpialidocious:)] = [1, 2, 3];




More information about the Digitalmars-d mailing list