5 ms·
> The "UNIX philosophy" is good, it's just that UNIX doesn't really follow it. It never did, beyond some examples in beginner books. > Look at `cat` for examp
by lispm 11y ago
> The "UNIX philosophy" is good, it's just that UNIX doesn't really follow it.
It never did, beyond some examples in beginner books.
> Look at `cat` for example. It might as well be `str + str...`. Or look at `grep`, it's basically `filter` or `reduce` at heart.
Then look at the options of `cat`. On my Linux system cat has a -n option, which numbers the output lines. If it were following the 'UNIX philosophy', this option would not exist.
- qwertyuiop924 11y agoUNIX may have been about small commands ("cat -v", anybody?), but its most important property is COMPOSABILITY. You could use small programs to build larger programs, allowing you to do things by gluing together code that you would previously have to write new programs to do. It made this very easy, and you could also do it from within C, so it wasn't an either/or situation. This is something your namesake system could have learned to do. The Right Thing isn't always the right thing.
- pjmlp 11y agoThat was already available in Xerox PARC systems, by making use of function call composition in Interlisp-D REPL, Builders in Smalltalk transcript or live debugger in Mesa/Cedar. The UNIX composition is only a novelty for those that never saw other OSes that surfaced at the same time. After all UNIX just adopted the idea from MULTICS.
- dllthomas 11y ago"The UNIX composition is only a novelty for those that never saw other OSes that surfaced at the same time. After all UNIX just adopted the idea from MULTICS." One could certainly chain programs through intermediate files. My understanding has it that pipelines were new in Unix, and Wikipedia agrees: "The pipeline concept was invented by Douglas McIlroy and first described in the man pages of Version 3 Unix."
- pjmlp 11y agoYes the concept was popularized by UNIX, but anyone that spends time doing computer archeology will find similar patterns in other OSes, like the ones I listed. Don't forget that back then computing was developed in silos, with knowledge only shared at conferences or when researchers switched universities/companies. So it was quite common that researchers across the globe would come up with similar discoveries.
- qwertyuiop924 11y agoBut pipelines made it convenient, and the shell made it language-agnostic. One or the other was lacking in your other examples.
- dllthomas 11y ago"On my Linux system cat has a -n option, which numbers the output lines. If it were following the 'UNIX philosophy', this option would not exist." Gnu's not Unix. "The GNU coreutils version of this on my Linux box behaves this way" is not a good way of getting at finer points of what is or is not Unix-y. That said, -n exists in BSD cat as well. It's not required by POSIX, though.
- klibertp 11y agoMy thoughts exactly. There are implementations of cat which don't have '-n' option: http://git.suckless.org/sbase/tree/cat.c http://plan9.bell-labs.com/sources/plan9/sys/src/cmd/cat.c Not only "Gnu's not Unix", it's also not that much interested in following "Unix philosophy". Which isn't that bad, from a user perspective: users want more capable tools, even if it impedes composability a bit.