On Sun, Sep 22, 2013 at 9:53 AM, Pascal Costanza <pc@p-cos.net> wrote:Hi,
It seems to me that ASSERT and CHECK-TYPE are not as convenient as they could be. In particular, ISLISP seems to have a better alternative in ASSURE.
ASSURE is easy to define:
(defmacro assure (type form)
(let ((object (copy-symbol 'object)))
`(let ((,object ,form))
(check-type ,object ,type)
,object)))
Yeah, this is really useful. One question -- is it also worth puttingin (declare (type ,object ,type)) after the let-binding? Or does everycompetent compiler do the right thing once it's seen 'check-type'?