"with" should be deprecated with extreme prejudice

bearophile bearophileHUGS at lycos.com
Mon May 18 09:59:08 PDT 2009


Sean Kelly:

> {
>      ref p = somevery.long.struct.or.class[17].name;
>      y += p.x;
>      ++p.x;
> }

{
     alias somevery.long.struct.or.class[17].name p;
     y += p.x;
     ++p.x;
}

Or:

{
     alias somevery.long.struct.or.class[17].name as p;
     y += p.x;
     ++p.x;
}

Or nicer:

alias somevery.long.struct.or.class[17].name as p {
     y += p.x;
     ++p.x;
}

Bye,
bearophile



More information about the Digitalmars-d mailing list