Hacker News new | ask | show | jobs
by _nothing 1980 days ago
Yeah, I went on to read that post and also didn't quite understand their reasoning.

It seems to me that one of the benefits of the pipe operator is that it very clearly lays out the steps involved, aka

  x
  |> maybe_function()
  |> final_function()
so that the code is dead-simple and clear. It doesn't seem nested in the say way that final_function(maybe_function(X)) is.

Granted, I don't have nearly the level of experience of the author so I can't say for sure, but it seems to me like they just haven't had enough experience with the pipe operator to see how it benefits the code "beauty".

1 comments

Tbh I like both the erlang style and the Elixir style and don't see a _tremendous_ amount of difference, e.g.

    foo(X) -> 
        Y = maybe_function(X),
        final_function(Y).

Both, in my eyes, yield a declarative flow without mutations and overwriting variables