"with" should be deprecated with extreme prejudice
Derek Parnell
derek at psych.ward
Mon May 18 14:35:20 PDT 2009
On Mon, 18 May 2009 09:55:42 -0700, Sean Kelly wrote:
> Derek Parnell wrote:
>>
>> I guess the reason for using with() is to avoid typing repetitive stuff.
>> Would this work instead ...
>>
>> int x, y;
>> with (p as "somevery.long.struct.or.class[17].name")
>> {
>> y += p.x;
>> ++p.x;
>> }
>
> {
> ref p = somevery.long.struct.or.class[17].name;
> y += p.x;
> ++p.x;
> }
Yes that would work too, and probably better code generation too.
The difference being that my suggestion is a compile-time behaviour and
yours is a run time behaviour.
--
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell
More information about the Digitalmars-d
mailing list