[erlang-questions] Rebind transform in Erlang 21 and Hygienic macro
Xavier Wang
weasley.wx@REDACTED
Wed Nov 28 09:48:46 CET 2018
Hi,
I use the rebind[1] transform for create Hygienic macro.
[1]: 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20181128/c8c0b65e/attachment.htm>
More information about the erlang-questions
mailing list