bearophile wrote:
void bar(int n) {
scope int[] a = new int[n]; // stack-allocated
foo(a);
}
Why are you making such proposals, when one of the core developers even
thought about removing normal "scope"? It's almost 100% guaranteed that
nobody will listen.
I personally find it a good idea to find new ways to reduce producing
memory garbage. The D GC is slow and bad, so you'd better avoid it.
Let's make this claim: it is impossible to write high performance
applications (that need to make use of dynamic memory allocation) in D
without resorting to "unsafe" techniques. That would include allocating
memory on the stack, or manually freeing memory.
Maybe D should have focused more on safe and efficient memory managment
concepts, like they can be found in languages like Cyclone (though I
don't know how useful/feasible this is, but it sounded promising).