DIP69 - Implement scope for escape proof references
Nick Treleaven via Digitalmars-d
digitalmars-d at puremagic.com
Sat Dec 6 05:03:36 PST 2014
On 04/12/2014 21:23, H. S. Teoh via Digitalmars-d wrote:
> @property scope ref T borrow() { return t; }
> alias borrow this;
While this DIP enabling the above to be memory-safe is awesome, a later
tweak to AliasThis grammar to allow storage classes could make 'borrow'
redundant. Plain alias now allows storage classes:
AliasDeclaration:
alias StorageClassesopt BasicType Declarator ;
So:
TweakedAliasThis:
alias StorageClassesopt Identifier this ;
Given ref and now scope will be storage classes, that would then allow just:
alias scope ref t this;
More information about the Digitalmars-d
mailing list