Open Issues

(defun test2
((n r)
(let (((tuple 'rec v _) r));; this throws the same warning too even without record match
(set-rec r x (cons n v)))))
both test1 and test2 gives me a warning
this clause cannot match because a previous clause at line 11 always matches
```
Any idea where I did wrong?
Thank you

Currently LFE does not compile to Erlang but to Core Erlang. Core is a nice, more standard functional language used internally in the compiler and is quite close to core LFE. However, while you can actually write code in core and compile it (yes, you can) it is an internal language to the compiler.

While the syntax of core is relatively fixed and there is a module, cerl, for building its AST its meaning and how erlang is translated to it sometimes changes. A recent example was how boolean operators in guards were represented in core was changed and suddenly all LFE guard tests suddenly succeeded (it has been fixed).

So what would the effects of compiling LFE to Erlang instead of core?

Pro:

It would be easier and faster to adapt to newer versions of Erlang and add new features.

We would always get the latest features in the compiler.

Cons:

Guards would now become simpler tests like in erlang and not allow things like if and progn.

Records could now become much more a part of the base language and need some core LFE forms, though this may be fixable.

Erlang is in some ways a more restricted language than core.

Neither/both:

We would get a lot of features from the Erlang compiler for free like parse transforms at another level than today. This could be good but could cause some confusion.

Elixir compiler to erlang AST. I have understood that they intend to bypass the first passes in the erlang compiler, call the core generator themselves and call the erlang compiler with core. The erlang compiler is very=y open and allows you to do this.

There is an experimental github branch called erlang-ast which generates erlang AST. It would be interesting if people could test there code using this and then report back with the results to get some feel for problems which arise.