[Tutor] 'or' in assignment (not if statement)?
wprins at gmail.com
Sat Dec 11 03:38:15 CET 2010
On 10 December 2010 03:50, Steven D'Aprano <steve at pearwood.info> wrote:
> Some languages (Pascal comes to mind) doesn't have short-circuit behaviour
> at all.
Don't mean to nit pick, but in my experience it really depends on the
compiler implementation and which version of Pascal you're talking about.
Certainly, Borland's Turbo Pascal had and later Object Pascal (today called
Delphi) has to this day short-circuit evaluation as default behaviour,
although you can turn this off via a compiler switch if you want. (And as
an aside, according to wikipedia ISO Pascal actually also allows but does
not require support of short-circuit boolean evaluation.) It really depends
on what your program does -- if your program contains functions with
side-effects (a bad idea, but if it does) then short-circuit evaluation will
probably break your code. On the other hand, not having short-circuit
boolean expression evaluation can in most programming contexts be needlessly
Anyway, your general point is of course quite correct, so feel free to
ignore my ramblings...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor