Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Elixir macros are nothing like C/C++ macros. Instead of working on strings, they are something like compile-time Elixir functions that are called in the middle of parsing, and work on the abstract syntax tree (AST), which is a code represented as Elixir data structure. Macro can work on AST, and spit out some alternative AST that represents the generated code.

The description above from the article seems like closer to the Lisp macros. I have not programmed in Elixir yet.

Can someone who knows comment on the similarity here?



Technically Elixir is really close to a Lisp-2. It is not a real lisp as it is not homoiconic. But it is not far and the macros are heavily inspired from Clojure.

Elixir in general is probably close to Clojure than Ruby in its internals. And well Erlang of course.


Yeah, it's like Lisp macros. Actually, Elixir code is AST+sugar as https://hexdocs.pm/elixir/syntax-reference.html shows.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: