DIP69 - Implement scope for escape proof references

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 4 16:33:22 PST 2014


On 12/4/2014 3:54 PM, H. S. Teoh via Digitalmars-d wrote:
>> The compiler assumes func(s) returns a ref to s, and so it won't allow
>> func(s) to be returned from foo().
>
> Ah, I see. So you're saying that under this DIP, `return func(...);`
> from a ref function will be prohibited unless the arguments to func()
> were all either scope or non-reference?

Right.

> That sounds good, though it *is* pretty invasive, as any existing ref
> functions that do this will need to be revised, which potentially
> spreads 'scope' to many other places, depending on how deeply the chain
> of tail recursion / tail func calls go.

I know:

1. that's why the extensive support for scope inference
2. I couldn't see any other way



More information about the Digitalmars-d mailing list