Is it possible to have Elixir check a script's syntax without executing it?
I ask because I just had a problem editing an Elixir script. I'm using Vim with the Syntastic syntax checker; it somehow calls out to Elixir to find syntax errors.
In my script, I defined a function and immediately called it, so that when I ran `elixir myscript.exs`, I would see the output. At one point, every time I saved the file, my editor would hang. Eventually I tried running my program using `elixir myscript.exs`, and realized I had an infinite recursion problem. The syntax checker was running the script and having the same problem.
I would much prefer not to have my editor hang when checking such a script's syntax; I can discover the infinite recursion more easily from the command line and it won't screw up my editing session.
I wondered if there was a flag I could pass to elixir to say "only check the syntax", but I didn't see it when running `elixir --help`.
I am accustomed to this working in Ruby. For example, if I have this Ruby script:
=====
# foo.rb
def foo
loop { puts "going forever..." }
end
foo
=====
...running `ruby -c foo.rb` will tell me the syntax is OK but will not execute the infinite loop.
Besides convenience, this might be a safety concern; if my script had done anything dangerous, I would have been very sad to find that simply by saving the file, I had executed it.