<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 22 Sep 2013, at 16:56, Scott McKay <<a href="mailto:swmckay@gmail.com">swmckay@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Sep 22, 2013 at 9:53 AM, Pascal Costanza <span dir="ltr"><<a href="mailto:pc@p-cos.net" target="_blank">pc@p-cos.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">
Hi,<br>
<br>
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.<br>
<br>
ASSURE is easy to define:<br>
<br>
(defmacro assure (type form)<br>
  (let ((object (copy-symbol 'object)))<br>
    `(let ((,object ,form))<br>
       (check-type ,object ,type)<br>
       ,object)))<br>
<br></blockquote><div><br></div><div style="">Yeah, this is really useful. One question -- is it also worth putting</div><div style="">in (declare (type ,object ,type)) after the let-binding? Or does every</div><div style="">competent compiler do the right thing once it's seen 'check-type'?</div>
</div></div></div></blockquote><br></div><div>The type is only guaranteed after the check-type, so I don't think it's valid to put such a type declaration immediately after the let binding. After the check-type, it does not make much sense anymore, because immediately afterwards, the object is just returned.</div><div><br></div><div><br></div><div>Pascal</div><div><br></div><div><br></div><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div>--</div><div>Pascal Costanza</div><div>The views expressed in this email are my own, and not those of my employer.</div><div><br></div></span><br class="Apple-interchange-newline">

</div>
<br></body></html>