[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lists with nil play nice for Lua 5.2
- From: Mark Hamburg <mhamburg@...>
- Date: Wed, 08 Aug 2007 13:20:30 -0700
on 8/8/07 12:38 PM, Luis Carvalho at firstname.lastname@example.org wrote:
>> Proposal 2
>> Leave tables as they are, but introduce more efficient mechanisms than
>> select for dealing with varargs. Specifically, allow:
>> Proposal 3
>> Tuples to capture sequences containing nil. This can be done with functions
>> but they are crude because they don't support #tuple and tuple[ idx ]. This
>> can be done with userdata but it gets a bit expensive and leaves open the
>> question of why one needs to bail out to userdata to work around language
> I think your proposal 3 would be an implementation of proposal 2 in the sense
> that (functional) tuples could substitute select. Why would you need #tuple
> and tuple[idx]? select does not have them, for instance. With tuples one could
The lack of support there is one of the things that makes select feel crude.
(The invitation to experience n-squared time complexity is a bigger problem
How do we index in Lua? Using . Unless it's a tuple in which case we use
How do we take the length of something in Lua? Using #. Unless it's a tuple
in which case we use ( '#' ). Ugh again.
Of course, both of those ughs apply to the current situation with ... and
select as well.