I wonder why, traditionally, shortcut evaluation of boolean subexpressions has been applied to “and” and “or” connectives, but not any others.
For example, what about “implies”?
a implies b
Common sense applies, otherwise you could shortcut these operations:
a * b // when a is zero, the result is zero
a & b // when a is zero
On Fri, 7 Jun 2024 13:41:06 +0100, bart wrote:
Common sense applies, otherwise you could shortcut these operations:
a * b // when a is zero, the result is zero
a & b // when a is zero
And why not? It would depend on the complexity of the “a” and “b” subexpressions, of course.
In general, it would be inconvenient if you did not know whether "a @ b"
was going to evaluate "b", including all function calls and
side-effects.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (1 / 15) |
Uptime: | 155:23:15 |
Calls: | 10,383 |
Files: | 14,054 |
Messages: | 6,417,848 |