<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello,<div class=""><br class=""></div><div class="">rebind macro looks like identity composition. You’ve trying to build either composition with that macro.</div><div class=""><br class=""></div><div class="">I am maintaining this and few other composition under category transform. Please check them out if they solve your problems.</div><div class=""><a href="https://github.com/fogfish/datum/blob/master/doc/category.md" class="">https://github.com/fogfish/datum/blob/master/doc/category.md</a></div><div class=""><br class=""></div><div class="">Shoot a questions/raise an issue if something is not clear. </div><div class=""><br class=""></div><div class="">Best Regards, </div><div class="">Dmitry<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 28 Nov 2018, at 10.48, Xavier Wang <<a href="mailto:weasley.wx@gmail.com" class="">weasley.wx@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class="">Hi,<br class=""><br class=""><div class="">I use the rebind[1] transform for create Hygienic macro.</div><div class="">[1]: <a href="https://github.com/camshaft/rebind" class="">https://github.com/camshaft/rebind</a><br class=""></div><div class=""><br class=""></div><div class=""> such as:</div><div class=""><br class=""></div>-define(CASE(Expr, A, B),<br class=""> try Expr of<br class=""> {ok, rebind(Result)} -> A;<br class=""> {error, rebind(Err)} -> B<br class=""> catch<br class=""> throw: {ok, rebind(Result)} -> A;<br class=""> {error, rebind(Err)} -> B<br class=""> end).<br class=""></div><div dir="ltr" class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">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?<br class=""></div><div dir="ltr" class=""><br class="">-- <br class="">regards,<br class="">Xavier Wang.</div></div></div></div>
_______________________________________________<br class="">erlang-questions mailing list<br class=""><a href="mailto:erlang-questions@erlang.org" class="">erlang-questions@erlang.org</a><br class="">http://erlang.org/mailman/listinfo/erlang-questions<br class=""></div></blockquote></div><br class=""></div></body></html>