Boolean operators (Was: Re: New Alpha)
Berend de Boer wrote:
* If statements and such now default to short-circuit operations. This can still be switched to complete evaluation using `--no-short-circuit', (*$B+*), or (*$no-short-circuit*). With `--standard-pascal' etc., the default becomes complete evaluation and can be switched to short circuit using `--short-circuit', (*$B-*), or (*$short-circuit*).
(It is done this way because the cases where a program relies on complete evaluation of Boolean expressions are very rare; functions with side effects should not occur in such situations anyway because you cannot rely on the order of evaluation. OTOH, there are *many* programs which rely on short circuit evaluation.)
I like to add that Extended Pascal has the or_else and and_then to force short circuit evalutation.
A quite clean solution IMHO.
Indeed, I think this is good if one uses complete evaluation by default. However, I prefer to have short circuit evaluation by default. So what about similar operators to force complete evaluation - it would seem cleaner to me than using {$B+} ... {$B-}? -- Frank Heckenbach, Erlangen, Germany heckenb@mi.uni-erlangen.de Turbo Pascal: http://www.mi.uni-erlangen.de/~heckenb/programs.htm Internet links: http://www.mi.uni-erlangen.de/~heckenb/links.htm
participants (1)
-
Frank Heckenbach