[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 08:14:44 -0700
On Wed, Apr 9, 2014 at 1:22 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2014-04-09 6:30 GMT+02:00 Coroutines <coroutines@gmail.com>:
>
>> I think I would suggest both an 'in' and 'from' so this would be possible:
>>
>> local a, b, c in some_table
>> local t_concat, t_insert = concat, insert from table
>
> The proposed 'in' is attractive to those whose programming style
> involves locals with the same name as globals (in _ENV) and
> nothing like it can be done in Lua without duplicating the names.
> Though this is a mere sugar, I would probably use it if available.
> The fact that it does not require another keyword also counts
> in its favour.
>
> The proposed 'from', on the other hand, is not too hard to imitate
> in pure Lua.
>
> local t_concat, t_insert = from(table,"concat,insert")
I do like that -- I was suggesting both keywords but it read poorly
even while typing it. The only issue then is that from() would have
to create a temporary table to then unpack() on return -- if this were
done by upstream it could be in C and trustworthy..
On the other hand if it winds up just being used for local
declarations at the head of files then performance isn't a concern and
it could be written in pure Lua just fine.
> I don't think the impact is dramatic enough to justify another keyword.
>
>> I'm thinking about making it of the form: table.import(into, from,
>> options{}, ...)
>
> There is something not too dissimilar in Penlight -- maybe Steve can
> chip in here.
>
I kinda shy away from Penlight because it gives me that "big,
monolithic library" impression -- is it very interdependent or do you
have a lot of granularity to pull in just what you need. I wouldn't
mind installing it -- the distribution size doesn't bother me, it's
keeping what I don't use out of memory that concerns me. There are
places where I have to be pretty light on memory -- my NAS mostly.
- 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