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

Basile B. b2.temp at gmx.com
Thu Jul 14 19:57:24 UTC 2022


On Thursday, 14 July 2022 at 17:57:13 UTC, Ali Çehreli wrote:
> - int[$]      // Not perfect because the array does not have a 
> length

I wanted to implement that in my language and found a subtle 
problem that makes the implementation of the feature a not so 
nice looking special case : the semantics of `int[$]` require the 
initializer unlike `auto`, which can be directly replaced by the 
initializer type. That breaks the binary and (somewhat ideal) 
approach of either `auto` and replace or full type and implicit 
conv of the initializer.


More information about the Digitalmars-d mailing list