[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Ternary operator patch
- From: mauro iazzi <mauro.iazzi@...>
- Date: Wed, 15 Sep 2010 12:25:45 +0200
On 15 September 2010 11:35, David Kastrup <dak@gnu.org> wrote:
> Huh? What makes you think that? Aren't you confusing "\n" with ";"?
If you try it you can test that they behave differently.
On 15 September 2010 12:08, Fabien <fleutot+lua@gmail.com> wrote:
> The former is three nested calls; the latter is two calls of depth 1.
I think that the former is actually three subsequent calls. The call
stack should always be of depth 1. Am I wrong?
And in non interactive mode the second syntax gives an error to warn
users that the syntax is ambiguous. I believe this is the sanest way
to address the problem.
In interactive mode, short of delaying all function calls, the
previous input is already consumed. You can recover the correct
behaviour by putting everything in a do ... end block:
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> function f(x) print('f', x) return f end
> do
>> f(1)(f)(3)
>> end
f 1
f function: 0x12963a0
f 3
> do
>> f(1)
>> (f)(3)
stdin:3: ambiguous syntax (function call x new statement) near '('
>
Regards,
mauro
- References:
- Re: Ternary operator patch, Henk Boom
- Re: Ternary operator patch, steve donovan
- Re: Ternary operator patch, Geoff Leyland
- Re: Ternary operator patch, steve donovan
- Re: Ternary operator patch, Miles Bader
- Re: Ternary operator patch, David Kastrup
- Re: Ternary operator patch, Miles Bader
- Re: Ternary operator patch, David Kastrup
- Re: Ternary operator patch, Jonathan Castello
- Re: Ternary operator patch, Roberto Ierusalimschy
- Re: Ternary operator patch, Enrico Tassi
- Re: Ternary operator patch, Doug Rogers
- Re: Ternary operator patch, Fabien
- Re: Ternary operator patch, David Kastrup
- Re: Ternary operator patch, Fabien