On 16/03/2015 04:00, Zach the Mystic wrote:
struct RC(T) if(is(T == class)) {
     scope T payload;
     T borrow() return {    // `return` applies to `this`
         return payload;
     }
}
...
Also, what exactly does the `scope` on T payload get you?

It means if you forget the `return` attribute the compiler would issue an error about escaping payload. payload only has to be annotated once and the whole body of RC is checked to prevent implicit escaping of it.


Reply via email to