lua-users home
lua-l archive

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


On Wed, May 19, 2010 at 12:19 PM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> On Wed, May 19, 2010 at 1:06 PM, Nikolai Kondrashov <spbnick@gmail.com> wrote:
>> Thanks, I think that Metalua or maube LuaMacro as Steve suggest is my way :)
>> Completely forgot about the macros when I asked the question :)
>
> There's always C.A.R Hoare on the subject of disabling assertions:
>
> [[
> ... it is absurd to make elaborate security checks on
> debugging runs, when no trust is put in the results, and
> then remove them in production runs, when an erroneous
> result could be expensive or disastrous.
> ]]
>
> He also expressed it less formally, that it was like throwing away
> your lifeboats when it was finally time to take your ship to the sea
> ;)
>
> But it's true, assertions have a cost...

If the condition is not an incredibly complicated calculation itself,
and the error message (if supplied) is not a constructed string, I
suspect most people will find even heavily asserted programs do not
run measurably slower than the equivalent program without assertions.
Certainly assertions in tight loops that are called frequently could
cause a problem, but that's a bit of a corner case that can be
designed around.

- Jim