Working on porting syntax-parse is a learning experience and I know understand how it uses syntax-local-value as a way to lookup a syntax object by joining the wraps together with the total wrap at the macro call.
The question is if this really are the total wrap e.g. contains the history of all the previous variable and macro and syntax definitions. Is this so or are it a partial part of the history?
Anyway syntax-parse works by defining pattern variables the hard core way and I have now changed that
to a more standard way of implementation leading to skipping syntax-local-value (variables are stored in a struct and they does then not contain the correct wrap) but instead examine the syntax variables used and transport the wraps of the containing syntax variable of the struct. For this I have a messy and sloppy
algorithm just to make it work - but I would like to have a syntax-join function that takes two syntax objects and join them correctly and robustly in the pressense of eventual marks or not.
Anyway this now works,
(define-syntax-class t (pattern (x:id y))) (define-syntax a (lambda (x) (syntax-parse x ((_ z:t ...) #'(+ z.y ...))))) (a (x1 1) (x2 2) (x3 3)) $1 = 6