That's what PTYs are.
> Instead, what happened is the whole thing gets reimplemented
No, that's a feature. The fact that you can use "neutral" OS services in different ways is a good sign. They provide PTYs and others build Screen, Tmux, dtach, ... and I'm sure others have come up with creatives uses for them too.
> in user space two levels deep (one for your GUI terminal emulator, then once again for the TUI terminal emulator you run inside that—either tmux or screen
I don't think so. We have GUI terminal emulators because there isn't much terminals around anymore, so the second "level" is accidental, not essential.
As for the first "level", this is the VT100 (or something like that) specification, which is used by tons of other programs, not just Tmux and Screen.
Furthermore, the greatness of separating "levels" is that I can run those programs from anywhere. For instance, Windows Putty + GNUScreen allows me to temporary use my Windows machine which is next my Linux machine as a second screen.
If I wanted to do the opposite (use my Linux machine as a second screen for my Windows machine), I think the solution would probably a lot more heavy, or simply impossible given how old is this machine.
> So I don't understand how anyone could be passionate about it, except maybe to passionately question why we're fine with continuing to do things this way, instead of stepping back and after a sober thought concluding that this whole thing is pretty silly
In fact, at day-job I work with 3 Linux servers. I have a screen session for each, each in one full screen terminal window on its own virtual desktop. All this from a 15 years old machine running a Mandrake so outdated that I can't update it anymore (don't ask).
This software you call "silly" provides a lot of services for very cheap. From network failure protection to session sharing. Not acknowledging this is the silly thing, if you ask me.
The uglier part is that screen needs to communicate the UI state to a terminal emulator. Theoretically, you could have screen expose an API and have a client-side GUI client directly display a UI, and that is even probably a good idea (I'll like a Qt tmux client that can talk to a remote tmux with JSON over SSH), but nobody bothered to implement it yet, and a "VT100 over serial" client can be used without running new software at the "user endpoint".
Telnet was just a protocol for serving whatever you'd get by connecting to the serial port, but multiplexed and over IP. Users got PTYs for their "session" and then login(8) was [usually] invoked.
Then, we got IPSec, to layer your telnet PTY tunnel inside an encrypted tunnel.
But SSH kind of turned things inside-out: it encapsulated a PTY inside an auth'ed login session which it managed itself, inside a carrier (e.g. TCP) which it also managed itself. It threw out the whole PTY-as-session concept (with PTY-managed-by-a-shell job control with Ctrl+Z, multiple PTY's-stdout writers to watch background jobs, etc.), creating its own sessions in the form of SSH "channels", and allowing the user to invoke arbitrary programs on the remote (with its own sshd_config specifying what is allowed) rather than handing off to the centralized PTY "terminal server" of login(8) to decide what to do with this session based on its origin device.
Until SSH, screen(1) and tmux(1)—and script(1) and nohup(1) and watch(1) and... were all just "enhancements" you'd run on top of a PTY as basically different shells that manage the PTY's jobs differently. Like different desktop environments manage windows differently. They might use additional PTYs to do this, but it was an implementation detail, and even then mostly only a hack—added later, not in the original designs—to ensure libcurses programs would work inside these.
But with SSH, since you lost the single encapsulating PTY session-group concept, we now saw things like tmux(1) and screen(1)'s PTYs as multiple root sessions. Now it was more like SSH was the terminal server, and screen/tmux was virtual desktops. Completely different paradigm, losing the thread of what PTYs were "for" in the process.
In a way, but ptys both don't do the "UI state" thing well, and don't do the "server" thing well - you can't really "take over" the controlling side of a pty easily.
> Now it was more like SSH was the terminal server, and screen/tmux was virtual desktops.
In the normal use of SSH+screen (`ssh -t foobaz screen -r`), SSH just tunnels the VT100-over-serial over the network, and provides the needed authentication and routing.
Are we talking about SSH? Because that's SSL, not ipsec.
The original point of SSH was that it didn't expect the client and the server to be part of the same administrative domain—i.e. it didn't expect a sysadmin to have been involved in advance to pair the devices and define a tunnel. This is why SSH's auth didn't, for the longest time, support any kind of centralized certificate-based PKI: it was for the cases where there wasn't a central authority in common, but rather just two peers that happened to want to talk securely—perhaps without the consent of their respective sysadmins; perhaps even despite the policies of their respective sysadmins.
SSH's "on the spot, look at my keys" auth has become so ubiquitous that sysadmins seem to have forgotten that, most of the time, they do control the administrative domain both devices are under, and can in fact just pair them using e.g. client certificates issued by a private X.509 CA. Fingerprint-based auth should be seen as a last resort, not a first resort; and, likewise, Telnet shouldn't be seen as a last resort, but rather a core tool serving a core purpose in a layered design: enhancing a "local-equivalent" (LAN or VPN) IP link into being a PTY session, upon which any number of things can be run. (For example, "dial-in" MUDs, of which a number still exist.)
"The terminal" ... isn't. A TTY is a device, not an application. A terminal emulator provides access to an emulated terminal, and the beauty of screen and tmux is that you can drop these on any emulator (xterm, rxvt, konsole, gnome-terminal, xfce-terminal, etc., etc.) and have it Just Work. Or run either outside or inside (or both, if you're a masochist) an SSH session.
For another example of such modularity, there's rlwrap, a readline wrapper. If you're used to the functionality of readline integration with your shell (bash, korn, zsh, etc., etc.), and suddenly find yourself using a tool that lacks this (Oracle's client comes to mind), you have the option of wrapping the command in a utility which offers that missing functionality.
There's something to be said for modularity.
Another is that if screen, or tmux, offers a feature set you prefer, you're welcome to use whichever better suits your needs (or muscle memory).
We could be using an app-centric XML-like language¹ for the UI, and an app-centric protocol versus a stateless² one where we apply hacks like cookies and WebSockets to. Instead we're hacking on top of a document-oriented system, and the hacks feel like they're 10 layers deep now.
¹ Similar to XAML or XUL, in concept and example.
² Statelessness is a great default, but when you need it, it shouldn't be an awful hack.
All of those things are significantly different than a mainframe/term setup
And there's a fair bit of truth to that.
It's not actually true (unicode alone is a big improvement), but even if it was, so what? If a technology already fulfilled those needs pretty well, why would you expect major improvements to arise? The improvements come from the fact that you don't have to restrict yourself to text and labels.
Maybe not, but you certainly shouldn't expect a regression, which is exactly what we're witnessing.
You can: just write a C# or whatever app, and use some stateful protocol.
In any case, I find the whole "layers deep" to be a major overstatement. WebSockets are essentially framed TCP sockets, with a single initial handshake that looks like HTTP. They are not a "layer" over HTTP or anything like that.
Graphical IDEs moved the idea of a session away from terminals, and the ephemeral nature of containers discouraged attaching sessions to them at all.
So things like screen and tmux are now popular only with a niche crowd. Granted, it's one that has strong representation here on HN.
I warmly recommend xpra, although it is another screen/tux/not-a-builtin
But it does allow one to attach to running X applications, unlike screen or tmux.
What I'm talking about is running an IDE as a server and being able to connect to the same session e.g. from different machines which do not run a copy of IDE.
Imagine running all the real-time code analysis tools on a beefy corporate server while the editor component runs on your laptop. Imagine attaching to someone else's session to collectively debug a problem or review code, right in the IDE. Imagine your laptop losing connectivity / running out of power, being reconnected and recharged, and connecting right back to the IDE that never lost its state. Imagine running the IDE, or parts of it, in preconfigured and isolated containers / VMs.
I've occasionally had X crash. After waiting for my desktop to reappear, I can reattach to my dtached DVTM session, spawn new emacsclient windows and be back to exactly where I was. The main application I use which doesn't do this is my browser, which is tied to the X session.
I do all of this locally, but at an old job I had to use a Windows desktop. Since we had Linux servers for development, I used them to run emacs-server. Each day I'd boot my Windows machine and use Cygwin/X to spawn a fresh Emacs window, picking up right where I left off the previous day. Just make sure to avoid GTK+ for the GUI, since there's a longstanding bug which prevents reattaching after an X server quits. I just used the Lesstif GUI instead.
The alternative, and maybe a better way to do this, is a FUSE-like system, like Expandrive. Lazily fetches files from remote.
> The most mature usage scenario that eclim provides, is the running of a headless eclipse server and communicating with that server inside of vim.
Kernel development is much harder, and in-kernel applications increase the attack surface area of kernels.
EDIT: One important aspect of the difference in development difficulty of user- vs. kernel-land is that we would not get as much diversity of solutions if they had to be in-kernel.
I beg to differ. These aren't an end-run around anything, but rather a continuation of a long-standing tradition of isolating terminal events from processes. The fact of existence of a multi-variate number of tools to modify the application-execution environment shouldn't really be a critical point in ones evaluation; this is like complaining about window managers existing, because no true window manager exists.
Most systems programmers are bought all the way into the Unix/worse-is-better mindset and are too afraid to ever question whether things could be designed with proper abstractions.
That's fairly arrogant. Have you ever considered that we simply looked at the alternatives, observed the hell that followed, and beat a hasty retreat to well-tested abstractions that have withstood generations of change? It's not like nobody's ever tried anything else: NT, Haiku, parts of Darwin, various experimental research systems... really, if you want the anti-unix, go use Microsoft's stuff. OLE, COM, etc; nothing's a file, everything does more than one thing (poorly), they gave up on the legacy of teletype long ago.
But no, we're not huddled in the corner afraid of the world because our stuff sucks so terribly, we're relying on simple, composable layers because everything else breaks when you try to scale it up.
There are systems which take the good parts of the Unix philosophy (composability, uniformity) but abandon the bad parts (text, hierarchical files, mutability, the name based permission model, etc.).
There are various research crowds such as the FP and capabilities people are usually at the forefront of this but the research to production cycle is very long since Unix is entrenched. In my experience a lot of systems programmers are reactionaries and make this cycle longer than it should be, but that is the subjective part.
These two terminal multiplexers are really an end-run around unfulfilled wants in the way that the console subsystem should work by default. Want to be able to arbitrarily detach from a session? Well, then we should have OS-level APIs exposed that allow for that. Instead, what happened is the whole thing gets reimplemented in user space two levels deep (one for your GUI terminal emulator, then once again for the TUI terminal emulator you run inside that—either tmux or screen). And we've hobbled along on top of that for decades.
To me, this is strongly reminiscent of software hematomas that Kiczales writes about. So I don't understand how anyone could be passionate about it, except maybe to passionately question why we're fine with continuing to do things this way, instead of stepping back and after a sober thought concluding that this whole thing is pretty silly.
http://pbfcomics.com/comics/skub/