DMD 0.165 release
Walter Bright
newshound at digitalmars.com
Mon Aug 21 12:19:12 PDT 2006
Sean Kelly wrote:
> Thanks. I suppose it's worth mentioning that lazy evaluation can result
> in some confusing errors similar to those encountered with macro
> functions vs. normal functions. For example:
>
> void fn( char delegate() ch )
> {
> if( ch() == 'c' || ch() == 'd' )
> {
> printf( "match\n" );
> }
> }
>
> size_t pos = 0;
> char[] buf = "abdc";
>
> fn( buf[++pos] );
>
> The above code would print "match" because pos would be incremented
> twice. This makes API changes from the classic to lambda syntax a risky
> venture, as it risks silently breaking once-working code.
It doesn't break existing once-working code, because the example shown
will not compile with 0.164 and earlier compilers.
More information about the Digitalmars-d-announce
mailing list