[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Quest: real world "Lua array with holes" usage
- From: Roberto Ierusalimschy <roberto@...>
- Date: Sun, 24 Jul 2016 15:34:43 -0300
> I agree with Jorge. Also, sometimes when returning multiple things,
> one of these things might be nil, so it's not only the error situation
> that produces a nil value upon return, although it is of course the
> most common. So, unfortunately just changing the policy from
> nil-on-error to false-on-error still wouldn't allow us to just forget
> about table.pack().
Of course any function can return nil among its returns, but maybe
that might be considered a bad practice.
My point is that, if nil is representing the absence of a value, it
is weird not to have a third value but to have a fourth one. If nil
is representing something else, probably it shouldn't be (as pointed
out by others already).
("is weird" ~ "it might be considered weird")
-- Roberto