4 ms·
"I think there's a connection. Certainly in the early days of Unix, pipes facilitated function composition on the command line. You could take an input, perform
by camccann 17y ago
"I think there's a connection. Certainly in the early days of Unix, pipes facilitated function composition on the command line. You could take an input, perform some transformation on it, and then pipe the output into another program. (...) [The mathematical approach of function composition is] exactly what I mean. (...) I think [that mathematical formalism] was right there from the start. Doug McIlroy, at least in my book, deserves the credit for pipes. He thought like a mathematician and I think he had this connection right from the start. I think of the Unix command line as a prototypical functional language."
-- from an interview with Alfred Aho, one of the creators of AWK
http://books.google.com/books?id=yB1WwURwBUQC&lpg=PT120&ots=-BUH9ErkdB&pg=PT120#v=onepage&q=&f=false http://books.google.com/books?id=yB1WwURwBUQC&lpg=PT120&...
- pvg 17y agoIt's 2010, not the 'early days of Unix'. Yes there is a connection, a useful one, if you are sitting in front of a PDP-8. http://groups.google.com/group/comp.lang.functional/msg/84763c6d9185178b?dmode=source&hl=en http://groups.google.com/group/comp.lang.functional/msg/8476... http://regex.info/blog/2006-09-15/247#comment-3085 http://regex.info/blog/2006-09-15/247#comment-3085
- blasdel 17y agoI don't think unix pipes in the shell would be very useful to someone sitting in front of a PDP-8 The machine's panel switches are enough of a pain when programming in the absolute -- give a shell user a teletype at least!
- pvg 17y agoA bit of a hyperbole, granted. Pipes -> any kind of vaguely modern runtime (clojure? srsly?) is a profoundly nonsensical comparison though.
- barrkel 17y agoI don't understand your hostility to pipes. It seems to be based on the fact that they were invented some time ago? On the contrary, the soundness of an idea famous enough to be known today is probably positively correlated with how old it is. Pipes are a combination of dataflow programming and monadic computation, and are naturally parallelizable, functional and generally pipe processes don't share mutable state. All these concepts are highly relevant to modern programming.
- Daniel_Newby 17y agopvg's dislike seems to be that pipes transfer a stream of octets with no inherent syntax or semantics. That means every program needs baroque options to impose structure, which is difficult to create, maintain, and debug. Also brittle.
- barrkel 17y agoAnd on the other hand, text streams are easy to work with, because ad-hoc tools can be written to work with them, rather than having to wrestle with strongly typed libraries and being constrained to languages compatible with the libraries that define those types. Imagine a web written using CORBA RPCs over rendering APIs, rather than HTML over HTTP. You can argue that HTML has inherent syntax and semantics, but of course server and client can have slightly different ideas, and it all still works, mostly. The same is largely true of shell programming using pipes: different stages in the pipe expect certain formats, for regular expression or field extraction, and format pasting together, etc. The format is easy to eyeball and easy to test on the shell REPL, so in practice the problems aren't large.
- pvg 17y agoI think my hostility was more towards the posted article than pipes.