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! :)<br>
<br><div class="gmail_quote">On 4 February 2012 16:36, Edmond Begumisa <span dir="ltr"><<a href="mailto:ebegumisa@hysteria-tech.com">ebegumisa@hysteria-tech.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im HOEnZb">Excellent work :)<br>
<br>
This is really nice to use with the OTP Event Tracer, which I use a lot with macros. Annotations are much cleaner.<br>
<br>
- Edmond -<br>
<br>
On Thu, 02 Feb 2012 07:37:37 +1100, Tim Watson <<a href="mailto:watson.timothy@gmail.com" target="_blank">watson.timothy@gmail.com</a>> wrote:<br>
<br>
</div><div class="HOEnZb"><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Still in a very early state, https:://<a href="http://github.com/hyperthunk/annotations" target="_blank">github.com/<u></u>hyperthunk/annotations</a> now<br>
supports generating additional functions as well as instrumenting existing<br>
(i.e., annotated) ones with before/after/around. As an example of how to<br>
use this, I've written up a sample application that can be used to generate<br>
tedious/boilerplate wrapper functions:<br>
<a href="https://github.com/hyperthunk/delegate" target="_blank">https://github.com/hyperthunk/<u></u>delegate</a>.<br>
<br>
A typical use of delegate is to remove the need to hand code the named<br>
'wrapper' functions for this AST builder that produces a generic<br>
representation of applying a 'binary operator':<br>
<br>
-delegate([<br>
    %% pass the generated/target function name<br>
    %% in front of the input arguments<br>
    {args, ['$T', '$I']},<br>
    %% let the generated function(s) have a different arity<br>
    {arity, 2},<br>
    %% generate functions with/for each of these names...<br>
    {delegate, [<br>
           "eq", "gt",<br>
           "gteq", "lt",<br>
           "lteq", "like",<br>
           "contains", "starts_with",<br>
           "ends_with", "matches", "path_exists"<br>
    ]}]).<br>
binop(Op, Axis, {{_,_,_}, _}=Literal) -><br>
    binop(Op, Axis, {literal, Literal});<br>
binop(Op, Axis, Literal) when is_integer(Literal) orelse<br>
                              is_float(Literal) orelse<br>
                              is_list(Literal) orelse<br>
                              is_record(Literal, semver) -><br>
    binop(Op, Axis, {literal, Literal});<br>
binop(Op, Axis, {literal, _}=Literal) -><br>
    {Axis, {operator, Op}, Literal}.<br>
<br>
<br>
None of this would be possible without the awesome parse_trans library, so<br>
a big thank you is due to Ulf for that really killer tool! Roadmap for<br>
0.0.3 is mainly runtime module/code changes via parse_trans_mod.<br>
</blockquote>
<br>
<br></div></div><div class="HOEnZb"><div class="h5">
-- <br>
Using Opera's revolutionary e-mail client: <a href="http://www.opera.com/mail/" target="_blank">http://www.opera.com/mail/</a><br>
</div></div></blockquote></div><br>