Re: Scheme Macros as Data (Not Program) Transformers
Randall R Schulz <[email protected]> Fri, 28 Mar 2008 12:00:46 -0700
| Newsgroups | gmane.comp.java.sisc.user |
|---|---|
| Message-ID | <[email protected]> |
Sunnan,
On Friday 28 March 2008 11:47, Sunnan wrote:
> Hi, Randall,
> I've usually gone the other way around - I find Scheme to have many
> useful facilities (quasiquote among others) for data -> data
> transformation, and I then use that in macro definitions for when I
> need program -> program.
> Other than that, I find your question a bit unspecific. Maybe I
> misunderstood. Just use the quasiquote stuff outside a define-syntax
> context and you'll be fine.
Thanks.
I'll clarify my requirements a little more.
The reason I want to use Scheme macros is their declarative nature and
Scheme's automatic pattern-directed application of such macros to the
input. While I'll write many of the template / transforms myself, the
facility will also be available to end users of my system, and I cannot
expect them to be Scheme programmers. So the limitations of the Scheme
macro system are actually an advantage for me.
Other background information is that currently I'm handling the
rewriting requirements of my system (some of them—the most critical
ones) with hand-written Java. This is an entirely inadequate situation
that sharply limits evolvability and extensibility of my program.
Since it seems that were I to create a templating system of my own, it
would either be a mere shadow Scheme's macros or would simply converge
on Scheme's capabilities, so naturally I want to exploit Scheme macros
directly.
Does that make sense?
Here's a toy example I'm using while I figure out how to use Scheme
macros to achieve my transformatins:
(define-syntax define-object
(syntax-rules (:name :properties)
((define-object :name object-name)
`(object object-name))
((define-object :name object-name :properties object-property ...)
`((object object-name)
(object-property object-name) ...))
))
Randall Schulz
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace