[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Ternary operator patch
- From: David Kastrup <dak@...>
- Date: Wed, 15 Sep 2010 12:54:02 +0200
Fabien <fleutot+lua@gmail.com> writes:
> On Wed, Sep 15, 2010 at 11:35 AM, David Kastrup <dak@gnu.org> wrote:
>
> Fabien <fleutot+lua@gmail.com> writes:
>
> > "foo(bar)(gnu)(gnat)" is understood differently from "foo(bar)\
> n(gnu)(gnat)".
>
> Huh? What makes you think that? Aren't you confusing "\n" with
> ";"?\
>
>
> $ lua
> Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
>> x=0
>> function f() print ("call #"..x); x=x+1; return f end
>> foo, bar, gnu, gnat = f,f,f,f
>> foo(bar)(gnu)(gnat)
> call #0
> call #1
> call #2
So you are confusing the interpreter with the language. Look here:
dak@lola:~$ lua
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> local x=1
> print(x)
nil
Does this tell us that in Lua local assignments end at a newline? Of
course not. It tells us something about how the interpreter divides its
input into separate units.
If you want to make a statement about the function of \n in the Lua
language, please write it into a complete file you feed into Lua (and
obviously not via input redirection).
--
David Kastrup
- 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