Welcome, Guest
Username: Password:
  • Page:
  • 1

TOPIC:

Strictness of Boolean operators 16 Aug 2002 13:38 #6199

Hi!

Does the standard specify whether or not the Boolean operators 'and' and 'or' are strict in both arguments? I think not. What do you think it should be? I would prefer no-strict semantics in the second argument, so that:

true or bottom()

and

false and bottom()

would evaluate to true or false respectively without calling the function bottom().

I am willing to write the CR, but we should agree on the intended semantics first.

Best regards

Stephan

--
Stephan Tobies Research Engineer, Nokia Research Center
Mobile Networks Lab, Protocol Engineering Group
E-Mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
Work Phone: +49-234-9842262
Fax: +49-234-9843491
Address: NRC Bochum, Meesmannstr. 103, 44807 Bochum, Germany

Please Log in to join the conversation.

Strictness of Boolean operators 16 Aug 2002 13:58 #6200

If there is any doubt, then my vote is also for short-circuit rather than
full evaluation. BUT, I would also want to insist on left to right
evaluation. If I have a reason for writing

Func() and BoolExpression

then I want to know for sure that some translator A isn't going to be clever
and optimise this into right to left evaluation, whereas some translator B
will evaluate left to right as I intended.

If the community splits on the issue, then keep both sides happy by adopting
the Ada solution, where "and" and "or" imply full evaluation, whereas "and
then" and "or else" imply short-circuit evaluation.

Regards

Derek

Derek C Lazenby
Anite
127 Fleet Road
Fleet
Hampshire
GU51 3QN
Tel : +44 1252 775200
Fax: +44 1252 775299
Anite Telecoms Ltd, Registered in England No. 1721900 Registered
Office: 100 Longwater Avenue, GreenPark, Reading, Berkshire RG2 6GP,
United Kingdom


Original Message
From: Stephen TOBIES [This email address is being protected from spambots. You need JavaScript enabled to view it.]
Sent: 16 August 2002 14:39
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Strictness of Boolean operators


Hi!

Does the standard specify whether or not the Boolean operators 'and' and
'or' are strict in both arguments? I think not. What do you think it should
be? I would prefer no-strict semantics in the second argument, so that:

true or bottom()

and

false and bottom()

would evaluate to true or false respectively without calling the function
bottom().

I am willing to write the CR, but we should agree on the intended semantics
first.

Best regards

Stephan

--
Stephan Tobies Research Engineer, Nokia Research Center
Mobile Networks Lab, Protocol Engineering Group
E-Mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
Work Phone: +49-234-9842262
Fax: +49-234-9843491
Address: NRC Bochum, Meesmannstr. 103, 44807 Bochum, Germany

Please Log in to join the conversation.

Strictness of Boolean operators 16 Aug 2002 14:15 #6201

Hi Stephan!

I vote in favor of your "no-strict"-semantics since the result is known
after evaluating the first argument. From a testing perspective you would
then always put the most likely argument first in your statement and hence
save a little time when executing... (Not much in most cases though...;-)
but time is money...)

/Stefan

Original Message
From: Stephen TOBIES [This email address is being protected from spambots. You need JavaScript enabled to view it.]
Sent: den 16 augusti 2002 15:39
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Strictness of Boolean operators


Hi!

Does the standard specify whether or not the Boolean operators 'and' and
'or' are strict in both arguments? I think not. What do you think it should
be? I would prefer no-strict semantics in the second argument, so that:

true or bottom()

and

false and bottom()

would evaluate to true or false respectively without calling the function
bottom().

I am willing to write the CR, but we should agree on the intended semantics
first.

Best regards

Stephan

--
Stephan Tobies Research Engineer, Nokia Research Center
Mobile Networks Lab, Protocol Engineering Group
E-Mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
Work Phone: +49-234-9842262
Fax: +49-234-9843491
Address: NRC Bochum, Meesmannstr. 103, 44807 Bochum, Germany

Please Log in to join the conversation.

Strictness of Boolean operators 16 Aug 2002 16:14 #6202

Hi Stephan,

short-circuit semantics is fine, and *probably* what would be expected
by a user. A CR would also be fine because the user would also try to
find this out by taking a look into the standard.

Best regards,

Theo

Stephen TOBIES schrieb:
> Hi!
>
> Does the standard specify whether or not the Boolean operators 'and' and 'or'
are strict in both arguments? I think not. What do you think it should be? I
would prefer no-strict semantics in the second argument, so that:
>
> true or bottom()
>
> and
>
> false and bottom()
>
> would evaluate to true or false respectively without calling the function
bottom().
>
> I am willing to write the CR, but we should agree on the intended semantics
first.
>
> Best regards
>
> Stephan
>


--
Theofanis Vassiliou-Gioles Testing Technologies IST
Oranienburger Str. 65 The TTCN-3 Company
10117 Berlin, Germany phone +49 30 726 19 19 0
This email address is being protected from spambots. You need JavaScript enabled to view it. DDI +49 30 726 19 19 12
www.testingtech.de fax +49 30 726 19 19 20

Please Log in to join the conversation.

Strictness of Boolean operators 19 Aug 2002 21:22 #6204

Lazenby, Derek wrote:

> If the community splits on the issue, then keep both sides happy by adopting
> the Ada solution, where "and" and "or" imply full evaluation, whereas "and
> then" and "or else" imply short-circuit evaluation.

Lazy evaluation is the way to go. Nearly every other modern language
implements lazy semantics for boolean operators.

I am opposed to "and then" and "or else". They will just clutter up the
language more, and there is no advantage in having them. Lazy evaluation
is what is wanted nearly all the time. If evaluation of a function is
required for something like:

... foo() and bar() ...

it can easily be acheived:

baz := bar()
... foo() and baz ...


Cheers,
--
Carl Cerecke - Software Designer
Da Vinci Communications Ltd
Christchurch - New Zealand
TEL : +64 3 3838311
FAX : +64 3 3838310
e-mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
www : www.davinci-communications.com

Please Log in to join the conversation.

Strictness of Boolean operators 20 Aug 2002 08:14 #6205

I wasn't saying I wanted them, I was just giving an opt out in case we all
disagreed. But as we all seem to agree anyway, it's not an issue.

Regards

Derek

Derek C Lazenby
Anite
127 Fleet Road
Fleet
Hampshire
GU51 3QN
Tel : +44 1252 775200
Fax: +44 1252 775299
Anite Telecoms Ltd, Registered in England No. 1721900 Registered
Office: 100 Longwater Avenue, GreenPark, Reading, Berkshire RG2 6GP,
United Kingdom


Original Message
From: Carl Cerecke [This email address is being protected from spambots. You need JavaScript enabled to view it.]
Sent: 19 August 2002 22:22
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Strictness of Boolean operators


Lazenby, Derek wrote:

> If the community splits on the issue, then keep both sides happy by
adopting
> the Ada solution, where "and" and "or" imply full evaluation, whereas "and
> then" and "or else" imply short-circuit evaluation.

Lazy evaluation is the way to go. Nearly every other modern language
implements lazy semantics for boolean operators.

I am opposed to "and then" and "or else". They will just clutter up the
language more, and there is no advantage in having them. Lazy evaluation
is what is wanted nearly all the time. If evaluation of a function is
required for something like:

... foo() and bar() ...

it can easily be acheived:

baz := bar()
... foo() and baz ...


Cheers,
--
Carl Cerecke - Software Designer
Da Vinci Communications Ltd
Christchurch - New Zealand
TEL : +64 3 3838311
FAX : +64 3 3838310
e-mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
www : www.davinci-communications.com

Please Log in to join the conversation.

  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin