lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Jun 1, 2015 at 3:31 PM, Coda Highland <chighland@gmail.com> wrote:
On Mon, Jun 1, 2015 at 3:27 PM, Brigham Toskin <brighamtoskin@gmail.com> wrote:
> On Mon, Jun 1, 2015 at 3:07 PM, Roberto Ierusalimschy
> <roberto@inf.puc-rio.br> wrote:
>> Another reason not to do so is that it makes '#' mostly useless for
>> sequences (which are the only reason for its existence).
>
>
> Oh, I don't know that's necessarily true. In the case where t is a sequence
> (with no non-numeric keys), then #t == numentries(t), sure. But they are
> answering fundamentally different questions. It's kinda like saying that
> pairs() is a bad idea because it makes ipairs() redundant for sequences.

Historical note: ipairs() nearly got removed (in favor of "for k in 1,
#t") so this might not be the most useful argument. ;)

I think I've actually written that exact line of code a few times ;)

The real point I suppose is that "it makes something else not useful" is probably only more reason to do it, not an argument against.

--
Brigham Toskin