My Reference Safety System (DIP???)

via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 28 03:12:22 PST 2015


On Friday, 27 February 2015 at 23:37:42 UTC, deadalnix wrote:
> On Friday, 27 February 2015 at 23:18:24 UTC, Marc Schütz wrote:
>> * When a scoped value is stored somewhere, it is then 
>> reachable through the destination. Therefore, assuming the 
>> source's scope is fixed, the destination's scope must be 
>> widened to accommodate the source's scope.
>
> So, when you are referring to scope here; you are referring to 
> the scope of the indirection, right ?
>

Yes. Terminology is a problem here, I guess. When I talk about 
"the scope" of a variable, it means that only references to 
values can be stored there whose lifetimes are at least as large 
as the scope.

> You don't cover the lifetime of the address of operation, and 
> I'm not how this is supposed to work in your proposal.
>

It was in the examples, but it was wrong. I've corrected it: A 
dereference results in static lifetime.

>> I will also add examples how return and static annotations are 
>> handled.
>
> static annotation ? Seems like a bad idea and I'm sure we can 
> do without.

It's only necessary if parameters of `@safe` functions are 
automatically scoped; then we need a way to opt-out. This is 
actually optional and does not affect the consistency, but I 
thought it is a good idea, because it reduces the overall amount 
of annotations. And I assume that most @safe functions are 
already written in a way that conforms to this. We'd need to 
analyze some code bases to find out whether this is actually true.


More information about the Digitalmars-d mailing list