Skip to content
Permalink
Browse files

## Generating Artifacts

While our execution-by-compilation works, it’s really nothing more than an on-the-fly evaluation. We’re not generating any compilation artifacts that can be re-used later, or deployed elsewhere.

We can fix that by moving our code into a module. Once we compile our newly modularized `application.ex`, a new `Elixir.Minimal.Application.beam` file will appear in the root of our project.

We can run our compiled Elixir program by running `elixir` in the directory that contains our `*.beam` file and specifying an expression to evaluate using the `-e` flag:

	➜ elixir -e "Minimal.Application.start()"
	Hello.

Similarly, we could spin up an interactive shell (`iex`) in the same directory and evaluate the expression ourselves:

	iex(1)> Minimal.Application.start()
	Hello.
  • Loading branch information...
pcorey committed May 6, 2019
1 parent 4e2e319 commit f36703771756c1d149a58584e242c0e4d6ce607e
Showing with 6 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +5 −1 lib/minimal/application.ex
@@ -1 +1,2 @@
*.beam
.DS_Store
@@ -1 +1,5 @@
IO.puts("Hello.")
defmodule Minimal.Application do
def start do
IO.puts("Hello.")
end
end

0 comments on commit f367037

Please sign in to comment.
You can’t perform that action at this time.