Open j14159 opened 7 years ago
https://github.com/rvirding/lfe/blob/develop/src/lfe_macro_record.erl might be of interest here. Basically it takes record definitions and generates make-
and match-
macros (which we don't need in Alpaca) as well macros for getting all fields, and getting and setting individual fields. The compiler could desugar r.x
to get_rec_x r
.
At the moment we can only access members of records via a pattern match but we need to be able to do
I think this will require rewriting the AST in or before the code generation stage to put a pattern match up front, e.g. in Erlang: