On 25.11.2008, at 15:06, Konrad Hinsen wrote:

> I just saw a reference to symbol-macrolet with a description. My
> function replace-syms is indeed very similar, the difference being
> that it takes a map for defining the substitutions to be done,
> instead of a let-like sequence. The difference is not just in syntax
> though, as expressions in symbol-macrolet can refer to earlier
> "bindings" (they aren't really bindings) whereas my replace-syms
> doesn't check for substitutions to be made inside other
> substitutions. But it would be fairly easy to implement symbol-
> macrolet on top of my replace-syms.

After having read more on macrolet and symbol-macrolet, I no longer  
agree with my earlier self ;-)

symbol-macrolet does not do a simple substitution, it creates a  
binding-like environment from which replacements are done repeatedly  
as other macros are expanded. I haven't yet found a complete  
description of how macros and symbol-macrolet work together. A macro  
can expand into code that contains a symbol defined in symbol- 
macrolet, and the expansion of such a symbol can produce code  
containing macros. I'd expect everything to be expanded repeatedly  
until the form no longer changes, but I haven't see this being stated  
explicitly anywhere.

In any case, implementing macrolet and symbol-macrolet is probably  
not a trivial project. I see basically two approaches:
1) Full repeated expansion of the form, which is then handed to the  
compiler.
2) Implementation as an extension to the compiler's macro handling  
scheme.

When I started working on my monad implementation, I was in fact  
looking for something much like macrolet, and if I had pursued that  
approach I would have wanted symbol-macrolet just a bit later. Both  
would be nice to have.

Konrad.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to