[erlang-questions] [ANN] Annotations 0.0.2

Edmond Begumisa <>
Sat Feb 4 17:36:05 CET 2012


Excellent work :)

This is really nice to use with the OTP Event Tracer, which I use a lot  
with macros. Annotations are much cleaner.

- Edmond -

On Thu, 02 Feb 2012 07:37:37 +1100, Tim Watson <>  
wrote:

> Still in a very early state, https:://github.com/hyperthunk/annotations  
> now
> supports generating additional functions as well as instrumenting  
> existing
> (i.e., annotated) ones with before/after/around. As an example of how to
> use this, I've written up a sample application that can be used to  
> generate
> tedious/boilerplate wrapper functions:
> https://github.com/hyperthunk/delegate.
>
> A typical use of delegate is to remove the need to hand code the named
> 'wrapper' functions for this AST builder that produces a generic
> representation of applying a 'binary operator':
>
> -delegate([
>     %% pass the generated/target function name
>     %% in front of the input arguments
>     {args, ['$T', '$I']},
>     %% let the generated function(s) have a different arity
>     {arity, 2},
>     %% generate functions with/for each of these names...
>     {delegate, [
>            "eq", "gt",
>            "gteq", "lt",
>            "lteq", "like",
>            "contains", "starts_with",
>            "ends_with", "matches", "path_exists"
>     ]}]).
> binop(Op, Axis, {{_,_,_}, _}=Literal) ->
>     binop(Op, Axis, {literal, Literal});
> binop(Op, Axis, Literal) when is_integer(Literal) orelse
>                               is_float(Literal) orelse
>                               is_list(Literal) orelse
>                               is_record(Literal, semver) ->
>     binop(Op, Axis, {literal, Literal});
> binop(Op, Axis, {literal, _}=Literal) ->
>     {Axis, {operator, Op}, Literal}.
>
>
> None of this would be possible without the awesome parse_trans library,  
> so
> a big thank you is due to Ulf for that really killer tool! Roadmap for
> 0.0.3 is mainly runtime module/code changes via parse_trans_mod.


-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



More information about the erlang-questions mailing list