As a means of learning Elixir I decided to 'port' the Jade compiler I wrote to the new beam VM language.
I was never really thrilled with the Jaderl compiler I created, partly I think because it generated Erlang source which then had to be compiled. I always intended to cut out that intermediate form, but it looked to me that Elixir had much cleaner internals and it would therefore be easier to generate beam bytecode directly.
This turned out to be exactly the case and the new compiler works beautifully. I have not yet extended it to add any new capabilities, but it works fine as a stand-alone Elixir application and working with Elixir is a joy, so I do intend to enhance this version and support it as a production-ready component of CB (which it never really was before - nor claimed to be).
Now the tricky part . . . integrating it into the CB environment.
My first step was to change boss_template_adapter_jade.erl to call 'Elixir.Jadelix':compile, rather than jaderl:compile.
However, on performing 'make' there is some problem (though no message) compiling Jadelix itself, because no .beam file is produced and as a result, compiling a jade template gives:
<pre>
ERROR: pre_compile failed while processing /home/graeme/projects/egolf/dev/jadelix: {'EXIT',
{undef,
[{'Elixir.Jadelix',compile,
["src/view/hello/about.jade",jadelix_view_hello_about_jade,
[{out_dir,"ebin"}]],
[]},
{boss_template_adapter_jade,compile_file,3,
[{file,
"src/boss/template_adapters/boss_template_adapter_jade.erl"},
{line,19}]},
{boss_load,'-load_views_inner/3-fun-1-',5,
[{file,"src/boss/boss_load.erl"},{line,404}]},
{boss_load,load_views,3,[{file,"src/boss/boss_load.erl"},{line,395}]},
{boss_load,'-make_all_modules/3-fun-1-',3,
[{file,"src/boss/boss_load.erl"},{line,84}]},
{lists,map,2,[{file,"lists.erl"},{line,1237}]},
{lists,map,2,[{file,"lists.erl"},{line,1237}]},
{boss_load,load_all_modules,3,
[{file,"src/boss/boss_load.erl"},{line,62}]}]}}
</pre>
I compiled Jadelix elsewhere and copied in the .beam file by hand, but when it is used to compile a jade template it raises an error trying to access the Elixir IO module.
<pre>
ERROR: pre_compile failed while processing /home/graeme/projects/egolf/dev/jadelix:
{'EXIT',
{undef,
[{'Elixir.IO',puts,[<<"Opening file ${filename}">>],[]},
{'Elixir.Jadelix',add_file,3,[{file,"lib/jadelix.ex"},{line,187}]},
{'Elixir.Jadelix',compile,3,[{file,"lib/jadelix.ex"},{line,88}]},
{boss_template_adapter_jade,compile_file,3,
[{file,
"src/boss/template_adapters/boss_template_adapter_jade.erl"},
{line,19}]},
{boss_load,'-load_views_inner/3-fun-1-',5,
[{file,"src/boss/boss_load.erl"},{line,404}]},
{boss_load,load_views,3,[{file,"src/boss/boss_load.erl"},{line,395}]},
{boss_load,'-make_all_modules/3-fun-1-',3,
[{file,"src/boss/boss_load.erl"},{line,84}]},
{lists,map,2,[{file,"lists.erl"},{line,1237}]}]}}
make: *** [compile] Error 1
</pre>
I assume that the Elixir modules are not loaded. I have followed the steps for allowing Elixir use in my application and not sure what to try next.
Any thoughts?
g