Eiffel syntax and the ';'
alan lamer <[email protected]> Tue, 9 Aug 2005 17:46:01 +0200 (CEST)
| Newsgroups | gmane.comp.lang.eiffel.smalleiffel |
|---|---|
| Message-ID | <[email protected]> |
hi,
i was wondering about the eiffel syntax, that
sometimes appears to be confused to me, especially
with the use of the ';' character. When is this char
really required ?
Indeed, using a syntax that don't avoid ambiguities
look strange to me.
following examples are compiled using SE 1.1
---------------------------
class ROOT
creation
make, make_empty
feature
make is
local
x: like Current
y: like Current
do
create x.make_empty
create y.make_empty
x.f
(x+x).f
g
(x+x)
end
feature {ROOT}
make_empty is
do
end
f is
do
end
g (other: like Current) is
do
end
infix "+" (other: like Current): like Current is
do
create Result.make_empty
end
end
---------------------------
while this class looks fine to me the compiler doesn't
agree with me at all:
****** Fatal Error: Feature found is a procedure.
Line 24 column 6 in ROOT
(/net/lsun258/reco/name7420/e/test/ROOT.e):
f is
^
Line 13 column 18 in ROOT
(/net/lsun258/reco/name7420/e/test/ROOT.e):
x.f
^
------
File "root.make" not found. Error(s) during
`compile_to_c'.
Of course, if i either :
replace line 13 with x.f;
or
replace line 14 with y:=x.x <CR> y.f
then it works perfectly
I know that from the parser point of view there might
be an ambiguity (to allow the call of the g-like
feature in the example) but, as said previously, why
the hell using a syntax that leads to such situations.
Any comment on this ?
___________________________________________________________________________
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez cette version sur http://fr.messenger.yahoo.com