On Thursday, 4 December 2014 at 09:25:11 UTC, Walter Bright wrote:
http://wiki.dlang.org/DIP69

Great stuff.

Will this be possible, it's a fairly important use-case.

scope ref T setVal(scope ref T t)
{
    t.val = 12;
    return t;
}

Another question, how would a reference counted pointer take advantage of scope, i.e. avoid the increment/decrement when being passed to a function? One solution would be to add a function that returns a scoped reference to the underlying value.
    struct RefCounted(T)
    {
        scope ref T borrow() { return *p; }
    }
Will it be possible to deduce, that the lifetime of that scoped value is tied to the smart pointer?

Reply via email to