lua-users home
lua-l archive

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


Em qui, 3 de out de 2019 às 14:19, Phil Leblanc <philanc@gmail.com> escreveu:
> I am surprised with the 'fail' notation thing.  Was I living under a
> rock and did I miss some discussion here? :-)
I feel the same...

> 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.
By using (not status) we would not differ a false return value from a fail.

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

> 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?
Be careful not to define 'fail = true' !  Maybe we shoud define a local instead!

> I am puzzled.
Me too.  But, as always, Roberto will explain everything ;-)

Regards,
Tomás