DIP69 - Implement scope for escape proof references
H. S. Teoh via Digitalmars-d
digitalmars-d at puremagic.com
Thu Dec 4 13:23:14 PST 2014
On Thu, Dec 04, 2014 at 12:41:58PM -0800, Walter Bright via Digitalmars-d wrote:
[...]
> struct RefCounted(T)
> {
> T t;
> scope ref T borrow() { return t; }
> alias this t;
> }
>
> This enables RefCounted!T to be implicitly converted to a T, but with
> a scoped result. This is a critical feature, one I spent a lot of time
> thinking about, and hope it's right :-)
Hold on, how does this convert to T with a scoped result? Or did you
mean:
...
@property scope ref T borrow() { ... }
alias borrow this;
?
T
--
Let's call it an accidental feature. -- Larry Wall
More information about the Digitalmars-d
mailing list