Re: Parenthesized Target Notation (was: Partial retraction)

Peter Gummer <[email protected]>
Newsgroups gmane.comp.lang.eiffel.smalleiffel
Message-ID <[email protected]>
On 29/04/2005, at 11:41 AM, Richard A. O'Keefe wrote:

> 	(n + 1).to_real_64
>     is now illegal.
>     Instead special target brackets (|...|) must be used, e.g.,
> 	(| n + 1 |).to_real_64
>
>     I cannot think what problem (||) might be intended to fix;

Well according to ETL3, pages 545-546:

"Why indeed not just use plain parentheses? The reason is syntactical. 
Eiffel always treats the semicolon separator as redundant, without 
making any difference between spaces, newlines and other break 
characters. If a parenthesized expression were permitted as target of a 
call, the assertion
  require
  h
  (a + b).g
would include two clauses. But syntactically the beginning could be 
parsed as h (a + b), denoting the application of a function h to an 
argument a + b, even though the remainder, .g, doesn’t have a proper 
syntactical interpretation. This syntactical problem is typical of the 
confusion engendered by the dual use of parentheses, coming from 
mathematical conventions: as a grouping mechanism, as in (a + b); and 
as a notation for function application, as in f (c). The special 
symbols (| ...|) avoid any such ambiguity."

That surprises me. I would have thought that	the newline would make it 
obvious to the compiler, because I always thought that Eiffel 
interpreted the newline as a separator. It looks like ECMA is trying to 
ensure that semicolons are always optional, and this ugly (||) notation 
is a consequence.

Thanks for for compiling that great list of breaking changes, Richard!

- Peter Gummer
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.