Will D 2.x have refrences

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Thu Oct 11 13:58:20 PDT 2007


Bill Baxter wrote:

> But they don't work for things that require '.'s to get to.
> 
> void main() {
>     int& value = myClass.some.value_member; // C++, ok
>     ...
> }
> 
> void main() {
>     alias myClass.some.value_member  value;  // D, ack!
> }
> 

Hmm, interesting. Wouldn't it be possible to extend the functionality?
Doesn't seem like alias fully handles those as symbols. For example this
gives me two(?!) "Error: need 'this' for address of bar" errors on the last
line:

struct foo {
  struct b { int a; }
  b bar;
}

foo f;
alias f.bar b;
assert(b.a == 0);



More information about the Digitalmars-d mailing list