News for hackers. Stuff that matters.
Re:TC39 Pipeline Operator – Hack vs. F# by Smaug123 on Tuesday September 14, 2021 @05:12PM (#28531314)
Of course they don't have to. As I said, they encourage you to think in the object-orientation "encapsulate state and teach it how to mutate itself on demand" way, but you don't have to use them that way.
Re:TC39 Pipeline Operator – Hack vs. F# by LAC-Tech on Tuesday September 14, 2021 @05:30PM (#28531618)
I'm being somewhat obtuse here, but I've never understood that.

Why would I be more likely to mutate state in sending a message to an object than I would be applying a procedure to a struct? (or a function to a record, depending on your terminology)

Immutable objects are a very old and mainstream idea, I believe they're even talked about in Effective C++.

Re:TC39 Pipeline Operator – Hack vs. F# by Smaug123 on Tuesday September 14, 2021 @05:38PM (#28531716)
Long history and baggage of object orientation, I suppose. There's nothing inherently mutable about dot-notation (indeed, F# uses it for accessors on immutable records as well as for "proper" object-orientation), but lots of object-oriented languages use the dot for accessing objects, and lots of object-oriented idioms involve mutation. If you're going to send a message to an object, you do kind of expect something to happen, and that's often a mutation somewhere.

Having said that, I actually don't know the history of the dot operator in any depth (https://cs.stackexchange.com/questions/89031/what-is-the-ori... suggests it arose in Simula).

Re:TC39 Pipeline Operator – Hack vs. F# by Zababa on Tuesday September 14, 2021 @06:09PM (#28532136)
> Why would I be more likely to mutate state in sending a message to an object than I would be applying a procedure to a struct?

I think most people don't think about objects in terms of sending a message to them, but in terms of calling a method on them. OOP in JS, currently, revolves a lot around mutable objects. JS itself revolves a lot around mutability. Some people are trying to change that, at least by getting proper support for the alternative. The pipeline operator is part of that.

Re:TC39 Pipeline Operator – Hack vs. F# by nsonha on Wednesday September 15, 2021 @03:14AM (#28536186)
If you don't have state what do you need an object for? Would it make more sense to have a "free" function instead?