> I hate to go completely off topic, but could you explain what advices > are in Lisp? When I was reading a post by Steve Yegge he wrote
CLOS (the Common Lisp Object System) has before, around, and after methods. Advice is similar, and certainly informed the CL standard. So far as I understand it, advice (in its various historical forms) provides a way to intercept the call to a function to modify arguments or otherwise "advise" the function about what to do. The function continues to do the heavy lifting, but is unaware of the advice. CLOS around methods can do the same thing, with two differences: * Advice is -- I think -- intended to be narrower in scope (you don't put big functionality in advice: you add individual features). Emacs doesn't follow this, of course :) * Advice is more modular -- around/before/after methods in CLOS are run in a defined order, each controlling the invocation of the next around method; multiple pieces of advice can be toggled on or off. You'd do things like turn on tracing/logging/profiling using advice. Interesting reading: http://p-cos.blogspot.com/2007/12/origin-of-advice.html > Does Clojure support something like this? I didn't come across it in > Stuart's book, website, etc. and AOP certainly helps manage complexity > in Java. IME AOP in OO languages usually helps because they lack higher-order functions, first-order functions, and other linguistic features. It's much easier to define global triggers in Lisps: just have some global list of function objects that you can call, call a method and allow other people to define their own arounds, etc. You can implement something like method combinations in Clojure, but it's not built in. People have worked on CLOS-style object systems in Clojure: http://code.google.com/p/explorersguild/wiki/XGModelAndGF HTH, -R --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---