[erlang-questions] Rebind transform in Erlang 21 and Hygienic macro

Dmitry Kolesnikov dmkolesnikov@REDACTED
Wed Nov 28 10:10:57 CET 2018


Hello,

rebind macro looks like identity composition. You’ve trying to build either composition with that macro.

I am maintaining this and few other composition under category transform. Please check them out if they solve your problems.
https://github.com/fogfish/datum/blob/master/doc/category.md

Shoot a questions/raise an issue if something is not clear. 

Best Regards, 
Dmitry

> On 28 Nov 2018, at 10.48, Xavier Wang <weasley.wx@REDACTED> wrote:
> 
> Hi,
> 
> I use the rebind[1] transform for create Hygienic macro.
> [1]: https://github.com/camshaft/rebind <https://github.com/camshaft/rebind>
> 
> such as:
> 
> -define(CASE(Expr, A, B),
>         try Expr of
>           {ok, rebind(Result)} -> A;
>           {error, rebind(Err)} -> B
>         catch
>           throw: {ok, rebind(Result)} -> A;
>                  {error, rebind(Err)} -> B
>         end).
> 
> then I can use ?CASE in A or B, each time macro expanded, the Result and Err will have a new name such as _Result_REBIND_1_, etc.
> 
> But this can not work on Erlang 21, because function call are not allowed in pattern with the new AST.  How can I get over it? Or are there any other way to implement the hygienic macro?
> 
> -- 
> regards,
> Xavier Wang.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20181128/dbb78dc3/attachment.htm>


More information about the erlang-questions mailing list