comp.lang.ada
 help / color / mirror / Atom feed
From: marciant@earthlink.net
Subject: Re: Is this a bug in my code or the compiler?
Date: Fri, 12 Jun 2015 11:43:46 -0700 (PDT)
Date: 2015-06-12T11:43:46-07:00	[thread overview]
Message-ID: <5e52d05c-62de-439f-8e2f-750ce77e4e47@googlegroups.com> (raw)
In-Reply-To: <xbgrg1rqjz4n$.141vkthh9qg38$.dlg@40tude.net>

On Friday, June 12, 2015 at 2:11:33 PM UTC-4, Dmitry A. Kazakov wrote:
> 
> The name suggests that short-cut logical operations were considered as a
> syntax sugar to save keystrokes - a replacement for nested IFs. Quickly
> enough it was discovered that in some contexts you cannot have IFs (e.g. in
> barriers) and that people disliked nested IFs anyway.
> 

(nit-picker alert! ;-)

They are called short-circuit not short-cut, short in that normally all parts of a boolean expression are evaluated (even those that would cause an exception with elements some values).  That was to improve testability: you are normally sure that some part of an expression isn't actually never evaluated with some given test input.  It also can minimize execution time variance.

I think that the canonical example is something like "if x/=0 and then y/x=n then ..." but I see what you mean by less nested if's.   But avoiding the nested if's was less about minimizing typing and more about increasing readability.


  reply	other threads:[~2015-06-12 18:43 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-12 15:56 Is this a bug in my code or the compiler? David Botton
2015-06-12 16:15 ` Dmitry A. Kazakov
2015-06-12 17:25   ` G.B.
2015-06-12 18:00     ` Dmitry A. Kazakov
2015-06-13 10:04       ` Georg Bauhaus
2015-06-13 10:32         ` Dmitry A. Kazakov
2015-06-15 10:37           ` G.B.
2015-06-15 12:27             ` Dmitry A. Kazakov
2015-06-15 12:31               ` Simon Wright
2015-06-15 13:16                 ` Dmitry A. Kazakov
2015-06-15 14:56                   ` Simon Wright
2015-06-15 15:03                     ` G.B.
2015-06-13 19:42       ` Brad Moore
2015-06-12 17:53   ` David Botton
2015-06-12 18:11     ` Dmitry A. Kazakov
2015-06-12 18:43       ` marciant [this message]
2015-06-12 19:37     ` Jeffrey R. Carter
2015-06-12 19:55       ` Simon Wright
2015-06-12 20:40         ` Jeffrey R. Carter
2015-06-12 21:40           ` Simon Wright
2015-06-12 19:39     ` jan.de.kruyf
2015-06-12 22:10       ` David Botton
2015-06-13  0:19         ` Dennis Lee Bieber
2015-06-13 14:21         ` jan.de.kruyf
2015-06-14  3:13     ` Randy Brukardt
2015-06-14  3:21     ` Randy Brukardt
2015-06-12 16:48 ` Jeffrey R. Carter
2015-06-13 13:33 ` Jacob Sparre Andersen
2015-06-13 15:15   ` J-P. Rosen
2015-06-13 16:43     ` Jacob Sparre Andersen
2015-06-13 20:50       ` J-P. Rosen
2015-06-14  3:18   ` Randy Brukardt
2015-06-14  3:10 ` Randy Brukardt
2015-06-14  9:02   ` Jacob Sparre Andersen
2015-06-14 12:48     ` brbarkstrom
2015-06-15 22:06     ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox