[erlang-questions] scope of variables

David Hopwood david.nospam.hopwood@REDACTED
Mon Sep 4 20:55:53 CEST 2006


Vlad Dumitrescu wrote:
> On 9/4/06, David Hopwood <david.nospam.hopwood@REDACTED> wrote:
> 
>> I'm also strongly of the opinion that hygiene should be an inherent
>> property of a macro system, and not dependent on hacks like gensym or
>> use of funky variable names. (It is OK to be able to *explicitly*
>> declare that a variable should be captured; this is occasionally useful.)
> 
> I'm not sure if it's possible to have a hygienic macro system that
> doesn't use gensym behind the scenes.

Well, it is not necessary for the implementation to generate a unique
string as an identifier. It is simpler to accept unique tokens, as well
as strings, in place of identifiers.

> I suppose you mean that the user shouldn't have to bother with it.

That's what I mean, yes.

> And of course he/she shouldn't!

"Of course", but many macro systems do require this.

Also note that hygiene is orthogonal to whether you use a separate sublanguage
to define macros (like Scheme syntax-rules) or the full language (like
Common Lisp defmacro).

-- 
David Hopwood <david.nospam.hopwood@REDACTED>





More information about the erlang-questions mailing list