Re: and then... (a curiosity)



Maciej Sobczak wrote:
On 29 Sie, 23:47, Samuel Tardieu <s...@xxxxxxxxxxx> wrote:

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;

This is actually a bad example. It might use "or else" and still
retain the semantics as described in the comment above.

"At least one" of the logs should, I guess, mean to try both.
I.e., the Log subprogram is not about its return value alone.
"Or" achieves all of that (the semantics).

"Or else" might also establish a strict preference for the
network log. "Or" should not.
.