[M3devel] quake and/or "short circuit"
Jay K
jay.krell at cornell.edu
Sun Aug 15 05:31:19 CEST 2010
It would have been nice for and/or to short circuit in quake like they do in C.
Code like:
if not defined("TARGET")
readonly TARGET = "I386_FREEBSD"
else
if not equal(TARGET, "FreeBSD4")
readonly TARGET = "I386_FREEBSD"
end
end
is better written as:
if not defined("TARGET") or not equal(TARGET, "FreeBSD4")
readonly TARGET = "I386_FREEBSD"
end
but that isn't allowed because equal() will complain that TARGET isn't defined.
It probably can't fixed though, due to e.g.:
if TRUE or DoSomething()
...
end
would be broken.
perhaps
OR and AND
or short_circuit_and
or and_shorted
or and_short_circuit
or and_early_out
or and_early
or "&&"
or something...
Or I should just rewrite so much quake in Modula-3...
- Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100815/72831fa7/attachment-0001.html>
More information about the M3devel
mailing list