On 23 Sep 2011, at 11:30pm, Darren Duncan wrote:

> This is why I think it is valuable for a programming language to provide 
> multiple versions of some operations such as boolean "and","or" where one 
> variant doesn't short-circuit and the other does.
> 
> The primary purpose, then, of short-circuiting operators, is *not* about 
> performance but rather about validity; they would be used in situations where 
> the value of one operand determines whether it is even valid to calculate the 
> other operand, such as if the first operand is a type check and the second is 
> an operation that is only valid for some types.
> 
> In fact, for a computationally complete language that is functional, I would 
> argue that short-circuiting logic operators is essential.

Except that this is going to get rarer as languages arrive which encode 
multi-processing as part of the compilation process.  One-by-one evaluation is 
going to vanish.  If you have three processors free, why not evaluate three 
arguments at once, even if it turns out that the value of one of them means the 
other two don't matter ?  We're going to find applications going down many 
'false paths' in the process of arriving at a response.

If you want your arguments evaluated, evaluated them yourself.  If the order 
matters, evaluate them in that order.  Don't rely on it as an undocumented 
side-effect of something else.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to