Live data from Hacker News

Pipelining might be my favorite programming language feature

herecomesthemoon.net

21–30 of 360 posts

Re: Pipelining might be my favorite programming language feature

#21

The tidyverse folks in R have been using that for a while: https://magrittr.tidyverse.org/reference/pipe.html

And base R has had a pipe for a couple years now, although there are some differences between base R's |> and tidyverse's %>%: https://www.tidyverse.org/blog/2023/04/base-vs-magrittr-pipe...

Re: Pipelining might be my favorite programming language feature

#22
I personally like how effect-ts allows you to write both pipelines or imperative code to express the very same things.

Building pipelines:

https://effect.website/docs/getting-started/building-pipelin...

Using generators:

https://effect.website/docs/getting-started/using-generators...

Having both options is great (at the beginning effect had only pipe-based pipelines), after years of writing effect I'm convinced that most of the time you'd rather write and read imperative code than pipelines which definitely have their place in code bases.

In fact most of the community, at large, converged at using imperative-style generators over pipelines and having onboarded many devs and having seen many long-time pipeliners converging to classical imperative control flow seems to confirm both debugging and maintenance seem easier.

Re: Pipelining might be my favorite programming language feature

#23

The tidyverse folks in R have been using that for a while: https://magrittr.tidyverse.org/reference/pipe.html

I've always found magrittr mildly hilarious. R has vestigial Lisp DNA, but somehow the R implementation of pipes was incredibly long, complex and produced stack traces, so it moved to a native C implementation, which nevertheless has to manipulate the SEXPs that secretly underlie the language. Compared to something like Clojure's threading macros it's wild how much work is needed.

Re: Pipelining might be my favorite programming language feature

#24
I'm personally someone who advocates for languages to keep their feature set small and shoot to achieve a finished feature set quickly.

However.

I would be lying if I didn't secretly wish that all languages adopted the `|>` syntax from Elixir.

```

params

|> Map.get("user")

|> create_user()

|> notify_admin()

```

Re: Pipelining might be my favorite programming language feature

#25
post #19

data.iter() .filter(|w| w.alive) .map(|w| w.id) .collect() collect(map(filter(iter(data), |w| w.alive), |w| w.id)) The second approach is open for extension - it allows you to write new functions on old datatypes. > Quick challenge for the curious Rustacean, can you explain why we cannot rewrite the above code like this, even if we import all of the symbols? Probably for lack of > weird operators like , , $, or >>=

Extension methods to the rescue: https://en.wikipedia.org/wiki/Extension_method

Examples:

https://kotlinlang.org/docs/extensions.html

https://docs.scala-lang.org/scala3/reference/contextual/exte...

See also: https://en.wikipedia.org/wiki/Uniform_function_call_syntax

Re: Pipelining might be my favorite programming language feature

#27

While the author claims "semantics beat syntax every day of the week," the entire article focuses on syntax preferences rather than semantic differences. Pipelining can become hard to debug when chains get very long. The author doesn't address how hard it can be to identify which step in a long chain caused an error. They do make fun of Python, however. But don't say much about why they don't like it other than showi…

I think you may have misinterpreted his motive here.

Just before that statement, he says that it is an article/hot take about syntax. He acknowledges your point.

So I think when he says "semantics beat syntax every day of the week", that's him acknowledging that while he prefers certain syntax, it may not be the best for a given situation.

Post reply on HN