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

Re: Complicated macro expansion question



In article <49f7a00.0111212153.7a6ea935@posting.google.com>, 
dauclair@hotmail.com (Douglas M. Auclair) wrote:

> Hi!  I'm working on a definer macro that'll do this kind
> transformation:
> 
> { define unit constraints (min, max) end } =>
>  { define class <min> (<unit>)
>     inherited slot name = #"min";
>    end class;
>    *constraints*[#"min"] := <min>;
>    
>    define class <max> (<unit>)
>     inherited slot name = #"max";
>    end class;
>    *constraints*[#"max"] := <max>;
> 
>    define constant <units> = one-of(#"min", #"max"); }

Ummm ... I really don't understand what you're trying to do here.  
Forget the macros for the moment: what code do you want it to expand to, 
and what does it all mean?

I don't see any definition above for <unit> or *constraints*.


Also, regarding macros, Dylan definer macros must have the name of the 
macro as the first thing after the word "define" when you use them.  So 
if you're making a constraints-definer macro, the code using it can't 
say "define group constraints(...)", but it can say "define constraints 
group(...)" or "define constraints group = ..." or anything else you 
want that starts with "define constraints" and ends with "end".

But show us how you see the expanded code actually working, and then 
we'll be able to help with the macro definition.

-- Bruce



Follow-Ups: References: