[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Do we have a standard for error checking/handling?
From: |
Rob Browning |
Subject: |
Re: Do we have a standard for error checking/handling? |
Date: |
12 May 2001 16:52:30 -0500 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
Sam Tregar <address@hidden> writes:
> Would it be possible to use some kind of conditionally-expanded
> macro for this? Developers could do "(type-checking on)" at the top
> of their code when they want slow type checking in effect throughout
> Guile's modules. Then, when all is well they can change it to
> "(type-checking off)" and get the benefit of faster execution.
> Sounds like a new standard module could be off use here.
This would be entirely possible and probably not technically
challenging. We would just have to agree on a standard and start
using it. i.e. a dirt-stupid implementation might be
(define-macro (debuging-type-checks . body)
(if *debuging-use-type-checks?*
`(begin ,@body)
#t))
and then you could have
(define (foo some-number some-string)
(debugging-type-checks
(if (not (number? some-number) ...))
(if (not (string? some-string) ...)))
...)
This mechanism could only be enabled/disabled before a load, but it
would also have *no* runtime impact when disabled. It's the
rough equivalent of #ifdef...
Whether or not this is something we *should* try to do on a large
scale is another question entirely.
--
Rob Browning <address@hidden> PGP=E80E0D04F521A094 532B97F5D64E3930