On Thursday, 11 August 2016 at 22:03:02 UTC, Walter Bright wrote:
On 8/11/2016 6:38 AM, Sönke Ludwig wrote:
What would be nice to add is a behavior specification for 'scope' member variables (lifetime considered equal or slightly shorter than parent object lifetime). For example the `RefCountedSlice.payload` and `count` fields could be annotated with 'scope' to let the compiler actually guarantee that they won't be accessible in a way that conflicts with their lifetime (i.e. the 'scope' return
of 'opIndex' would actually be enforced).

That adds a fair amount of complication I haven't worked through.

It can probably be done by lowering:

    scope T* payload;

Is conceptually:

    private T* payload_;
    @property scope T* payload() scope {
        return payload_;
    }

Reply via email to