lua-users home
lua-l archive

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


In my opinion the core of that problem results in the Lua style of
setting things to nil on error and hoping the nil will raise an error
later on, instead of a more elaborated error system. The careful coder
thus has to assert anything to be not nil, if s/he wants the error to
be reported where it was caused, or worse to be oversighted at all
(like e.g. a nil into a variable which is later tested as a boolean
condition).

On Tue, Mar 8, 2011 at 5:38 PM, Jayanth Acharya <jayachar88@gmail.com> wrote:
> 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 ?
>