Follow

Unix shell vs JavaScript 

Unix shell vs JavaScript 

Show thread

Unix shell vs JavaScript 

Show thread

Unix shell vs JavaScript 

Show thread

@bugaevc anyone who would argue that Unix shell is better OR worse than JavaScript is making a stupid argument

@sir if you're saying that they have a different purpose, you're right — but that doesn't change the fact that shell is being used as a scripting language oh so often, and it's terrible at it.

@bugaevc @sir I would say "shell is being used as an actual programming language so often and it's terrible at it" ;)

@bugaevc it's not bad at what it's designed to do: manipulate text, and pass text to and from different programs. Maybe with a little bit of logic mixed in.

@bugaevc really I don't know of anything better than shell scripts for that purpose

@sir that's my issue though: whenever I want to glue some programs together I reach for shell scripting; but then I discover I need sane types like lists and maps and sets and lists of lists, so I switch to Python, but then it's awkward to shell out to those other programs.

Why oh why isn't shell a better programming language :(

@bugaevc you could always mix in a little bit of awk. awk is underutilized imo

@bugaevc @sir Shell has vastly nicer syntax, is by all reasonable definitions a Lisp, is only slow if you're using a terrible, non-compliant shell, and doesn't actually have a difficult syntax to understand.

AT&T had their secretaries using it in the 1980s, and if secretaries can understand it, anyone should be able to. There are only like five things you actually need to learn to learn the underlying principles of it.

@kick @sir I guess beauty is in the eyes of... developer, but I find shell syntax pretty ugly (all those "esac"s and ";;"s and "$@"s).

And honestly, it's not like being a Lisp is a good thing (unless it's Emacs Lisp 😉).

I don't get what "compliance" has to do with performance, but what I meant is JavaScript is run by highly optimized JITs whereas the shell is all about spawning many processes and shoveling data around through pipes by copying it into kernel space and back.

@bugaevc @kick esac is clever and therefore good, hack the planet

@bugaevc @sir The entire existence of Javascript is based in one (mostly incompetent) dev trying to get Scheme (a Lisp) in his browser but messing it up and getting a monstrosity. Dissing Lisp in a discussion where you're defending Javascript is like dissing C in a discussion about C++: where do you think all of the tolerable parts were stolen from?

"esac" is from the Bourne Shell, which stole it from ALGOL-68, which is perhaps the most influential language in computer science, ever.

bash is a non-compliant POSIX shell. bash is slow because of the non-standard additions. Most people who insult the shell have only used a non-compliant shell.


You say "highly-optimized JITs," but I think about how the shell ran fast on PDP-11s yet V8 and IonMonkey (Firefox's JIT) both struggle on the low-end laptops of today.

@kick @sir
I'm not defending JavaScript, that's a ridiculous assumption. I'm saying that as a programming language, shell is even worse, but that fact goes curiously unnoticed by most, even those who vocally criticize and make fun of JavaScript.

I know about shell's relation to ALGOL; but that doesn't make the syntax any nicer.

@kick @sir Could you expand on your claims that GNU Bash is not POSIX compliant? I believe it tries to be, especially if you run it as /bin/sh. And why do you believe that it's specifically extensions over what POSIX requires that slow "non-compliant" shells down? In any case, I was specifically not referring to any particular shell, so pick whichever one you think is most compliant/performant.

@kick @sir Shell runs fast as long as you only use it to glue other fast programs together (which is after all its intended purpose). Imagine how "fast" those monstrous "web apps" would be if they were to write them in shell instead of JavaScript.

Unix shell vs JavaScript 

Unix shell vs JavaScript 

Unix shell vs JavaScript 

re: Unix shell vs JavaScript 

Unix shell vs JavaScript 

Unix shell vs JavaScript 

Unix shell vs JavaScript 

Sign in to participate in the conversation
Mastodon for Tech Folks

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!