Why isn't the pipe a construct that has caught on in 'proper' languages?
For the Love of Pipes
21–30 of 323 posts
Re: For the Love of Pipes
#22i think the unix pipeline concept doesn't quite scale to other domains that try to exchange a different unit of information between the pipeline elements.
Re: For the Love of Pipes
#23Why isn't the pipe a construct that has caught on in 'proper' languages?
It is! It's the main way of programming in lazy functional programming languages like Haskell And many programming languages have libraries for something similar:. iterators in rust / c++, streams in java/c#, thinks like reactive
Iterators don't really fully capture what a pipe is though? Theres no parallelism.
And streams don't have the conceptual simplicity of a pipe?
Re: For the Love of Pipes
#24Earlier quoted context omitted.
redirect your feelings to /dev/null, because a pipe will just give us a Permission denied
Chmod +x /dev/null (havent tried above, not sure I recommend that you do)
Re: For the Love of Pipes
#25Why isn't the pipe a construct that has caught on in 'proper' languages?
Re: For the Love of Pipes
#26Why isn't the pipe a construct that has caught on in 'proper' languages?
Re: For the Love of Pipes
#27If only there was some standard format to interchange structured data over pipes, other than plain text delimited with various (incompatible) combinations of whitespaces, using various (incompatible) escaping schemes.
That's one of the design goals of Powershell, you don't pass streams of text between cmdlets, you pass objects, which have a type, properties and methods you can use in standard ways (they may also be strings)
Re: For the Love of Pipes
#28Why isn't the pipe a construct that has caught on in 'proper' languages?
It actually somewhat changes the way you write code, because it enables chaining of calls.
It's worth noting there's nothing preventing this being done before the pipe operator using function calls.
x |> f |> g is by definition the same as (g (f x)).
In non-performance-sensitive code, I've found that what would be quite a complicated monolithic function in an imperative language often ends up as a composition of more modular functions piped together. As others have mentioned, there are similarities with the method chaining style in OO languages.
Also, I believe Clojure has piping in the form of the -> thread-first macro.
[0] https://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasive...
Re: For the Love of Pipes
#29If only there was some standard format to interchange structured data over pipes, other than plain text delimited with various (incompatible) combinations of whitespaces, using various (incompatible) escaping schemes.