Code Comments
Programming Forum and web based access to our favorite programming groups.I have the following macro:
define macro frame-setter
{ frame-setter( ?clsname:name, ?members ) } => { ?members } ;
members:
{ } => { }
{ ?member , ... } => { ?member ... } ;
member:
{ ?:name } => {
define method setter-?name( value, this ) end;
define method ?name( this ) => ( <object> ) end;
} ;
end macro ;
this macro is intended to construct specific setter and
getter method. But it does not work since in setter-?name
the ?name is simply not subsitutted. In the DRM i found
name-prefix ? name name-suffix.
There for this would be a valid construct. What is wrong?
Michael
Post Follow-up to this messageMichael Erdmann wrote:
> I have the following macro:
>
......................
>
> member:
> { ?:name } => {
> define method setter-?name( value, this ) end;
> define method ?name( this ) => ( <object> ) end;
> } ;
>
> end macro ;
>
> this macro is intended to construct specific setter and
> getter method. But it does not work since in setter-?name
> the ?name is simply not subsitutted. In the DRM i found
>
> name-prefix ? name name-suffix.
>
This problem has been solved. The same macro look now like this:
define macro frame-accessor
{ frame-accessor( ?clsname:name, ?members ) } => { ?members } ;
members:
{ } => { }
{ ?member , ... } => { ?member ... } ;
member:
{ ?:name } => {
define method "setter-"##?name( value, this ) end;
define method ?name( this ) => ( <object> ) end;
} ;
end macro ;
_BUT_ there is still a problem. In order to make the methods
valid i need to restrict the type of this, which means
member:
{ ?:name } => {
define method "setter-"##?name( value, this :: ?clsname ) end;
define method ?name( this :: ?clsname ) => ( <object> ) end;
} ;
which leads to:
[Loading library format-out...]]
Parsing ma.dylan
"ma.dylan", line 35, characters 58 through 64:
define method "setter-"##?name( value, this :: ?clsname ) end;
^^^^^^^
Error: Unbound pattern variable: clsname
skipping rest of ma.dylan
Is there any way to pass from the main rule a
variable into aux. rules?
> There for this would be a valid construct. What is wrong?
>
> Michael
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.