lua-users home
lua-l archive

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


2011/3/8 Jayanth Acharya <jayachar88@gmail.com>:
> Does anyone else have this case of acute "assert" blindness, sometimes...
> looking at some Lua code ?
>
> Came accross some examples, where literally almost every functioncall has an
> assert(). It is somewhat painful to look thru the asserts, and actually
> figure out the logic within.
> Might like to modify SciTE syntax-highlighting config to treat assert as a
> keyword, s.t. I can atleast focus on the main logic.
>
> Might be useful to have some syntactic sugar, like
> "require(assertion_on_everything_that_makes_sense)" s.t. at runtime
> everything is treated as if it's wrapped in an assert() !! Anyone ?

Maybe the point of assert is to be visible, to remind you that you
need to do proper error handling there. I know it's easy (and useful)
as a programmer to just let the program die with a stack trace, but
for end users these exceptionnal cases should at least display some
helpful error message instead, or recover from the situation if
possible.