[erlang-questions] [ANN] Annotations 0.0.2

Tim Watson watson.timothy@REDACTED
Sat Feb 4 23:30:08 CET 2012


Thanks Edmond. I'm going to simplify the code generation so that the
wrapper functions make the call directly rather than via the
delegate_advice function, which will make tracing easier. I just need to
find a few spare hours! :)

On 4 February 2012 16:36, Edmond Begumisa <ebegumisa@REDACTED>wrote:

> 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 <watson.timothy@REDACTED>
> wrote:
>
>  Still in a very early state, https:://github.com/**hyperthunk/annotations<http://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<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/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120204/4f12ea64/attachment.htm>


More information about the erlang-questions mailing list