Discussion:
Associativity of the equality operator
(too old to reply)
August Karlstrom
2005-05-09 20:07:55 UTC
Permalink
Hello all,

I'm a bit confused by the equality operator in Oberon-2. Neither OOC nor
XDS will accept an expression of the form `x = y = b', where x and y
have the same (arbitrary) type and b is a boolean. I argue that it is
valid since equality associates from left to right; `x = y' evaluates to
a boolean which is then compared to the boolean b. Am I missing
something here? If it's valid I can see the strange implications---for
instance `b1 = b2 = b3' would be false if b1, b2 and b3 are all false
(all have the same value). Comments?

Regards,
August
Chris Burrows
2005-05-10 00:14:17 UTC
Permalink
Post by August Karlstrom
I'm a bit confused by the equality operator in Oberon-2. Neither OOC nor
XDS will accept an expression of the form `x = y = b', where x and y have
the same (arbitrary) type and b is a boolean.
x = y = b is not a valid expression in Oberon-2. If you check the EBNF
syntax definition of Oberon-2 you will find:

Expression = SimpleExpression [Relation SimpleExpression]

x = y (or alternatively y = b) is not a SimpleExpression.

I assume that you intended to say something like (x = y) & (y = b).

--
Chris Burrows
CFB Software
http://www.cfbsoftware.com/gpcp
Chris Burrows
2005-05-10 00:20:32 UTC
Permalink
Post by Chris Burrows
Post by August Karlstrom
I'm a bit confused by the equality operator in Oberon-2. Neither OOC nor
XDS will accept an expression of the form `x = y = b', where x and y have
the same (arbitrary) type and b is a boolean.
x = y = b is not a valid expression in Oberon-2. If you check the EBNF
Expression = SimpleExpression [Relation SimpleExpression]
x = y (or alternatively y = b) is not a SimpleExpression.
I assume that you intended to say something like (x = y) & (y = b).
Oops. I just noticed you said x and y are arbitrary types. In that case you
probably need

(x = y) & b

--
Chris Burrows
CFB Software
http://www.cfbsoftware.com/gpcp
August Karlstrom
2005-05-10 01:55:04 UTC
Permalink
Post by Chris Burrows
Post by Chris Burrows
x = y = b is not a valid expression in Oberon-2. If you check the EBNF
Expression = SimpleExpression [Relation SimpleExpression]
x = y (or alternatively y = b) is not a SimpleExpression.
Yes, of course. I forgot to study the grammar, I only read section 8.2
of TPLO, thanks. (As I mentioned, allowing `x = y = b' would be absurd.)
Post by Chris Burrows
Post by Chris Burrows
I assume that you intended to say something like (x = y) & (y = b).
Oops. I just noticed you said x and y are arbitrary types. In that case
you probably need
(x = y) & b
This was just something I noticed, I'm not trying to solve any
particular problem.

-- August


Whether the low activity in this newsgroup depends on the excellent
design of Oberon-2 (and its derivatives) or its lack of spread I can't
say. Probably both.
Chris Burrows
2005-05-10 02:16:44 UTC
Permalink
Whether the low activity in this newsgroup depends on the excellent design
of Oberon-2 (and its derivatives) or its lack of spread I can't say.
Probably both.
There are a number of more specialised Oberon-related news groups and
mailing lists. These include:

1. The ETH Oberon Mailing List:

https://www.mail.inf.ethz.ch/lists/listinfo/oberon

2. The BlackBox Component Pascal Mailing list:

http://www.oberon.ch/blackbox.html

3. Yahoo Groups - Gardens Point Component Pascal

http://groups.yahoo.com/group/GPCP/

--
Chris Burrows
CFB Software
http://www.cfbsoftware.com/gpcp

Loading...