[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Removing debug assertions
- From: Mark Hamburg <mhamburg@...>
- Date: Fri, 11 May 2007 08:36:58 -0700
on 5/10/07 6:08 AM, email@example.com at firstname.lastname@example.org wrote:
> Preprocessing your scripts is one option, but have you considered the
> following (untested):
> function assert(cond, ...)
> if not cond then error(string.format(...), 2) end
> return cond, ...
> This should avoid most unnecessary string construction/concatenation. Are you
> worried this will still impact performance? As David suggested, another option
> is CPP
This would be a reasonable option if the meaning of %s in string.format was
changed to do a tostring (or a new escape were introduced to do this).
Slightly odd things can happen if the error message string contains
accidental escape sequences -- e.g,, the name of a file contains a percent
sign and that file name gets included in the error string.