NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
Tex – Use Elixir like a scripting language, across your system (github.com)
thesuperbigfrog 1232 days ago [-]
Very nice!

However, I would recommend a different name to prevent confusion with Donald Knuth's TeX: https://en.wikipedia.org/wiki/TeX

kelsolaar 1232 days ago [-]
Not only that but the executable file is called tex which would break when you have a LaTeX distribution on your system:

  Kali:~ kelsolaar$ tex
  This is TeX, Version 3.14159265 (TeX Live 2019) (preloaded 
  format=tex)
  **^C
ellisv 1232 days ago [-]
It’s been a long time since I’ve used it but breaking my TeX is a non-starter for me
dboreham 1232 days ago [-]
Finally a use case for Unicode filenames.
generalizations 1232 days ago [-]
Good luck typing it into your terminal.
ezoe 1231 days ago [-]
As a Japanese, I type it with IME in any day.
boogies 1232 days ago [-]
That’s what X’s Compose key is for (`setxkbmap -option compose:sclk && xcape -e 'Shift_L=Multi_key'`; tap Left Shift, e, e → ə; Left Shift, x, x → ×).
generalizations 1231 days ago [-]
I mean, sure, there's plenty of ways to get the intended character/glyph into the terminal; but I really hope that we don't start doing that regularly as is implied above.
nextaccountic 1232 days ago [-]
It was just renamed to Teex:

> 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?

ganafagol 1231 days ago [-]
From the page:

> FYI: This was renamed from "Tex" to avoid confusion with TeX -- This project is now called Teex!

Maybe adjust the HN title?

mikl 1232 days ago [-]
Yeah, this was my first thought too, name is bound to cause problems and confusion.

Very cool idea, though.

1232 days ago [-]
1232 days ago [-]
doawoo 1232 days ago [-]
Hey all! Thanks for all the enthusiasm for this little hacky tool. I'll be working on renaming the cli tool to 'teex' soon to avoid conflicts with TeX.
fake-name 1232 days ago [-]
I wanna say, compared to a lot of the name conflict drama I've seen in the past, this was handled gracefully and with aplomb.

A+

jnsie 1232 days ago [-]
Fair play for being so receptive to feedback!
codezero 1232 days ago [-]
Maybe don't sweat it. I keep a bookmark folder with all the threads on HN where the primary form of comment is complaining about the name.

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 :)

vcxy 1232 days ago [-]
I think you're not realizing how ubiquitous TeX, and the executable `tex` are. It seems like a bad idea to overlap with something so commonly already installed.
codezero 1231 days ago [-]
Wow yeah you really got me there. Let me check my geek credentials, nope, don’t have any, guess I wasn’t working for Red Hat in 1999. Dang, gee, gosh, you got me kid.

I’ve worked in tech 25 years, worked in academia and published research in peer reviewed journals. I’ve never used tex in anger, and I know anyone who could, could also figure out how to run two binaries with the same name in their environment.

Please, abandon your misdirected dogma, and do some fucking work.

rio517 1231 days ago [-]
This is a unnecessarily harsh response. Those credentials are great for you, but I'm not sure they add too much to the conversation.
codezero 1231 days ago [-]
Neither did the low effort comment that didn’t finish reading my previous one, nor did it explain new information about how tex is a bad name. The entire point of this thread was that just saying it has the same name isn’t really helpful.

All that said, yes, it was harsh and needless, thanks for calling me out, we can all be better.

vcxy 1231 days ago [-]
I did make it to the end of your comment. Your comment presupposed the reason us nerds (how is this an insult on HN of all places?) didn't think the name was a good idea was searching and branding. I was saying my problem with it was overlapping executable names. This wasn't new information in the comment section as a whole, but judging by your comment it seemed to be new information to you.

It makes sense that you wouldn't use TeX at Redhat, but as a professional mathematician, I've never met anyone in math who doesn't use it. Different fields use different tools.

> we can all be better

Sure, but I didn't, and won't, directly attack you or your work. My sin was 1) omitting that it is ubiquitous in mathematical sciences in particular, and 2) simply not realizing you already knew the info about the executable name I brought up and just didn't care. Since you didn't even mention the only part I cared about with the name I thought it was new information for you. Show some charity.

codezero 1231 days ago [-]
It’s tough to put all the context out there - obviously I’m guilty there too - I don’t even think searchability is a real reason, and overlapping executables are a thing but still not that tricky for most folks who are using a CLI.

I’m mostly annoyed with how every time something like this happens lots of people just comment on the name and not the substance of the project, it’s such a huge distraction.

I studied solar physics but my PIs were in their 70s so all drafts were reviewed in MS Office. I would have liked to have a reason to use something more classy, but that’s how it goes.

I appreciate your reply, and I apologize for being an asshole. I’ll take this with me as I try to be less of an asshole going forward, if you search my history it may look like I never learn, but I’m always trying :)

At work someone got annoyed with the phrase assume good intentions, and proposed an alternative: ask compassionate questions. I’ve been thinking a lot about this and I will try to do that next time I start making assumptions or before I blow my lid on a stranger, and it shouldn’t matter that you’re obviously a decent person, but I still appreciate it.

