DMD 0.165 release
Sean Kelly
sean at f4.ca
Mon Aug 21 11:58:48 PDT 2006
Walter Bright wrote:
> Sean Kelly wrote:
>> Walter Bright wrote:
>>> I was going to call this 1.0 RC1, but I just could not resist adding
>>> the lazy expression evaluation. This adds one of the big capabilities
>>> of common lisp.
>>>
>>> http://www.digitalmars.com/d/changelog.html
>>
>> Nice work! I'm not sure I understand the advantage offered to the
>> enforcement example however, unless it is in creating the message
>> string (a benefit that was already demonstrated). Where is the lazy
>> evaluation occurring?
>
> The example has typos in it, but the advantage is to not evaluate the
> msg (which can be arbitrarily complex) unless an error actually occurs.
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.
Sean
More information about the Digitalmars-d-announce
mailing list