[Prev][Next][Index][Thread]
Re: Can macros define anonymous locals?
Chris Page wrote:
>
> I was describing Dylan macros to some people the other day, and it occurred
> to me that I am uncertain as to whether a macro can define an "anonymous"
> local variable to implement the macro. That is, can a macro expansion
> include a "let foo..." or a "local foo..." where the "foo" can be referred
> to by the macro-generated code, but will not clash with any variable "foo"
> that may be defined by a body in the macro call?
Chris,
Dylan macros are hygienic, i.e. neither have the macro context (the surroundings of the macro call) any effect on its innards, nor the does the macro expansion alter the macro call's environment. So
every identifier that is introduced in a macro template is (in a sense) anonymous.
That said, there is a special device for circumvening hygiene, which is a special macro pattern that is able to grab an identifier from the macro call's environment.
For more explanation look in DRM (Macro Hygiene)
http://www.gwydiondylan.org/drm/drm_85.htm#HEADING85-0
Hope this helps,
Gabor
>
> --
> Chris Page
> Mac OS Lead, Palm Desktop
> Palm, Inc.
>
> let mailto = concatenate( "page", "@", "best.com" );
Follow-Ups:
References: