[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] need help with hygienic macros
From: |
Peter Bex |
Subject: |
Re: [Chicken-users] need help with hygienic macros |
Date: |
Sun, 12 May 2013 19:10:11 +0200 |
User-agent: |
Mutt/1.4.2.3i |
On Sun, May 12, 2013 at 06:57:12PM +0200, Jörg F. Wittenberger wrote:
> The idea is to have a definer, `deftig` here, which only abstracts the
> argument list of the defined procedure away. Here a literal of the
> original macro (as used in a limited/extended XSLT implementation to be
> changed).
>
> (define-macro (define-transformer symbol . body)
> `(define (,symbol
> place
> message
> root-node
> variables
> namespaces
> ancestor
> self-node
> nl
> mode-choice
> proc-chain
> ) . ,body))
>
> The code references those parameters by their name, with all
> the downsides of unhygienic macros.
This is indeed fundamentally unhygienic.
> To get rid of the predefined-to-be-kept-in-head list of arguments,
> I want better macros. All arguments not changed by keyword to
> `xml-walk-down` (which would be `foo` or `gosh` in my example) shall
> just use the values from the enclosing `deftig`. (Let alone that I can
> probably sort out keyword-value-pairs from `foo`.) `gosh` BTW
> simulates a macro to access a parameter from the procedure defined
> by `deftig`. I don't mind it being either `gosh` or `(gosh)`; a one-time
> change in the source doesn't matter. BUT the actual argument list
> of procedures defined by `deftig` is supposed to change without
> touching every use of `deftig`. Therefore access to those arguments
> shall be done by sub-macros (reasonably) available (only) within
> the body of `deftig`-defined procedures.
That does sound a lot like parameters. Why not simply parameterize
the parameters based on arguments to your macros?
Cheers,
Peter
--
http://www.more-magic.net
Re: [Chicken-users] need help with hygienic macros, Marco Maggi, 2013/05/12