auto arr = [1, 2, 3] should be a static array, not a GC allocated array
Ali Çehreli
acehreli at yahoo.com
Thu Jul 14 19:18:34 UTC 2022
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;
(Programmers would be free to use any keyword they like.)
That 'y' literal is an obvious eye sore. So we can expand the syntax to
specify which character of each keyword is used for the acrostic. I
utilize 'static' for that purpose as well:
// 0-based indexing for consistency
int[static static(1)
,cast
,break
,private
,false
,synchronized] arr;
// ^
// |
// Character 1 of each keyword reads "array"
Ok, too much silliness for one day. I stop here.
Ali
More information about the Digitalmars-d
mailing list