<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
I don't know what the names should be, I'm pretty comfortable with "&&" and "||".<BR>
Short circuiting is very useful.<BR>
<BR>
> Dijkstra advises against it, though.<BR><BR>
That makes me question Dijkstra, not short circuiting.<BR>
<BR>
<BR>
Also useful is assignment being an expression.<BR>
I wish it was in Modula-3.<BR>
<BR>
Such things as:<BR>
<BR>
<BR>
if ((f = fopen(..)) && fread(f,...)<BR>
<BR>
<BR>
or if (p && *p)<BR>
<BR>
<BR>
In the first case Modula-3 forces useless verbosity and indentation.<BR>
In the second case Modula-3 gets it right but Quake fails.<BR>
<BR>
Lacking these features you end up contorting your code one way or another, such as duplicating things.<BR>
<BR>
<BR>
I really can't stand code that looks like:<BR>
<BR>
<BR>
result = do something<BR>
if success(result)<BR>
do more stuff<BR>
if success<BR>
do more stuff<BR>
if succes<BR>
do more stuff<BR>
<BR>
<BR>
Modula-3 this wrong.<BR>
Exceptions help.<BR>
But basically I want to be able to introduce WITH or VAR anywhere, but not need to "END" them, and therefore no implied need for indentation..<BR>
<BR>
- Jay<BR><BR> <BR>
> To: jay.krell@cornell.edu<BR>> Date: Tue, 17 Aug 2010 15:27:04 -0700<BR>> From: mika@async.async.caltech.edu<BR>> CC: m3devel@elegosoft.com<BR>> Subject: Re: [M3devel] quake and/or "short circuit"<BR>> <BR>> If you really want it, you can always introduce "cand" and "cor" for<BR>> the short-circuit versions.<BR>> <BR>> Dijkstra advises against it, though.<BR>> <BR>> Mika<BR>> <BR>> Jay K writes:<BR>> >--_203e0ef7-c6fc-42ed-ad8c-3abbdc3b9c9e_<BR>> >Content-Type: text/plain; charset="iso-8859-1"<BR>> >Content-Transfer-Encoding: quoted-printable<BR>> ><BR>> ><BR>> >It would have been nice for and/or to short circuit in quake like they do i=<BR>> >n C.<BR>> ><BR>> ><BR>> >Code like:<BR>> ><BR>> >if not defined("TARGET")<BR>> > readonly TARGET =3D "I386_FREEBSD"<BR>> >else<BR>> > if not equal(TARGET=2C "FreeBSD4")<BR>> > readonly TARGET =3D "I386_FREEBSD"<BR>> > end<BR>> >end<BR>> ><BR>> ><BR>> >is better written as:<BR>> >if not defined("TARGET") or not equal(TARGET=2C "FreeBSD4")<BR>> > readonly TARGET =3D "I386_FREEBSD"<BR>> >end<BR>> ><BR>> >but that isn't allowed because equal() will complain that TARGET isn't defi=<BR>> >ned.<BR>> ><BR>> >It probably can't fixed though=2C due to e.g.:<BR>> ><BR>> >if TRUE or DoSomething()<BR>> > ...<BR>> >end<BR>> ><BR>> ><BR>> >would be broken.<BR>> ><BR>> ><BR>> >perhaps<BR>> >OR and AND<BR>> >or short_circuit_and<BR>> >or and_shorted<BR>> >or and_short_circuit<BR>> >or and_early_out<BR>> >or and_early<BR>> >or "&&"<BR>> >or something...<BR>> ><BR>> ><BR>> >Or I should just rewrite so much quake in Modula-3...<BR>> ><BR>> ><BR>> > - Jay<BR>> > =<BR>> ><BR>> >--_203e0ef7-c6fc-42ed-ad8c-3abbdc3b9c9e_<BR>> >Content-Type: text/html; charset="iso-8859-1"<BR>> >Content-Transfer-Encoding: quoted-printable<BR>> ><BR>> ><html><BR>> ><head><BR>> ><style><!--<BR>> >.hmmessage P<BR>> >{<BR>> >margin:0px=3B<BR>> >padding:0px<BR>> >}<BR>> >body.hmmessage<BR>> >{<BR>> >font-size: 10pt=3B<BR>> >font-family:Tahoma<BR>> >}<BR>> >--></style><BR>> ></head><BR>> ><body class=3D'hmmessage'><BR>> >It would have been nice for and/or to short circuit in quake like they do i=<BR>> >n C.<br><br><br>Code like:<br><br>if not defined("TARGET")<br> =3B read=<BR>> >only TARGET =3D "I386_FREEBSD"<br>else<br> =3B if not equal(TARGET=2C "=<BR>> >FreeBSD4")<br> =3B =3B =3B readonly TARGET =3D "I386_FREEBSD"<b=<BR>> >r> =3B end<br>end<br><br><br>is better written as:<br>if not defined("T=<BR>> >ARGET") or not equal(TARGET=2C "FreeBSD4")<br> =3B readonly TARGET =3D =<BR>> >"I386_FREEBSD"<br>end<br><br>but that isn't allowed because equal() will co=<BR>> >mplain that TARGET isn't defined.<br><br>It probably can't fixed though=2C =<BR>> >due to e.g.:<br><br>if TRUE or DoSomething()<br> =3B ...<br>end<br><br>=<BR>> ><br>would be broken.<br><br><br>perhaps<br>OR and AND<br>or short_circuit_a=<BR>> >nd<br>or and_shorted<br>or and_short_circuit<br>or and_early_out<br>or and_=<BR>> >early<br>or "&=3B&=3B"<br>or something...<br><br><br>Or I should just=<BR>> > rewrite so much quake in Modula-3...<br><br><br> =3B- Jay<br> <BR>> > =<BR>> > </body><BR>> ></html>=<BR>> ><BR>> >--_203e0ef7-c6fc-42ed-ad8c-3abbdc3b9c9e_--<BR> </body>
</html>