<div dir="ltr"><div>It's not changing it, I'm just trying to figure out the implementation and understand what I'm seeing.</div><div>For example, given this:</div><div><br></div><div>(struct posn (x y))</div><div>
<br></div><div>(define-syntax (test stx)</div><div> (syntax-case stx ()</div><div><span class="" style="white-space:pre"> </span>[(_ x)</div><div><span class="" style="white-space:pre"> </span> (printf "val is: ~s" (syntax-local-value #'posn))</div>
<div><span class="" style="white-space:pre"> </span> #''done]))</div><div><br></div><div>> posn</div><div>#<procedure:posn></div><div><br></div><div>> (test x)</div><div>#<procedure:self-ctor-checked-struct-info></div>
<div><br></div><div>I'm surprised that the values are different. Is posn actually always a self-ctor-checked-struct-info object, but it's prop:procedure is defined to allow for being used in an expression in the first case? </div>
<div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jan 19, 2014 at 8:40 PM, Carl Eastlund <span dir="ltr"><<a href="mailto:carl.eastlund@gmail.com" target="_blank">carl.eastlund@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">If syntax-local-value is returning something other than the value you put in, that's a bug. It shouldn't be wrapping it or changing it in any way. Do you have a program where you bind something via define-syntax that satisfies struct-info?, and get something out via syntax-local-value that doesn't?<span class="HOEnZb"><font color="#888888"><br>
</font></span><div class="gmail_extra"><span class="HOEnZb"><font color="#888888"><br clear="all"><div>Carl Eastlund</div></font></span><div><div class="h5">
<br><div class="gmail_quote">On Sun, Jan 19, 2014 at 11:27 PM, Scott Klarenbach <span dir="ltr"><<a href="mailto:scott@pointyhat.ca" target="_blank">scott@pointyhat.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div>But I don't see how the same binding can be a transformer and also return something else (like a list, or a checked-struct-info-thing) via syntax-local-value.<br></div><div><br></div><div>If I bind my-fn as a transformer, then any other macros that use it with syntax-local-value will receive the transformer procedure back, not any special meta data. And if I bind it as meta data directly, ie (define-syntax my-fn 'something) then it works with syntax-local-value but any attempts to use it as a transformer result in illegal syntax.</div>
<div><br></div><div>Even if I create a transformer that returns a struct which implements both prop:procedure and prop:struct-info, using that binding with syntax-local-value will return the transformer procedure itself, rather than the final struct.</div>
<div><br></div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jan 19, 2014 at 8:04 PM, Carl Eastlund <span dir="ltr"><<a href="mailto:carl.eastlund@gmail.com" target="_blank">carl.eastlund@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yes, I believe that the name of a structure defined by "struct" is bound at syntax-time to a value that implements both prop:procedure, so that it can expand to a use of the constructor when used in an expression, and prop:struct-info so that it can be use to look up static information when passed to relevant macros.<br>
</div><div class="gmail_extra"><br clear="all"><div>Carl Eastlund</div>
<br><br><div class="gmail_quote"><div><div>On Sun, Jan 19, 2014 at 11:00 PM, Scott Klarenbach <span dir="ltr"><<a href="mailto:scott@pointyhat.ca" target="_blank">scott@pointyhat.ca</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
<div dir="ltr">How is it that the definition of (struct my-name (x y)) can bind <i>my-name</i> both as a #<procedure:my-name> at runtime and a transformer-binding <i>my-name</i> that at compile time (via syntax-local-value) produces #<procedure:self-ctor-checked-struct-info>.?<div>
<br></div><div>Or, put another way, how can I define a transformer <i>my-fn</i> that produces syntax, but that also exposes hidden meta-data under the same binding to other macros that might wish to know about the binding at compile time?<br>
<div><br></div><div>I'm specifically wondering how the overloading works. Is it some clever use of prop:procedure?</div><div><br></div><div>Thanks.</div><div><div><br></div>-- <br>Talk to you soon,<br><br>Scott Klarenbach<br>
<br>PointyHat Software Corp.<br><a href="http://www.pointyhat.ca" target="_blank">www.pointyhat.ca</a><br>p <a href="tel:604-568-4280" value="+16045684280" target="_blank">604-568-4280</a><br>e <a href="mailto:scott@pointyhat.ca" target="_blank">scott@pointyhat.ca</a><br>
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">200-1575 W. Georgia</span><br>
Vancouver, BC <span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">V6G2V3</span><br><br>_______________________________________<br>To iterate is human; to recur, divine
</div></div></div>
<br></div></div>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Talk to you soon,<br><br>Scott Klarenbach<br><br>PointyHat Software Corp.<br><a href="http://www.pointyhat.ca" target="_blank">www.pointyhat.ca</a><br>p <a href="tel:604-568-4280" value="+16045684280" target="_blank">604-568-4280</a><br>
e <a href="mailto:scott@pointyhat.ca" target="_blank">scott@pointyhat.ca</a><br><span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">200-1575 W. Georgia</span><br>
Vancouver, BC <span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">V6G2V3</span><br><br>_______________________________________<br>To iterate is human; to recur, divine
</div>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Talk to you soon,<br><br>Scott Klarenbach<br><br>PointyHat Software Corp.<br><a href="http://www.pointyhat.ca" target="_blank">www.pointyhat.ca</a><br>p 604-568-4280<br>
e <a href="mailto:scott@pointyhat.ca" target="_blank">scott@pointyhat.ca</a><br><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">200-1575 W. Georgia</span><br>
Vancouver, BC <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">V6G2V3</span><br><br>_______________________________________<br>To iterate is human; to recur, divine
</div>