DIP69 - Implement scope for escape proof references

Shammah Chancellor via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 10 23:09:25 PST 2014


On 2014-12-11 07:03:58 +0000, Shammah Chancellor said:

> On 2014-12-04 09:24:13 +0000, Walter Bright said:
> 
>> http://wiki.dlang.org/DIP69
>> 
>> Despite its length, this is a fairly simple proposal. It adds the 
>> missing semantics for the 'scope' storage class in order to make it 
>> possible to pass a reference to a function without it being possible 
>> for it to escape.
>> 
>> This, among other things, makes a ref counting type practical. It also 
>> makes it more practical to use other storage allocation schemes than 
>> garbage collection.
>> 
>> It does not make scope into a type constructor, nor a general 
>> type-annotation system.
>> 
>> It does not provide an ownership system, though it would complement one.
> 
> I like the basics of the proposal and I think it's the right direction. 
>  HOWEVER, I strongly believe that function arguments should be scoped 
> by default and `impure` when they take reference which they will keep.
> 
> -Shammah

Also, more feedback.   I would suggest that scope variable are the 
default inside of functions as well as parameters.   Using escape 
analysis, instead of them being errors, make them warnings and 
implicitly make them impure.

-Shammah



More information about the Digitalmars-d mailing list