Lazy eval

Tom S h3r3tic at remove.mat.uni.torun.pl
Mon Aug 21 15:57:39 PDT 2006


Frank Benoit wrote:
>> Just as Walter stated, that's the same case as with 'in' vs 'inout' vs
>> 'out' arguments. You don't know what will happen in either case
> 
> If an argument is in/out/inout it is clear from the content and context.
> If it is out, you call the function to get something.
> 
> lazy-eval syntax
> When I code, I often guess what the method is called and what arguments
> it has.
> For example i have a container with a add( element ) method. Now this
> method is implemented with lazy-eval, if the container is already full,
> the argument is not evaluated.
> Or the get( index ) method does not eval the arg if the container is
> empty. And every time I have not only to remember the method name and
> arguments, now I have to know details of the implementation.

Nah, just that the arg might be left not-evaluated... I wouldn't use it 
with functions like 'get' or 'set' but with stuff for which it makes 
sense, just like with 'assert'.

I'm just trying to defend a point I don't really believe... You're 
probably right, the implicit approach brings more traps than advantages :(


--
Tomasz Stachowiak



More information about the Digitalmars-d mailing list