Re: and then... (a curiosity)
- From: Samuel Tardieu <sam@xxxxxxxxxxx>
- Date: Fri, 29 Aug 2008 23:47:25 +0200
I wondered why in Ada the "shortcut and" is "and then", while the
simple "and" has not a shortcut behaviour. My curiosity stems from
the fact that I am not able to envision any situation where the "non
shortcut" version would preferable, but I immagine that there was
some reason for this choice. Do anyone have any hint?
Sometimes, you want to ensure that both sides of the boolean operator
have been evaluated. Here is an example:
-- Send the message to the log and return True if it
-- has been logged at least at one place succesfully.
function Log (Message : String) return Boolean is
begin
return Log_To_Network (Message) or Log_To_Disk (Message);
end Log;
Sam
--
Samuel Tardieu -- sam@xxxxxxxxxxx -- http://www.rfc1149.net/
.
- Follow-Ups:
- Re: and then... (a curiosity)
- From: Maciej Sobczak
- Re: and then... (a curiosity)
- References:
- and then... (a curiosity)
- From: mockturtle
- and then... (a curiosity)
- Prev by Date: Re: Possible compiler bug with this simple program
- Next by Date: Re: and then... (a curiosity)
- Previous by thread: and then... (a curiosity)
- Next by thread: Re: and then... (a curiosity)
- Index(es):