Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Q: build compound names in macros
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

Report this thread to moderator Post Follow-up to this message
Old Post
Michael Erdmann
12-13-04 01:55 AM


Re: Q: build compound names in macros
Michael 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

Report this thread to moderator Post Follow-up to this message
Old Post
Michael Erdmann
12-14-04 01:58 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Dylan archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:39 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.