feature request (&&/|| shortcut)

Ondrej Zajicek santiago at crfreenet.org
Thu Jan 6 12:38:47 CET 2011


On Sun, Jan 02, 2011 at 05:29:08PM +0100, Arnold Nipper wrote:
> It looks like BIRD logical && operator is not doing a shortcut. I.e even
> if you have s.th. like
> 
> if 0 && $some_complex_expression then ...
> if 1 || $some_complex_expression then ...
> 
> BIRD will try to evaluate $some_complex_expression. Would really be
> great if you could short cut this as you may have situations where the
> first expression already is false while trying to evaluate 2nd
> expression may lead to run time errors in that case. In this case you
> would have to use a nested "if first_expression then if 2nd_expression
> then" instead of "if first_expression && 2nd_expression then"

You are right, short-circuit evaluation is probably a better behavior.
I will look at that and probably change that.

-- 
Elen sila lumenn' omentielvo

Ondrej 'SanTiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20110106/45e4dd3d/attachment-0001.asc>


More information about the Bird-users mailing list