[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Ambiguous syntax
 
- From: GrayFace <sergroj@...>
 
- Date: Thu, 20 Dec 2012 16:52:23 +0700
 
On 12.12.2012 22:17, Roberto Ierusalimschy wrote:
As shown here, the check was confusing anyway. There are several valid 
situations where you may want a newline between the function and the 
parameters. Moreover, in 5.2, you can always add a colon before the 
statement to avoid ambiguity: ;(g or h)() -- always valid in 5.2, not 
in 5.1 -- Roberto 
The colon won't really help. To add a colon before the next statement 
one must know that he stepped into this ambiguity, for which... he would 
need the ambiguity check in parser :) Writing colons before statements 
is way too unnatural, no-one would think of this beforehand.
I could understand if that code was resolved as 2 statements, at least 
in my coding style that's the case, but resolving it as 1 statement is 
just wrong!
The ambiguity error came up a few times in my code, but it never caused 
any problems, it was always right.
I understand that rarely-used coding style of placing parenthesis on a 
new line is effectively made invalid by the check, but that isn't a big 
problem. It's not harder to learn to place parenthesis on the 1st line 
than for example to learn to write  if..then..end  instead of  
if..then..begin..end  or  if(..){..}.
--
Best regards,
Sergey Rozhenko                 mailto:sergroj@mail.ru