[racket-dev] can a syntax-class "inherit" attributes?
Is there a way for a syntax-class to automatically inherit attributes?
For example, the third class below combines the first two. Is there a
way to automatically get the attributes from the first two classes in
the third one (ie, I want to drop the "#:attr X #'a.X" part in the
third class)?
#lang racket
(require syntax/parse)
(define-syntax-class A (pattern (a b) #:attr X #'b))
(define-syntax-class B (pattern (a b c) #:attr X #'c))
(define-syntax-class AorB
(pattern a:A #:attr X #'a.X)
(pattern b:B #:attr X #'b.X))
(syntax-parse #'(list 1) [ab:AorB (attribute ab.X)])