On Friday, 25 November 2016 at 14:27:39 UTC, Igor Shirkalin wrote:
On Wednesday, 23 November 2016 at 18:58:55 UTC, ketmar wrote:
We can define static array without counting the elements as following:


enum array_ = [1u,2,3,4];
uint[array_.length] static_array = array_;

there are workarounds, of course. yet i'll take mine `uint[$] a = [1u,2,3,4];` over that quoted mess at any time, without second thought. ;-)

I think you may write it (I mean actual D) with using some template like this:

yeah. but i'm not Andrei, i don't believe that the only compiler task is to resolve templated code. ;-) i.e. Andrei believes that everything (and more) should be moved out of compiler core and done with library templates. Andrei is genius, for sure, but he is living somewhere in future, where our PCs are not bound by memory, CPU, and other silly restrictions. ;-)

tl;dr: using template for this sux.

Reply via email to