<div dir="ltr">It's sad that this conses...</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Sep 22, 2013 at 3:44 PM, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div>On 22 Sep 2013, at 20:45, Steve Haflich <<a href="mailto:shaflich@gmail.com" target="_blank">shaflich@gmail.com</a>> wrote:</div>
<br><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 class="im"><div>  (multiple-value-bind</div><div>      (vars vals store-vars writer reader)</div>
</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 class="im"><div>  (let ((values (copy-symbol 'values)))</div><div>    `(let ((,values (multiple-value-list ,form)))</div>
</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 class="im"><div><br></div><div><br></div><div>Pascal</div><br><div>
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><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>

</div>

<br></div></div></blockquote></div><br></div>