Hmm, well a def is just a macro that takes the body and creates an AST to pass to the module body, it itself does nothing (and this is why you cannot def something in the REPL), and the defmodule call just takes its whole body and passes it to the internal elixir call that creates a new module. Even just a single line of code unless entirely self contained (no imports or aliases or so) seems very difficult to just ‘run’, especially considering how the environment can be transformed around it with macros..
Would it not be easier just to run an iex session of the project and execute them that way? That is what I do, combined with a real-time code reloader it makes it pretty trivial to do?


















