C#7 features

Steven Schveighoffer via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri May 6 16:51:59 PDT 2016


On 5/7/16 1:29 AM, Timon Gehr wrote:
> On 06.05.2016 18:58, Kagamin wrote:
>> On Friday, 6 May 2016 at 14:33:22 UTC, Andrei Alexandrescu wrote:
>>> Added a comment:
>>>
>>> https://www.reddit.com/r/programming/comments/4i3h77/some_new_c7_features/d2v5lu6
>>>
>>>
>>
>> D has ref variables? Not for a long time though.
>
> D actually does not support ref local variables in most contexts (one
> can have ref locals declared by foreach). There is an explicit check
> ruling them out, but I'm pretty sure DMD supports them internally, they
> are useful for lowering.

Of COURSE D supports local ref variables:

struct RefVar(T)
{
   private T * var;
   this(ref T v) { var = &v; }
   auto get() { return *var; }
   alias this get;
}

;)

-Steve


More information about the Digitalmars-d-announce mailing list