Re: Parenthesized Target Notation
Ian Elliott <[email protected]>
| Newsgroups | gmane.comp.lang.eiffel.smalleiffel |
|---|---|
| Message-ID | <[email protected]> |
Valéry Croizier wrote:
> Dominique Colnet a écrit :
>
>> Valéry Croizier wrote:
>>
>>> Ian Elliott a écrit :
>>>
>>>> An example that does illustrate a necessary, i.e. not optional,
>>>> semicolon is:
>>>>
>>>> do
>>>> x := y;
>>>> (p + q).r
>>>>
>>> This one is optional : SE will compile the code with or without
>>> semicolon.
>>> Do other compilers behave differently ???
>>
>>
>> I presume that your statement is true only if `y´ is a local or an
>> argument.
>> When `y´ is not a local (or argument) variable, I think that the
>> semicolon is mandatory.
>
>
> You presume well :(
> If I remove the semicolon in the code below, I get :
>
> ****** Fatal Error: The feature called has no formal argument
> while the actual argument list has 1 argument.
>
> But there is no error if x and y are locals.
Instead the compiler (SmartEiffel 1.1 at least) issues a warning, which you can
see if the -no_warning switch is not set, telling you that it has added the
missing semicolon for you:
****** Warning: Added ";"
If you have included the missing semicolon yourself you get no error report and
no warning.
The OT Visual Eiffel compiler issues an error report and, as reported by Peter
Gummer, so too does the ESI EiffelStudio compiler whether the case is the
special one identified by SmartEiffel or not.
But for this instance:
do
create x -- optional semicolon goes here --
(p + q).r
where the semicolon is optional, the SmartEiffel compiler warns you that it has
added a semicolon when in fact you do not need one. The OT Visual Eiffel and ESI
EiffelStudio compilers compile successfully and issue no warnings or errors. It
looks as if the SmartEiffel team believed, like the ECMA committee, that the
simple view of the ";" "(" pairing was the only one.
So no one appears to like the (|..|) parentheses (they remind me a little of
hamburger buns) that the ECMA Eiffel standard specifies but I cannot help
feeling that the attempt to remove special cases from the language by reducing a
rule from "A semicolon is optional, except..." to "A semicolon is optional." is
a laudable aim: special cases complicate things - just look at the number of
postings the pesky little ";" has generated.
- Ian Elliott