Neat trick - 'with' and unnamed objects + 'with' proposals

Dan murpsoft at hotmail.com
Tue Apr 24 10:16:35 PDT 2007


Bill Baxter Wrote:
>     typeof(condition()) x;
>     while(x = condition()) {
>         // do stuff
>     }
> }

Which is frighteningly different semantically, while being almost identical syntactically to:

while(x == condition()) {

Which is probably why Walter didn't want it to work.  It concerns me a little that if(x = 3) works.  

Honestly, D is syntactically abstracted away enough that while(something something) wouldn't have to compile down to evaluating it repeatedly.





More information about the Digitalmars-d mailing list