lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, Dec 19, 2015 at 11:41 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2015-12-20 6:19 GMT+02:00 Egor Skriptunoff <egor.skriptunoff@gmail.com>:
>> On Fri, Dec 18, 2015 at 3:19 PM, Rena <hyperhacker@gmail.com> wrote:
>>>
>>> The exception is when it's ambiguous:
>>> x = f
>>> (a or b):c()
>>> That expression could be interpreted as two statements or one (remove the
>>> line break and see). In that case Lua is kind enough to make an exception to
>>> the "ignore whitespace" rule and raise an error
>>
>> Really?
>> I've always thought that Lua treats this chunk as absolutely correct way to
>> write the following code:
>> x = (f(a or b)):c()
>
> It depends on the Lua version. It changed between Lua 5.1 and Lua 5.2,
> A linebreak between a function and its arguments used to be illegal,
> and an error message was issued. As from 5.2, no matter what whitespace
> sits between the two parts (several blank lines if you like), x = (f(a
> or b)):c()
> is performed.
>

Let me just inject the words "Javascript semicolon insertion" into
this discussion and run away before people start having flashback
episodes. ;)

/s/ Adam