On 17 Set, 17:34, Doug Philips <douglas.phil...@gmail.com> wrote:
> On Fri, Sep 17, 2010 at 08:50, Alessio Stalla <alessiosta...@gmail.com> wrote:
> > On Sep 16, 4:10 pm, Nicolas Oury <nicolas.o...@gmail.com> wrote:
> > Note also that the OP's original example does not require anything
> > more than what defmacro already provides. And turning function calls
> > into macro calls is not a great idea; it won't cover the use of apply
> > and similar.
>
> Hmmm, that's odd. Perhaps I've missed a message somehow, but I'm not
> sure why name-space manipulation isn't the right thing to use.
> To condense, I want to "change the behaviour" of (foo ...), is that right?
> If so, then instead of getting the definition of foo from its usual
> name space, couldn't I get it from a 'tracing foo' name space or
> 'wrapping foo in bar' name space?  I think I could do this with
> macros, such that the usual name space that foo comes from is used,
> but foo is 'redefined' with a macro to do something that masquerades
> as foo and probably/maybe calls the 'real' foo eventually. Problem is
> that macros interact with apply, etc. so I'm back to thinking name
> space manipulations are the right thing, or that I've skimmed too much
> and don't understand the problem. :-)

Hmm. I can't quite understand what you mean by namespace
manipulations, because my Clojure-fu is really limited, I'm just
lurking here to keep in touch with what happens in "the other camp" ;)
Anyway, I don't think it's *you* the one who "gets the definition of
foo from the <whatever> namespace"; it's the Clojure system that does.
So if you want to make Clojure see a different foo, you have to
redefine - or rebind, with the appropriate caveats - foo. Redefining
it as a function is sufficient; introducing a macro doesn't buy
anything in this case: it forces you to recompile all the code that
uses foo, even third-party code, and makes the new foo lose its first-
class object status. In general, using a macro to modify the behaviour
of existing code is dangerous and smells a little too much like C ;)

Just my €.02,
Alessio

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to