[erlang-questions] Instrumentation

Tim Watson <>
Mon Dec 5 11:34:14 CET 2011


On 4 December 2011 23:41, Richard O'Keefe <> wrote:

>
> On 3/12/2011, at 8:58 AM, Tim Watson wrote:
> > The purpose of this prototyping was to play around with some of the
> ideas in Aspect Oriented Programming, and the library allows you to write
> code that executes before, after or around an annotated function.
>
>
> TOPS-20 Interlisp, 1981, chapter 19: ADVISING.
> I'm fairly confident the advice package was mainly
> the work of Warren Teitelman.
> Designed and implemented by Warren Teitelman.
> If you start with
>        (LAMBDA arguments body)
> advising gives you
>        (LAMBDA arguments (PROG (!VALUE)
>          (SETQ !VALUE (PROG NIL
>             before-advice-1
>             ...
>             before-advice-n
>             (RETURN body)))
>          after-advice-1
>          ...
>          after-advice-m
>          (RETURN !VALUE)))
> except that the versions of PROG, SETQ, and VALUE used are
> special ones so that macros cannot clobber them.
>
> (ADVISE function [when [where]] what)
>  function is the function to advise, it could be a name
>  or (f-1 IN f-2), or some other things;
>  when is BEFORE, AFTER, or AROUND;
>  where is LAST, BOTTOM, or END (put after existing
>  advice, FIRST or TOP (put before existing advice),
>  or an editor command;
>  what is the code to be run, and for AROUND advice it
>  may include a * as an expression, showing where the
>  existing code is to be plugged.
>
> It is important to give credit for ideas where it is really due.
> It is possible that someone else may have had the advice package
> idea before Warren Teitelman and the rest of the INTERLISP crew,
> but it's the first publication of the idea I've ever seen, and
> long predates all the hoopla about Aspect-Oriented Programming.
> (As indeed does Erik Sandewall's writing about what he called
> 'insertive programming'.)
>
> Before, after, and around advice is very handy, especially for
> debugging.  I'm delighted to see it becoming available for
> Erlang.  But credit where credit's due, eh?
>
>
Richard, absolutely. I've never pretended to be an inventor, but rather
someone capable of looking at other people's inventions and applying them
to interesting problems to produce (hopefully) useful solutions. To be
perfectly honest, I'd never heard of INTERLISP (I am just a young'un
though) and AOP is simply the name for this *stuff* that I'm familiar with.
Thanks for sharing the proper context around this - I now have some serious
lunchtime reading to do! :)

The quote about having "a * as an expression" is very interesting, as I
think having the ability to bind annotations/advice to modules/functions
declaratively could be very useful. I wondered if match specifications
would be the way to go for this, but I'm hoping some further feedback from
the community can help cement my thinking about how best to do it.

Cheers,

Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111205/450aa92f/attachment.html>


More information about the erlang-questions mailing list