On Nov 22, 2006, at 1:09 PM, Brendan Murphy wrote:
Joe Strout wrote:
Right, sure, you can write your own assertions; like this:
#if DebugBuild
Assert(x = y)
#endif
Leave out the #if and #endif, and it will be both better (assertions
should be in the final product in almost all cases) and more
readable.
With all due respect, then the assert is not an assert, it is a
real error check. You are failing to acknowledge what has been
said in how asserts should work because of your own personal
coding style. The traditional usage of the assert is the correct
usage which means we should be able to have them compile at the
developer's discretion (without having to wrap them in #if
statements).
There is no "traditional usage of the assert" in REALbasic. There
may be such in C. As for the correct usage of assertions, that's a
little trickier than many people seem to realize.
It's also not clear to me how RS could write this Assert method for
you. I'm quite sure they don't know what I want it to do, since in
different projects I may have it do different things. One client
wants
it to display a message box; another wants it to use
System.DebugLog; a
third wants the error written to their own log file. If they were to
implement it, what makes you think they would choose whatever
functionality you happen to prefer?
It is simple, the assert method calls an event and the developer
handles it there.
Uh, calls an event where? The only reasonable place for such an
event would be the Application object. The result of this would be
that the Application object would be coupled to the error-handling of
every object that uses an assertion. This sounds like a recipe for
disaster.
When used correctly, an assertion tests code correctness. An
assertion failure is probably not something that the assertion method
itself can handle, so the correct action is to raise an exception.
Joe you were part of the problem at RS when you worked there
because of this misguided attitude regarding asserts. Since you
don't work there any more, perhaps things have changed on this
issue. If RS's stance reflects your attitude upon the issue, then
we will never get a proper assert implementation simply because
they wish to enforce a particular development style upon us for
our own good.
As far as I can tell, RS' stance usually reflects Geoff Perlman's
attitude. Perhaps you should take it up with him. Your own attitude
regarding assertions would certainly be seen as misguided by some.
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>