[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: The Undefined Country (was Re: Quest: real world "Lua array with holes" usage)
- From: Gregg Reynolds <dev@...>
- Date: Sun, 24 Jul 2016 15:45:13 -0500
On Jul 24, 2016 3:27 PM, "Sean Conner" <sean@conman.org> wrote:
>
> It was thus said that the Great Roberto Ierusalimschy once stated:
> > > 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).
>
> _javascript_ has an "undefined" state, in addition to a "null" state.
> Perhaps Lua should have one as well. To me, "nil" means "the absence of a
> value" while "undef" means "this never had a value to begin with".
>
howsabout NaV (Not a Value) by analogy to NaN? "Undefined value" seems kind of an oxymoron to me. NaV could mean sth like "its a value, kinda sorta, but one that cannot be represented, not even by nil".