Why can't we make reference variables?

cal callumenator at gmail.com
Tue Aug 28 17:34:01 PDT 2012


On Wednesday, 29 August 2012 at 00:21:29 UTC, Tommi wrote:
> In this situation, I think, the most convenient and sensible 
> thing to do is to make a reference to the data, and use that 
> reference multiple times. We could make a pointer, but then 
> we'd be stuck with the nasty syntax of dereferencing:

This works currently:

struct Test
{
     void foo() const
     {
         writeln("FOO");
     }
}

void main()
{
     immutable(Test)* ptr = new immutable(Test);
     ptr.foo();
}




More information about the Digitalmars-d mailing list