Skip to content

Instantly share code, notes, and snippets.

@krestenkrab
Created August 19, 2013 20:26
Show Gist options
  • Save krestenkrab/6273690 to your computer and use it in GitHub Desktop.
Save krestenkrab/6273690 to your computer and use it in GitHub Desktop.
Sample run of Elixir on Erjang.
krab$ ./bin/iex
ej -env ERL_LIBS :/Users/krab/Projects/elixir/bin/../lib -noshell -user Elixir-IEx-CLI -extra --no-halt --erl -user Elixir-IEx-CLI
Warning: could not run smart terminal, falling back to dumb one
Interactive Elixir (0.8.2.dev) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
:erlang./(1, 0)
:erlang.apply/2
erl_eval.erl:572: :erl_eval.do_apply/6
elixir.erl:133: :elixir.eval_forms/3
server.ex:19: IEx.Server.do_loop/1
:erlang.apply/2
error_handler.erl:42: :error_handler.undefined_function/3
:erlang.apply/2
iex(1)> :"java.util.Date".new().toString()
"Mon Aug 19 22:23:53 CEST 2013"
iex(2)>
@krestenkrab
Copy link
Author

Things to notice:

  • Just replace erl with ej in the bin/elixir script and you're go
  • The JVM doesn't let us run the tty driver, so we're stuck in a "dumb shell" (i.e. no line editing)
  • Exceptions work -- including line numbers!
  • You can call out to Java.

@gburd
Copy link

gburd commented Aug 19, 2013

awesome! is that R16?

@krestenkrab
Copy link
Author

Now it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment