> Someone (bearophile?) once suggested static arrays whose length is determined > at runtime, which would > be a great addition to the language: > void foo(int n) { int[n] myArr; }
That would be great. Question about the type: it won't be int[n] as n is runtime not compile time. would it be int[] or some other type? pros of some other type: makes some optimizations that benefit from the fact it's stack allocated possible cons: we need to be able to reuse existing algos that don't make such distinction. maybe another type that would satisfy both type traits: isDynamicArray!T isAllocaArray!T On Sat, Apr 13, 2013 at 4:19 AM, Mr. Anonymous <mailnew4s...@gmail.com> wrote: > After some Googling, I found out a similar technique already exists: > auto_buffer in C++. > http://goo.gl/3RLK6 > > I think it would be perfect to make it the default allocation method in D.