[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: 'in' keyword today (was Re: mathlib)
- From: Coroutines <coroutines@...>
- Date: Wed, 9 Apr 2014 21:50:22 -0700
On Wed, Apr 9, 2014 at 9:25 PM, Sven Olsen <sven2718@gmail.com> wrote:
>> The expression: a, b, c in some_table -- which can appear in any
>> expression
>
>
> Making this work would get tricky. Table constructors also allow expression
> lists, so how should we interpret:
> { a, f(0), b in t } ?
item1, item2, item3, ... in some_table
^ this would essentially generate a vararg, and would hold to the same
rules of how varargs are transformed in an expression? So because it
appears last in that construction the full vararg would "slide in" --
if it appeared first only the first item would be moved in, the others
would be shaved off -- a & f(0) would follow after b
> Peter's power patch allows 'in' to be used in any assignment. That can be
> useful in certain situations; like setting up a new environment to contain a
> subset of _G:
>
> local env={}
> env.ipairs, env.pairs, env.print in _G
Hmm, I would want to write that as:
local env = { ipairs, pairs, print = ipairs, pairs, print in _G }
I wish multiple assignment were possible in table constructions :( I
shall have to take a look at Peter's patch.
After thinking about this for a while I think it would be okay if
object literals were also allowed instead of only valid identfiers:
1, 2, 3 in { 'a', 'b', 'c' } --> return 'a', b', 'c'
- References:
- Re: mathlib, Roberto Ierusalimschy
- Re: mathlib, Luiz Henrique de Figueiredo
- Re: mathlib, Roberto Ierusalimschy
- Re: mathlib, Christopher Berardi
- Re: mathlib, steve donovan
- Re: mathlib, Christopher Berardi
- Re: mathlib, Sean Conner
- Re: mathlib, Coroutines
- Re: mathlib, Sean Conner
- Re: mathlib, Christopher Berardi
- Re: mathlib, steve donovan
- Re: mathlib, Coroutines
- Re: mathlib, steve donovan
- Re: mathlib, Coroutines
- 'in' keyword today (was Re: mathlib), Petite Abeille
- Re: 'in' keyword today (was Re: mathlib), Rena
- Re: 'in' keyword today (was Re: mathlib), Philipp Janda
- Re: 'in' keyword today (was Re: mathlib), Coroutines
- Re: 'in' keyword today (was Re: mathlib), Dirk Laurie
- Re: 'in' keyword today (was Re: mathlib), steve donovan
- Re: 'in' keyword today (was Re: mathlib), steve donovan
- Re: 'in' keyword today (was Re: mathlib), steve donovan
- Re: 'in' keyword today (was Re: mathlib), Petite Abeille
- Re: 'in' keyword today (was Re: mathlib), steve donovan
- Re: 'in' keyword today (was Re: mathlib), Petite Abeille
- Re: 'in' keyword today (was Re: mathlib), Coroutines
- Re: 'in' keyword today (was Re: mathlib), Petite Abeille
- Re: 'in' keyword today (was Re: mathlib), Coroutines
- Re: 'in' keyword today (was Re: mathlib), Sven Olsen