[plt-scheme] How best to do this task...

From: Grant Rettke (grettke at acm.org)
Date: Wed Jun 6 12:30:17 EDT 2007

Hi folks,

For my current project we generate a bit of Java code. For example, we
have dumb data transfer objects whose definitions change frequently.
It is easier to keep a list of their properties. Right now I do this
using Ruby, with a single class, PropGen. It looks like this:

fields (an array of name/type pairs)

You tell it to generate either an interface or a class.

It was thinking about the way to do this in Scheme. It seems to be
that I could implement it the exact same way, since my first version
of PropGen is roughly functional, and the second version is OO.

So that said, I am thinking about how to make it nicer in Scheme. For
example, could I do something like this?

(define account_dto
        '(('firstName 'string)
          ('lastName 'string)

(account_dto generate_interface)

Is this what folks mean when they always talk about how you use Lisp to do DSLs?

I've got a sense of using macros to to do this, but I don't even know
if that is a good/the right approach to begin with.

Thanks for you advice on this.

Posted on the users mailing list.