alpaca-lang / alpaca

Functional programming inspired by ML for the Erlang VM
Other
1.44k stars 48 forks source link

Compiler doesn't generate module_info/0,1 functions #6

Closed erszcz closed 8 years ago

erszcz commented 8 years ago

This is easily spotted when trying to TAB-complete functions available in an mlfe module:

4> M1.
{compiled_module,basic_adt,"basic_adt.beam",
                 <<70,79,82,49,0,0,1,176,66,69,65,77,65,116,111,109,0,0,0,
                   36,0,0,0,6,9,...>>}
5> code:load_binary(element(2, M1), element(3, M1), element(4, M1)).
{module,basic_adt}
6> basic_adt:<tried hitting TAB here>*** ERROR: Shell process terminated! ***

=ERROR REPORT==== 1-Jul-2016::11:41:45 ===
Error in process <0.62.0> with exit value:
{undef,[{basic_adt,module_info,[],[]},
        {edlin_expand,expand_function_name,2,
                      [{file,"edlin_expand.erl"},{line,54}]},
        {group,get_line1,4,[{file,"src/4.1.1/group.erl"},{line,568}]},
        {group,get_chars_loop,8,[{file,"src/4.1.1/group.erl"},{line,462}]},
        {group,io_request,5,[{file,"src/4.1.1/group.erl"},{line,181}]},
        {group,server_loop,3,[{file,"src/4.1.1/group.erl"},{line,117}]}]}
Eshell V7.2  (abort with ^G)
1>

M:module_info/1,2 are actually thin shims which call erlang:get_module_info/1,2 which both already work with mlfe modules. I can provide a PR implementing generation of the shims - what do you think?

j14159 commented 8 years ago

I'd be quite happy to have a PR for that. Thanks very much for catching this!

erszcz commented 8 years ago

Since the PR is ready, I'll close this issue.