[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Ambiguous syntax
- From: Sven Olsen <sven2718@...>
- Date: Thu, 13 Dec 2012 06:54:21 -0800
There are several valid situations where you may want a newline between the function and the parameters.
Certainly, but 5.1's ambiguous syntax check rarely got in the way of this. It was safe to write:
object.member_function( some, collection, of, parameters)
The case that triggered a false positive was:
object.member_function
(some, collection, of, parameters)
I haven't often seen the second pattern used in the wild -- though for programmers who prefer it, I'm sure 5.1's ambiguous syntax error would have been an annoyance.
The need to scatter semicolons through otherwise very clean Lua code is also an annoyance though. While it was certainly less elegant, I think 5.1's handling had real practical advantages over 5.2's -- if you forget to about the newline handling in 5.1, you'll get a parse error, but if you forget to add a semicolon in 5.2, you'll get a runtime bug. Parse errors tend to be far easier to detect and fix.
-Sven