Pillsy: > bearophile wrote: > [...] > > Another possible solution is to modify the semantics of this kind of > > arguments pass, so the code inside the function foo always see an > > args array allocated on the heap: > > > void foo(int[] args...) { // code > > > You may then add "scope" to restore the original lighter semantics: > > void foo(scope int[] args...) { // code > > > This is safer than the current semantics because the safe design is > > the built-in one and the faster is on request. > > I don't know how easy it would be,
That looks easy to implement, the compiler doesn't need to be smart to do that. The other idea of @noheap is harder to implement. > It has one other advantage, in that you can use the `scope` keyword for > things other than varargs, like closures. That scope syntax is already supported for closures, and it's partially implemented (or fully implemented, I am not sure). Bye, bearophile