Hacker News new | ask | show | jobs
by strbean 2063 days ago
Seems like a big part of why shells are so much better for certain tasks is because of a failing of more general purpose languages. Working with the filesystem, spawning processes, and orchestrating io streams. Shells could almost be considered DSLs for these things, plus some session / state management.

So I think a good question is this: why can't we make these things equally easy to do in a more general purpose language?

2 comments

Because on the shell side you want simplicity and on the programming side you want control. Shell pretty much has to default to "foo" meaning "execute command foo from $PATH" or almost every line will have useless overhead. GP language needs to make that explicit or it will be a footgun where you don't know what's a command / variable / function. And that's before we get into how the file descriptors / redirects are handled.

One shell which tries to merge those is ipython with the sh profile https://ipython.readthedocs.io/en/stable/interactive/shell.h...

TCL, Powershell, and Rebol are probably the closest I've seen in this area.