[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Does anyone have "assert" blindness ?
- From: Steve Litt <slitt@...>
- Date: Wed, 9 Mar 2011 09:16:54 -0500
On Wednesday 09 March 2011 06:02:19 Axel Kittenberger wrote:
> 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).
Hi Axel,
I agree with everything you say, but personally I wouldn't characterize it as
a problem. When I'm first coding something, working hard to keep the design in
my mind as my fingers put it into a source file, I have no time or mental
energy to think of error handling details. So I assert anything that can go
wrong. Later I can search for asserts and install proper error handling where
necessary.
I did this in C long before I'd ever heard of Lua -- it works well when
writing new code when you don't want to divert attention to try/catch/finally,
which has always seemed ponderous to me, and memorizing various exceptions.
SteveT
Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt