DMD 0.148 - regular expressions

Chris Sauls ibisbasenji at gmail.com
Thu Mar 2 21:33:25 PST 2006


Dave wrote:
> In article <dtr2ff$2vqr$3 at digitaldaemon.com>, Walter Bright says...
> 
>>if statement now can declare a variable for the result (an adaptation of Ben 
>>Hinkle's idea). 
>>
> I haven't seen this brought up yet, so if it has my apologies.
> 
> The if(valptr; (key in AA)) syntax also nicely improves on how 'in' is used to
> avoid double lookups IMO. Still uses a pointer, but it is alot better.
> 
> old way:
> 
> int* p = (key in AA);
> if(p) (*p)++;
> else AA[key] = 1;
> 
> new:
> 
> if(p; key in AA) (*p)++;
> else AA[key] = 1;
> 
> - Dave

I hadn't even thought of that yet...  and I love it!  A server project of mine uses the 
'in' operator quite a bit, and I've always been annoyed with predeclaring variables and 
whatnot.  Now I won't have that issue, so long as Walter does the Right Thing (TM) and 
leaves this in.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list