rahil627
Should Elixir replace Ruby for simple scripting?
I’ve been out of the computer world for ages. During those ages, I’ve got a bunch of ideas. I’ve chosen Phoenix/Elixir (over Flutter/Dart/Google) to prototype most of 'em quickly.
Although the core apps will be written using/in Phoenix/Elixir, I still find myself running to ruby for small scripts, cli apps, 'n such for more personal, smaller thingies, most of which ai does for me. After having gone through configuring every LSP (the “ruby” vs extension turned out to be the oldest; shopify’s extension for some reason wasn’t listed [dat archlinux life] and gave me troubles; solargraph works but requires extra steps), I wondered, maybe I should just use elixir for scripting everything too? In contrast, Elixir’s LSP worked perfectly on the first try. ![]()
does elixir make sense for small scripts? or does the functional-ness make it feel clunky or overkill? since there’s iex, I’m guessing there’s already an interpreter..
it makes sense to invest in one language/library, not two…
having made some tiny games (<3 haxe), I feel comfort in any non-functional object-oriented lang, but perhaps over-time, I’ll be able to think functionally and use elixir for scripting too?..
is everyone here writing their little everyday scripts in elixir? Were there times one even had to reach for ruby?
just wondering…
–
https://github.com/wojtekmach/mix_install_examples/tree/main
- this repo in particular is what won me over to Phoenix, as it comprises of minimalistic examples of frameworks (<50loc Phoenix app!)
(note: flaming not intentional, i want to love ruby too!
)
Most Liked
lud
I use Elixir for scripting all the time. Of course you don’t want Elixir for tools such as ls or tree or grep, and for tools that you want to start very fast (like a note taking CLI app for instance).
But for all custom scripts that have something to do with the filesystem, or call to HTTP Apis, the scripts are easy to write, to test and to debug.
If you are going to use that script only 100 times but spend 1 hour instead of 3 to write it then you win against the BEAM startup time. mix test take some time to start, but ExUnit is great, it’s worth it, and honestly it’s not that slow anyway.
dimitarvp
Scripting doesn’t have anything to do with it, Ruby and Python have bootstrapping time that I find unacceptable as well as Erlang’s / Elixir’s. They all need time to get going.
For scripting I use bash / zsh if it’s something quick / one-off, or reach for Golang if I suspect I’ll use the tool regularly and need logic that bash / zsh make difficult to code (and sadly they have a lot of foot guns).
It’s “per se” btw.
Many of us would wet their pants if the BEAM has CLI parameters that would allow it to boot much faster (maybe at the cost of initializing apps slower? no idea), trust me. There was a discussion some months ago about it and there were various options listed even by core Erlang maintainers but none of them truly helped.
AndyL
I’ve experienced two problems with elixir scripting 1) slow startup time 2) lack of ‘getch’. If neither of these matter to you, then Elixir is great for scripting! Check out Ratatouille a very nice TUI toolkit for Elixir.







