[RFC] Using erlang constants/macros

42 views
Skip to first unread message

Jean Parpaillon

unread,
Aug 21, 2018, 11:45:17 AM8/21/18
to elixir-lang-core
The quaff project (https://github.com/qhool/quaff) allows importing erlang headers (.hrl files) into an elixir module.

macros are imported as module attributes and can be (optionally) exported as 0-arity functions.

I've updated the code (https://github.com/jeanparpaillon/quaff) to behave more like `import` statement and add missing features:
- added `only` and `except` options to whitelist / blacklist imported macros
- quaff can now parse deferred definitions. For instance

```
-define(FOO, ?BAR).
-define(BAR, 42).
```
which is valid in erlang but was raising error in upstream quaff.

Would you be interested in including this library in mainstream elixir ? It would complete the Record module for better erlang / elixir compatibility.

Best regards,
Jean Parpaillon

José Valim

unread,
Aug 21, 2018, 1:59:23 PM8/21/18
to elixir-l...@googlegroups.com
Hi Jean,

Unless there is something broken in our interface with records, I believe this is perfectly fine as a library. It is not a very common use case and users can reach out to your library if they need it. :)

Thanks for pinging!



José Valim
Skype: jv.ptec
Founder and Director of R&D

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/67ba2900-3eef-407f-a46d-6a010c36c610%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages