News for hackers. Stuff that matters.
Re:I Don't Use Classes by whlr on Thursday March 12, 2020 @12:04PM (#22558208)
> I find the latter easier to read and lends itself to a fluent, lightweight style.

Maybe I'm bikeshedding, but I think this is a nontrivial part of why people like OOP languages. Being able to read right to left, without nested parens, makes code comprehension easier.

I think the mathematical notation for function application has held programming languages back. I realize that there's a huge benefit to uniformity of syntax across languages, and that syntax is ultimately much less important than semantics, but I wish we could settle on something better than f(x). I really appreciate languages that are willing to do something different (e.g. haskell and lisp).

Re:I Don't Use Classes by smabie on Thursday March 12, 2020 @12:11PM (#22558280)
There's the pipe operator in a lot of languages (|>) to try and solve this problem, but it has always felt clunky to me. Compare:

f(g(h(x)))

x.h.g.f

x |> f |> g |> h

I think most people prefer the second one to all the rest.

Re:I Don't Use Classes by Udik on Thursday March 12, 2020 @02:15PM (#22559882)
I think the third example should be:

x |> h |> g |> f

Which is identical to the second, except for a more eloquent choice of the pipeline symbol?

Re:I Don't Use Classes by whlr on Thursday March 12, 2020 @11:03PM (#22564347)
That is the version of the |> operator I'm familiar with from Julia.