[Dlang-internal] DIP1000 discussion and testing: RC pointer snippet

meppl via Dlang-internal dlang-internal at puremagic.com
Thu Oct 20 18:46:20 PDT 2016


On Thursday, 20 October 2016 at 21:43:59 UTC, Walter Bright wrote:
>
> It's long been my belief that if lifetime annotations had to be 
> explicit, few would be interested in using such a "bondage and 
> discipline" language. As further evidence of that, Rust goes to 
> great lengths to infer lifetime attributes. Annotations don't 
> excite people.

explicit lifetime annotations...


isnt it possible to upgrade this scope-annotation system 
afterwards?


for example:  hidden scope
after dip1000 is implemented, a new storage_class gets introduced 
- lets say „jailed“.
If „jailed“ appears in code, the compiler scans the AST for the 
route the pointer takes within one module or within one package
and adds the needed hidden_scope annotations automatically.

it would look like that:
void func( T* t) @safe;  // second version of this function 
exists:
                          // void func( hidden_scope T* t) @safe;
void bar( jailed T* t) @safe {
    func(t); // ok, compiler added hidden_scope for void func( T* 
t) itself
}
how it looks like in DIP1000:
void func(scope T* t) @safe;
void bar(scope T* t) @safe {
    func(t); // ok
}

if an opaque function (of different module/package) appears, that 
opaque function must have the scope/jailed annotation again.


More information about the Dlang-internal mailing list