Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Making a Compiler to Prove Tmux Is Turing Complete (willhbr.net)
88 points by willhbr on March 17, 2024 | hide | past | favorite | 12 comments



The moment you think your configuration language needs loops or conditionals, drop it and just throw a scripting language on there. Your users will thank you.


I actually wrote some thoughts about this a few months ago [0]. tmux actually does a really good job in this regard, the config language is fairly simple, and if you want to do more complicated things you just shell out and then use the CLI which is great because it exposes all the things you can do in a config file.

[0]: https://willhbr.net/2024/01/18/the-code-config-continuum/


I often read this, and I'm not sure I agree always. From the final user point of view, sure, give me a known language and don't make me learn a new config format for each program. 100% Agree.

But, now, let's go with examples from another view point:

Let's say there are different levels of support teams in an infra, and you (root) make a custom tool, so other teams can run something (and only that thing).

And that thing, has a config file. I don't want to give sudo to lua, I want to give sudo only to my tool.

It's like if we say "Don't provide the final user with a User Interface, just let them connect to the database as admin so they can do everything by themselves"

In this case, doesn't apply (sudo tmux == sudo bash).

Or another point of view:

tmux is 981K on my system, adding... lua? for the config, could increase it's size by maybe at least 30%? It's not the same to add an scripting lang to a 230GB game, than to every little tool.

Depending on context, an scripting language is ok. However, not always as a rule of thumb.


If you’re going to make this jump from YAML to something with a little control constructs, your users will thank you if you go straight to a 3Lisp with full metasyntactic capability.

It’s the most user friendly thing you could do.


> It's like if we say "Don't provide the final user with a User Interface, just let them connect to the database as admin so they can do everything by themselves"

There's a big big difference to the user here, people who use tmux are power users.

> And that thing, has a config file. I don't want to give sudo to lua, I want to give sudo only to my tool.

Understandable, but tmux itself has run, which forks to /bin/sh, so what's your pick? /bin/sh and everything that entails? or a scripting language with built-in sandboxing?

> tmux is 981K on my system, adding... lua? for the config, could increase it's size by maybe at least 30%? It's not the same to add an scripting lang to a 230GB game, than to every little tool.

Binary size wise, sure, its an increase, but the resulting binary size would still be less than a hello world static binary written in go.

Also, there are more scripting languages than lua, there's jimtcl, guile and a couple of obscure ones.


Implied by “loops” but wanted to also point out self-referential definitions / recursion


Yup. At a previous employer we had a "loop until [list] is empty" in our interpreter. This list would be appended to by any recursion in the interpreted language (effectively saying "this recursion also needs to be processed")

We joked that it was our very own proof that recursion and iteration are equivalent


Isn't that what ATS is all about?


I mean, the tmux author kinda did. You can just execute sh inline, or execute external sh scripts. I do this with my config to do some neat things.


See also:

https://news.ycombinator.com/item?id=30189780 - Accidentally Turing-Complete (2022-02-05)


Insert mandatory "Can it run doom?" joke


Well, technically it can!

> tmux -c $DOOM




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: