lua-users home
lua-l archive

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


Guess it isn't clear from the first glance, that assert () has several
ways of usage:

1. local a, b, c,d = assert (open_something ()) -- Here we can have
multiple arguments passed ahead
2. assert (a > b, "Error message") -- Here we don't use multiple
arguments feature
3. local a = assert (open_something_else (), "Error message") -- Here
we discard additional values
   returned from 'open_something_else ()'.

If we talk about implementing lazy evaluation of error message there
can be workaround for case 2 and case 3.
But the idea of patching 'assert ()' itself is not to jump from case to case,
but keep using assert () wherever it is reasonable.
BTW the patch only slow downs error case by doesn't affect case of
successful assertion.