<div dir="ltr">You'd have to ask Ryan to be sure, but I think they're pretty stable. I've been using them for some time.<br></div><div class="gmail_extra"><br clear="all"><div>Carl Eastlund</div>
<br><br><div class="gmail_quote">On Fri, Aug 23, 2013 at 12:53 PM, Stephen Chang <span dir="ltr"><<a href="mailto:stchang@ccs.neu.edu" target="_blank">stchang@ccs.neu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Ah, thanks. That's exactly what I wanted.<br>
<br>
How stable are these features? Shall I add them to the docs?<br>
<div class="HOEnZb"><div class="h5"><br>
On Fri, Aug 23, 2013 at 12:54 AM, Carl Eastlund <<a href="mailto:cce@ccs.neu.edu">cce@ccs.neu.edu</a>> wrote:<br>
> Here's how you want to define AorB:<br>
><br>
> (define-syntax-class AorB #:auto-nested-attributes<br>
> (pattern :A)<br>
> (pattern :B))<br>
><br>
> There's two things going on here, both of which I believe are undocumented,<br>
> sadly.<br>
><br>
> One is #:auto-nested-attributes, an option that tells AorB that anything<br>
> bound as an attribute by nested sub-patterns in its clauses should<br>
> automatically become an attribute of AorB.<br>
><br>
> The other is that empty identifier does not add "." to its attribute names.<br>
> When you bind a with the attribute X, you get A.X, and when you bind b, you<br>
> get b.X, but when you bind the empty identifier, you just get X.<br>
><br>
> So now you just have X bound in both clauses, and that's automatically made<br>
> an attribute of AorB, and it all works like you want.<br>
><br>
> Carl Eastlund<br>
><br>
><br>
> On Fri, Aug 23, 2013 at 12:22 AM, Stephen Chang <<a href="mailto:stchang@ccs.neu.edu">stchang@ccs.neu.edu</a>> wrote:<br>
>><br>
>> Is there a way for a syntax-class to automatically inherit attributes?<br>
>><br>
>> For example, the third class below combines the first two. Is there a<br>
>> way to automatically get the attributes from the first two classes in<br>
>> the third one (ie, I want to drop the "#:attr X #'a.X" part in the<br>
>> third class)?<br>
>><br>
>> #lang racket<br>
>> (require syntax/parse)<br>
>><br>
>> (define-syntax-class A (pattern (a b) #:attr X #'b))<br>
>> (define-syntax-class B (pattern (a b c) #:attr X #'c))<br>
>> (define-syntax-class AorB<br>
>> (pattern a:A #:attr X #'a.X)<br>
>> (pattern b:B #:attr X #'b.X))<br>
>><br>
>> (syntax-parse #'(list 1) [ab:AorB (attribute ab.X)])<br>
>> _________________________<br>
>> Racket Developers list:<br>
>> <a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
>><br>
><br>
<br>
</div></div></blockquote></div><br></div>