Lazy eval

Stewart Gordon smjg_1998 at yahoo.com
Wed Aug 23 06:41:27 PDT 2006


Frank Benoit wrote:
> I think the lazy eval is a great feature, but in this form it has also
> great drawbacks.
> 
> The code isn't that much readable as it was before. You don't know what
> will happen. Will that expression be evaluated or not? Or will it be
> evaluated more than once?
> 
> There is no possibility to choose between
> 
> func( char[] a ) vs. func( char[] delegate() dg )
> 
> func( funcRetInt() ); vs. func( &funcRetInt );

If that's the case, then something's wrong.  If funcRetInt returns a 
char[], despite the name, then funcRetInt() is of type char[]. 
Therefore it should match this first.

> It would be really important for me to have readable code. I want to
> look at the code, and want to have an impression what will happen.
> 
> What really would help, is if the the delegate is marked in some way as
> such. In the last releases of DMD the {} syntax was there. With it you
> needed the return statement. Perhaps we can choose the {} syntax with an
> optional return statement....
> 
> { "abc"         } => char[] delegate()
<snip>

That syntax looks confusingly like an array initialiser....

Stewart.



More information about the Digitalmars-d mailing list