On Monday, November 21, 2016 12:08:30 Patric Dexheimer via Digitalmars-d- learn wrote: > On Saturday, 19 November 2016 at 00:47:00 UTC, ketmar wrote: > > On Saturday, 19 November 2016 at 00:28:36 UTC, Stefan Koch > > > > wrote: > >> Please don't post non-d. > > > > it slipped accidentally, sorry. ;-) > > > > for OP: `uint[2] a = [42, 69];` is the correct syntax. > > "uint[$] a = [42, 69];" > > haha for a moment I thought that this was the way of D to create > a fixed-size array without explicit setting the size (like what u > can do in c++ :))
No. D doesn't have that, though it's easy enough to do the same thing with a helper template. However, Ketmar seems to like to use his own fork of dmd where he made changes to the language based on his preferences. IIRC, it was proposed at one point that $ be used in this manner to create a static array while inferring its size (it might have even had a PR which was rejected), and presumably, Ketmar added it to his own compiler, because he liked the feature. But for better or worse, it's not standard D, and if the PR was rejected like I think it was, then it likely never will become standard D. Someone could create a DIP for it though and argue for it. If they did that convincingly enough, maybe it would become a feature. I suspect that the response will be though that since it's easy enough to just create a template to do the same thing, it's not worth adding to the language. - Jonathan M Davis