Discussion:
reference vs. REFERENCE
Daniel F Moisset
2005-07-04 23:53:01 UTC
Permalink
Hi,
I've been implementing the REFERENCE class until I crashed against a
problem: "reference" is also a reserved word in 1.x. So, you should be
able to write:

a: reference INTEGER
-- This should emit a warning about 2.x compatibility
a: REFERENCE [INTEGER]
-- This refers to generic class REFERENCE in base cluster.

The implementation for this is gonna be ugly, one way or another. The
options I'm considering are:

* Make the distinction between reserved word/identifier based on
capitalization. This breaks in a special case the case-insensitive
eiffel tradition, and might break strangely capitalized 1.1 code
(however, I can't remember ever seeing Eiffel code with non-capitalized
class names).

* Modify slightly the parser grammar:

Type ::= ...other cases...
| "reference" Class_type
| "reference" "[" Type "]"

where the second one has the same semantics as REFERENCE[the other
type].

Do you have any preference over any of these? I have a slight
inclination towards the second one. Other cleaner ideas would be nice
too.

Cheers,
D.
Peter Gummer
2005-07-05 00:19:17 UTC
Permalink
Post by Daniel F Moisset
a: reference INTEGER
-- This should emit a warning about 2.x compatibility
a: REFERENCE [INTEGER]
-- This refers to generic class REFERENCE in base cluster.
One option would be to reject the reference keyword as an error. It wasn't
part of ETL2 and it isn't in ETL3/ECMA either. Nor in SE 2.x, if I remember
correctly.

In deciding whether to do this I guess you'd have to evaluate how much code
out there uses the reference keyword. If there aren't many occurrences, then
it will be easy for everyone to update it.

- Peter Gummer
Eric Bezault
2005-07-05 08:33:02 UTC
Permalink
Post by Peter Gummer
Post by Daniel F Moisset
a: reference INTEGER
-- This should emit a warning about 2.x compatibility
a: REFERENCE [INTEGER]
-- This refers to generic class REFERENCE in base cluster.
One option would be to reject the reference keyword as an error. It
wasn't part of ETL2 and it isn't in ETL3/ECMA either. Nor in SE 2.x, if
I remember correctly.
In deciding whether to do this I guess you'd have to evaluate how much
code out there uses the reference keyword. If there aren't many
occurrences, then it will be easy for everyone to update it.
If I understood correctly, the spirit of SE 1.2 is to break
no existing code (in particular code written for SE 1.1). So
you cannot reject the 'reference' keyword just like that.
(FYI, Gobo does not use the 'reference' keyword.)

The second solution (modify the grammar of Type) is by far
the best.
--
Eric Bezault
mailto:ericb-D6Qt/9opevxWk0Htik3J/***@public.gmane.org
http://www.gobosoft.com
Daniel F Moisset
2005-07-05 23:56:35 UTC
Permalink
Post by Peter Gummer
Post by Daniel F Moisset
a: reference INTEGER
-- This should emit a warning about 2.x compatibility
a: REFERENCE [INTEGER]
-- This refers to generic class REFERENCE in base cluster.
One option would be to reject the reference keyword as an error. It wasn't
part of ETL2 and it isn't in ETL3/ECMA either. Nor in SE 2.x, if I remember
correctly.
As Eric said, I'm trying to be 100% SE1.1 compatible, so rejecting
reference as keyword is ruled out.
Post by Peter Gummer
In deciding whether to do this I guess you'd have to evaluate how much code
out there uses the reference keyword. If there aren't many occurrences, then
it will be easy for everyone to update it.
Perhaps, but if you start going that path, you make a lot of changes
where "it would be easily for everyone to update", and end up with a
wildly different language. So let's be gentle for 1.2 (2.x is taking the
job of being the bad guy and introduce the big changes).

Besides, I know I have written software using "reference", so I have a
small bias :)

I'll go towards changing the grammar of the "Type" construct.

Thanks for your opinions,

Daniel
Post by Peter Gummer
- Peter Gummer
Aleksa Todorovic
2005-07-05 08:10:51 UTC
Permalink
Post by Daniel F Moisset
Hi,
I've been implementing the REFERENCE class until I crashed against a
problem: "reference" is also a reserved word in 1.x. So, you should be
a: reference INTEGER
-- This should emit a warning about 2.x compatibility
a: REFERENCE [INTEGER]
-- This refers to generic class REFERENCE in base cluster.
Type ::= ...other cases...
| "reference" Class_type
| "reference" "[" Type "]"
where the second one has the same semantics as REFERENCE[the other
type].
Considering what you are trying to do (as much compatibility as
possible to as much different Eiffel code as possible), I feel this
case as a better solution.
Loading...