lua-users home
lua-l archive

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




On Mon, Oct 7, 2019 at 3:12 PM Egor Skriptunoff <egor.skriptunoff@gmail.com> wrote:
On Mon, Oct 7, 2019 at 10:48 PM Petri Häkkinen wrote:

> So, the motivation for the change is to move our minds from the
> concept that errors return (nil,msg) to the concept that errors return
> (falsy,msg). Maybe one day in the distant future we might change
> that falsy to false instead of nil.

I’m sorry but I fail to see any improvement here. How does false signal an error any better than nil?


Probably, Roberto wants to guarantee that an array  {any_standard_function()}  will be a sequence.
Hence such array will become traversable with ipairs.
This might reduce nilophoby in Lua :-)

Okay, that makes some sense to me, but `fail` is not a keyword and I can assign a value to `fail`. Is fail just a concept?

Should I start explicitly returning false instead of just letting values be nil? Returning nil as the first return value IS weird but it's a pattern I have grown fond of.

Russ