vcxy 1229 days ago [-]
Thanks for the thoughtful reply. On the original topic, I actually think we agree for the most part. On the slightly broader topic of people complaining about names too much in general, I totally agree. I have a bad habit of pitting my self against all sides of internet debates (like I said above, I'm a mathematician, and that totally extends to my personality in some fairly stereotypical ways).

> ask compassionate questions

I like that! One of my favorite online communities formed around a blog where the first post explicitly talked about the principle of charity, but it's not always obvious how to actually follow through with the idea. This is a really good way to do it.

doawoo 1232 days ago [-]
I don't mind renaming it. It didn't cross my mind initially that it would be a problem.

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.

rio517 1231 days ago [-]
Valid.
bigbassroller 1232 days ago [-]
As far as the name goes, how about adding an extra ‘e’ to have it spelled Teex? Indpired by .eex file extension.
doawoo 1232 days ago [-]
This might be my favorite suggestion!
klocksib 1232 days ago [-]
Ha, bravo for changing the name so quick! I must confess, I clicked on the link, then read the comments and was super confused about the hubbub as it was called Teex, and not Tex. Cool project, hope you are able to keep it up!
michaelpb 1232 days ago [-]
Looks cool, but as others said you need to change the name. TeX is a fairly well known language + tool that beat you to that name!
QuinnWilton 1232 days ago [-]
I love this, and I'm excited that you've finally released it!

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!

andy_ppp 1232 days ago [-]
There is a huge problem with this sadly, the startup time of the BEAM is too much! I was thinking about having a running VM process and injecting code directly, but I think this could be quite insecure. Love the idea though.
doawoo 1232 days ago [-]
Totally understandable concern, in my quick experiments I haven't been bothered too much by the bootup time. But there's definitely better performance aware solutions for scripting
GlennS 1232 days ago [-]
Powershell suffers from this same problem, and I find it very annoying.

Really recommend you speed this up if it's possible.

andy_ppp 1232 days ago [-]
What is the startup time compared to bash?
sususu 1232 days ago [-]
I haven't test, but IIRC, Jose Valim in an interview commented that the BEAM startup time is about 300 to 500 milliseconds
elcritch 1232 days ago [-]
You could spawn independent actors for each invocation. That provide a degree of separation and be fine for secuirty, if the beam process was run as your user pid. Handling multiple stdin/stdouts would take some work, but doable with standard erlang libraries.
toast0 1232 days ago [-]
ok on my pentium G3470 running FreeBSD 12.2:

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 :)

andy_ppp 1231 days ago [-]
Nice that you’ve managed to speed it up quite a lot! Still it’s fairly slow, that’s why I was thinking about streaming stuff to a running BEAM from a Golang executable, say. Presumably then this problem goes away (compilation may still take a while). I guess if the #! just streams the file content over we are still protected by the execution bit, but what about malicious programs streaming their own content?
toast0 1231 days ago [-]
You could do something like that, but it adds a lot of complexity. I suspect if I can get the time down to 75 ms with a frw minutes of fiddling, someone who actually cares to run this could spend a couple hours or days on it and get it down to 30ms, which should be tollerable. Reduce as much runtime startup as possible (probably allocator tuning), and then reduce or postpone as much OTP startup as possible.

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.

bostonvaulter2 1232 days ago [-]
But would that be more insecure than running arbitrary scripts on your machine? I imagine you could build something akin to Ruby's spring for elixir, might be interesting.
hprotagonist 1232 days ago [-]
neat tool, godawful name. it’d break most of my pdf making tool chain if it was permitted to come first in my PATH.
rbonvall 1232 days ago [-]
Worst name since "cat", my command-line tool for creating cat memes :o)
enriquto 1231 days ago [-]
Please, tell me more!
owyn 1232 days ago [-]
So how about "exit" as in Elixer It :)
wwweston 1232 days ago [-]
If it were me, I would not be able to pass the opportunity to use the most meta extension ever: .ext
clankyclanker 1232 days ago [-]
That’s still better.
doawoo 1232 days ago [-]
Hey there! Author here. Good point! The name I was never super locked in on. Considering new ones for sure!
Jarwain 1232 days ago [-]
Could call it "eli" for elixir line interface :D

It does conflict with an APL derivative, but it appears hardly used

dejj 1232 days ago [-]
Eli also conflicts with this compiler construction toolkit: http://eli-project.sourceforge.net/
hprotagonist 1232 days ago [-]
cheers! i look forward to giving it a spin, then.
bigbassroller 1232 days ago [-]
Elixir’s ability’s to be used as a scripting language due to compile time has been one of its few weakness IMO against other languages such as Python and Go. Will be interesting to see if this changes the game.
nickjj 1231 days ago [-]
Does this get around the issue of the BEAM taking a while to spin up?

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.

simongray 1231 days ago [-]
> Does this get around the issue of the BEAM taking a while to spin up?

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

methyl 1231 days ago [-]
That’s awesome! The only other painpoint of using Elixir for ad-hoc script is terrible IEX experience.

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.

lkuty 1232 days ago [-]
That's cool, thanks. I always create dummy projects to be able to quick test a library or develop a few lines of code in the REPL and wished I could test them without doing a "mix new". Even better than that is the ability to script with libraries.
29athrowaway 1232 days ago [-]
There is already TeX, the typesetting system.

https://en.wikipedia.org/wiki/TeX

etxm 1232 days ago [-]
It’s already been renamed Teex.

Chill.

Otherwise this is awesome. Ruby and python have been my goto for years. Excited to have elixir as an option.

1231 days ago [-]
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 18:05:59 GMT+0000 (Coordinated Universal Time) with Vercel.