On Monday, 4 February 2013 at 16:54:37 UTC, bearophile wrote:
Steven Schveighoffer:

Wow, this is something I didn't know was possible. Very useful!

It's it cute when you use a language almost daily for few years,
and then you see a new way to allocate built-in arrays? :-)

Bye,
bearophile

Technically, the straight up "C - style" syntax also does this just as well:

"int[2][] a = new int[2][2];"

Since the last "[2]" gets  rewritten to "[](2)"

But when written that way, I find it is not very clear what happens.

Ideally, I wish we could allocate static arrays on the heap easily:

"int[2]* p = new int[2]()"

Anybody know why this doesn't work? In a GC language like D, that has to track "capacity/usage" of its dynamic arrays, there is a real gain to being able to specify: I want my damn array to be fixed in size: Don't track any growing information for me.

Reply via email to