Tex – Use Elixir like a scripting language, across your system
github.com
github.com
However, I would recommend a different name to prevent confusion with Donald Knuth's TeX: https://en.wikipedia.org/wiki/TeX
Kali:~ kelsolaar$ tex
This is TeX, Version 3.14159265 (TeX Live 2019) (preloaded
format=tex)
**^CVery cool idea, though.
> FYI: This was renamed from "Tex" to avoid confusion with TeX -- This project is now called Teex! The GIFs below might still mention tex -- just replace that in your commands with teex
@dang can you rename the title of this submission as well?
> FYI: This was renamed from "Tex" to avoid confusion with TeX -- This project is now called Teex!
Maybe adjust the HN title?
A+
It's a pastime here, and it's a great way to provide a low effort comment that the community will upvote.
In reality people don't google search for the name of a tool they already know, and if folks are looking for a scripting language for their system, they'll find it via Google, not some already-known-to-nerds name.
That said, tex is short, and overlaps with a lot of stuff not even nerdy, so teex will probably help set you apart until the fanboys of some other obscure project called teex come to the party :)
I want developers to have quick and frictionless tools when trying to hack out ideas. That was the main idea behind Teex anyways!
If it makes someone's life easier, I've happily ctrl-f'd my code, retired the old Hex package, and published the new one.
One of the biggest issues I run into with using Elixir as a scripting language is the difficulty of making use of libraries in a REPL without first installing them into a Mix project. Sometimes I really just want to open up a shell that has access to my HTTP client + JSON parsing library of choice, and until now, my workaround has been using a Mix project that I toss everything into.
I'm very excited to dive through the code and see how you've implemented everything!
Really recommend you speed this up if it's possible.
time /bin/sh -c "echo hi" hi
real 0m0.003s
user 0m0.000s
sys 0m0.003s
time /usr/local/bin/bash -c "echo hi"
hi real 0m0.006s
user 0m0.000s
sys 0m0.006s
time /usr/local/lib/erlang23/bin/erl -eval 'io:format("hi~n"), exit(0)'Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [dtrace]
hi
{"init terminating in do_boot",0}
init terminating in do_boot (0)
Crash dump is being written to: erl_crash.dump...done
real 0m0.304s
user 0m0.117s
sys 0m0.010s
Ok, so 300 ms is clearly too much, but that's running a bunch of stuff.Turning a bunch of stuff off, I get
time /usr/local/lib/erlang23/bin/erl -eval 'io:format("hi~n"), halt(0, [{flush, false}])' -noshell -start_epmd false -boot no_dot_erlang hi
real 0m0.077s
user 0m0.094s
sys 0m0.008s
(I tried tuning down the number of schedulers, but couldn't get the real time lower)This is still a lot worse than bash, but about 75 ms is sort of okish. Maybe a non-stock boot file could help. I usually plan for my BEAMs to run for months or years, so I don't worry too much about startup time :)
Otherwise you have to deal with things like how do you kill one script without killing the others, version fun including what happens if you are running scripts and update the beam, how to keep scripts separated for reals, etc.
It does conflict with an APL derivative, but it appears hardly used
One nice thing about Python and Bash is for the most part when you run a script you can see the output almost instantly.
With Elixir, typically you end up having to wait half a second or longer while the VM boots up. It makes a very noticeable difference in practice.
I'd be interested in hearing the answer too.
One of the things that has held back Clojure's adoption as a general-purpose CLI scripting language has been the cost of JVM + Clojure bootstrapping. It's not long in the grand scheme of things, but 1 second matters a lot when chaining commands in the shell. There is now a CLI scripting version of Clojure that gets around this issue by running Clojure (and some bundled libraries) as native code through Graalvm native-image: https://github.com/borkdude/babashka
Canceling a line that you made mistake in is nearly impossible without loosing the whole existing context, pasting multiline pipelines is a no-go. I hope that iex on par with irb will become reality someday.
Chill.
Otherwise this is awesome. Ruby and python have been my goto for years. Excited to have elixir as an option.