Can I turn ASSERT off?
Posted: Thu Aug 21, 2008 10:26 am
Is there a mechanism to turn off compilation of the asserts when I want to compile release (optimized) code? Or do I have to redefine ASSERT manually?
Discuss and learn Lisp programming of all dialects. NOTICE: Site locked. No new users or posts.
http://www.lispforum.com/
Common Lisp already has a way to toggle evaluation of forms, using *features*. What would the benefit of having a specialized mechanism for ASSERT forms be?humpolec wrote:I have no problem doing it myself, I just thought Common Lisp had that functionality - even C has it after all.
Hmmm... this is one of those questions that shows you're still holding onto a C-like worldview. That's nothing to be ashamed of, though. I had the same thing when I first started studying Lisp because we're all products of our prior experience. I'd suggest that before you start worrying about code so optimized that ASSERT is compiled out of it, you instead make sure you are starting to operate in a Lisp worldview. The purpose of ASSERT in Lisp is not quite the same as in C.humpolec wrote:I have no problem doing it myself, I just thought Common Lisp had that functionality - even C has it after all.
Yup, it typically takes a while. At some point, you'll have that "A-ha!" moment when everything will drop into place and you'll realize what makes Lisp so mind-blowingly different. At that point, no other programming language will seem good enough. You will have achieved some measure of "smug Lisp weenie-ness".humpolec wrote:Thanks for the explanation!
I guess some time will pass until my code stops being C-like, then...