RFC, ensureHeaped

Pillsy pillsbury at gmail.com
Fri Nov 12 11:25:26 PST 2010


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, but I *really* like this proposal. It has one other advantage, in that you can use the `scope` keyword for things other than varargs, like closures.

Cheers,
Pillsy


More information about the Digitalmars-d mailing list