lua-users home
lua-l archive

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


On Wed, Oct 2, 2019 at 9:54 PM Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
>
> Lua 5.4.0 (beta) is now available for testing at
>         http://www.lua.org/work/lua-5.4.0-beta-rc1.tar.gz
>
(...)
> All feedback welcome. Thanks.
> --lhf
>
I am surprised with the 'fail' notation thing.  Was I living under a
rock and did I miss some discussion here? :-)

returning (nil, error_message) looks like a well established idiom,
and I understand that Lua 5.4 is going to change that.  I have also
read in section "6  - The Standard Libraries" that  "Currently, fail
is equal to nil, but that may change in future versions."

Also "The recommendation is to test the success of these functions
with (not status), instead of (status == nil)", so obviously 'fail' is
going to be a third false value.

Could you please elaborate on your plans?  Is it to use 'fail' for
error and somehow allow 'nil' in tables?

As I said above,  returning (nil, error_message) is a well established
idiom, used by probably all Lua libraries, C extension modules and
programs. Do you expect library developers to update their code to use
'fail', or keep dual version using 'fail' for new Lua and keep using
nil for old pre-5.4 Lua? Or define in their libraries a global
'fail=nil' which would defeat your (future) purpose?

I am puzzled.

Phil