<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></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 20:45, Steve Haflich <<a href="mailto:shaflich@gmail.com">shaflich@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><p dir="ltr">No, it is generally possible to write portable setf expanders that work with multiple-value places provided the platform conforms to the ANS requirements. I have some extreme examples on another machine I may share to the list later.</p><p dir="ltr">I think to be portable transparent assure would need to collect and return multiple values, with the hope that the compiler would eliminate that stuff if the place were a single-value form like a variable or known function.<br>

</p>
</blockquote></div><div>OK, it seems you mean something like this:</div><div><br></div><div><div>(defmacro assure (type form &environment env)</div><div>  (multiple-value-bind</div><div>      (vars vals store-vars writer reader)</div><div>      (get-setf-expansion ,form env)</div><div>    (declare (ignore store-vars writer))</div><div>    `(let* ,(mapcar 'list vars vals)</div><div>       (check-type ,reader ,type)</div><div>       ,reader)))</div></div><div><br></div><div>However, this is not good enough. Something as simple as (assure integer (+ x y)) already doesn't work. The requirement that form is a generalized reference is an artifact that comes from check-type, but that shouldn't leak through.</div><div><br></div><div>I came up with another version. I believe this should work:</div><div><br></div><div><div>(defmacro assure (type form)</div><div>  (let ((values (copy-symbol 'values)))</div><div>    `(let ((,values (multiple-value-list ,form)))</div><div>       (declare (dynamic-extent values))</div><div>       (etypecase (values-list ,values)</div><div>         (,type (values-list ,values))))))</div></div><div><br></div><div>…except that this also doesn't work in some Common Lisp implementations for multiple values, but I think it should and those implementations need to be fixed.</div><div><br></div><div><br></div><div>Pascal</div><br><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>