Semantics of shared
newshound1 at digitalmars.com
Thu May 14 10:43:10 PDT 2009
Robert Jacques wrote:
>>> Sorry for the confusion of terminology. However, you talk blog about
>>> using the 'scope' keyword to support escape analysis, ettc. i.e.
>>> 'scope' would become the 'const' of the shared-thread local-stack
>>> storage type system. Is this still the plan?
>> I'm not sure what you mean by that.
> I'm asking about the use of scope you blogged about:
> For D, we are looking at a design that creates a parameter storage class
> called scope:
> T foo(scope int* p);
> The presence of scope means that the function will not allow the
> parameter, or anything reachable through that parameter, to escape from
> the scope of the function. The scope storage class can be applied to the
> parameters or the 'this' reference (for member functions). Initially,
> this will be a promise by the implementor of foo(), but it should be
> entirely possible for the compiler to perform escape analysis using data
> flow analysis techniques on the implementation of foo() to ensure it.
> The caller of the function will know that a reference to a local
> variable can be safely passed as a scope parameter. A million line
> program can be automatically verified as being free of escaping
> reference bugs.
We've talked about it, but am unsure as to whether it will work or not.
More information about the Digitalmars-d