I see a couple potential issues. (Better terms for whether the reader macro evaluates subforms might be "evaluating" and "quoting".)<div><br></div><div>If the elements inside the syntax are permitted to be non-self-evaluating objects such as symbols or conses, then under the evaluating option one would need to write [1 'x (+ 40 2)].</div>
<div><br></div><div>Second, as I'm sure you realize, the evaluation model at read time is very different from regular evaluation in that it always happens in the read-time dynamic environment and the null lexical environment. This doesn't matter if the computations are just simple arithmetic, but it makes read-time evaluation feel messy to me, especially if someone might later use it with more-complex forms.</div>
<div><br></div><div>You might also consider inside your reader macro borrowing the syntax and meaning of the backquote comma:</div><div>[ 1 x ,(+ 40 2) ]. This might make the meaning and environment more evident to experienced CL programmers (although comma forms evaluate at run time in the current lexical environment).</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Dec 3, 2012 at 5:12 AM, Marco Antoniotti <span dir="ltr"><<a href="mailto:antoniotti.marco@disco.unimib.it" target="_blank">antoniotti.marco@disco.unimib.it</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">Dear all,<div><br></div><div>I was fooling around with reader macros to implement some - let's say - "tuple" syntax.</div>
<div><br></div><div>Now, I am just curious about the general thinking on this.</div><div><br></div><div>First of all, let's note that the problem here in the conflating of the "constructor" with the "printed representation" of an item. I.e., in Matlab you say</div>
<div><br></div><div><font face="Courier">>> [1, 2, 40 + 2]</font></div><div><font face="Courier">ans =</font></div><div><font face="Courier"><span style="white-space:pre-wrap"> </span>1<span style="white-space:pre-wrap"> </span>2<span style="white-space:pre-wrap"> </span>42</font></div>
<div><br></div><div><br></div><div>In CL, doing the simple thing, you get</div><div><br></div><div><font face="Courier">cl-prompt> [1 2 (+ 40 2)]</font></div><div><font face="Courier">[1 2 42]</font></div><div><br></div>
<div>but</div><div><br></div><div><font face="Courier">cl-prompt> #(1 2 (+ 40 2))</font></div><div><font face="Courier">#(1 2 (+ 40 2))</font></div><div><br></div><div>So, suppose you have your <font face="Courier">[ … ]</font> reader macro, would you have it work "functionally" or "quoting-ly" (for want of a better word)? I am curious. Note that the Matlab-style version would not break referential transparency if you did not have mutations.</div>
<div><br></div><div>best</div><div><br></div><div>Marco Antoniotti</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><div>--<br>Marco Antoniotti, Associate Professor<span style="white-space:pre-wrap"> </span>tel.<span style="white-space:pre-wrap"> </span><a href="tel:%2B39%20-%2002%2064%2048%2079%2001" value="+390264487901" target="_blank">+39 - 02 64 48 79 01</a><br>
DISCo, Università Milano Bicocca U14 2043<span style="white-space:pre-wrap"> </span><a href="http://bimib.disco.unimib.it" target="_blank">http://bimib.disco.unimib.it</a><br>Viale Sarca 336<br>I-20126 Milan (MI) ITALY<br>
<br>Please note that I am not checking my Spam-box anymore.<br>Please do not forward this email without asking me first.<br><br><br><br><br></div><br></div></div><br>_______________________________________________<br>
pro mailing list<br>
<a href="mailto:pro@common-lisp.net">pro@common-lisp.net</a><br>
<a href="http://lists.common-lisp.net/cgi-bin/mailman/listinfo/pro" target="_blank">http://lists.common-lisp.net/cgi-bin/mailman/listinfo/pro</a><br></blockquote></div><br></div>