guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: syntax-local-value patch for discussion


From: Stefan Israelsson Tampe
Subject: Re: syntax-local-value patch for discussion
Date: Thu, 19 Jan 2012 10:50:47 +0100

Hi,

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

/Stefan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]