Re: Expression-local variables and 'let'

Daniel Bonniot <[email protected]> Fri, 20 Feb 2004 16:58:14 +0100
Newsgroups gmane.comp.lang.nice.general
Message-ID <[email protected]>
Isaac Gouy wrote:

>>val balance = currentBalance() in display(balance, warn: balance < 0);
>>display(val balance = currentBalance(), warn: balance < 0);
>>    
>>
>
>(I haven't been following this closely enough, but...)
>
>Why wouldn't we just do the 'balance < 0' within the method?
>  
>
I guess you could. The idea was that you might want not to encode in the 
method the cases it which there is a warning. Maybe at some point in the 
code you want to warn when it is negative, at if it's more than what 
your bank allows you without fees, at a third one if it's less that an 
amount of money you are thinking about spending.

The fact is, there are cases where you need to refer to the value of an 
argument in a later argument. The usual fix is to put that value in 
fromt of the fix, but the point is that this might not be needed. And I 
guess the point is much stronger when you have a whole block (because of 
an anonymous function) as a later argument of the call.

Daniel



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click