Escape analysis

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Oct 28 06:35:17 PDT 2008


Jason House wrote:
> Walter Bright Wrote:
> 
>> Jason House wrote:
>>>> scope is a storage class, not a type constructor.
>>> How do you treat members of objects passed in? If I pass in a
>>> struct with a delegate in it, is it treated as scope too? What if
>>> it's an array? A class?
>> The scope applies to the bits of the object, not what they may
>> refer to.
> 
> This seems rather limiting. I know this is aimed at addressing the
> dynamic closure problem. This solution would mean that I can't
> encapsulate delegates. Ideally, I should be able to declare my
> encapsulating struct as scope or noscope and manage the member
> delegate accordingly.

I think it's clear that scope is transitive as much as const or 
immutable are. Noscope is also transitive.

Escape analysis is a tricky business. My opinion is that we either take 
care of it properly or blissfully ignore the entire issue. That opinion 
may disagree a bit with Walter's, who'd prefer a quick patch for 
delegates so he returns to threading. I think if we opt for a quick 
patch now, it'll turn to gangrene later. Among other things, it will 
hurt the threading infrastructure it was supposed to give precedence to.


Andrei



More information about the Digitalmars-d mailing list