ProgrammerHumor

iCanFinallySleep

iCanFinallySleep
https://i.redd.it/z96a0uirlfdf1.jpeg
Reddit

Discussion

ChrisBot8

What are you talking about? Functional programming has state still, otherwise you wouldn’t be able to hold a website state. It emphasizes not mutating the state, but things like Redux exist specifically for functional state management.

10 hours ago
MajorTechnology8827
:hsk:

The point is to isolate the states and minimize their propagation. You want any statefulness to be confined into predictable, explicit boxes in a way that doesn't affect the purity and the soundness of the rest of the code

10 hours ago
skwyckl
:elixir-vertical_4::py::r::js:

Yes, state should be hyperlocalized and inaccessible to any process that doesn't need it. Global state is maddening to me.

9 hours ago
ChrisBot8

Yes, it is best to make state immutable in functional programming, but OPs meme is just wrong. Functional apps are still stateful, they just don’t mutate the state.

9 hours ago
OkMemeTranslator

The state should be isolated and most of the work you will do is on pure functions without state. Yes, some state still exists, but you don't work with it constantly. It's not at all unreasonable for one to think to themselves "no more state" when doing FP because the main work is state free.

That, or OP wants controversy to get the post going.

5 hours ago
No-Con-2790

How can you have a state when there is no mutable cell?

-laughs in Haskell

No but seriously, there is no hidden state since many "true" functional languages don't want you to reassign variables and therefore you can't just put the state in a hidden private member and forget about it.

7 minutes ago
ChalkyChalkson

Brings me to my current default style - functional oop. It's kinda the most natural style when you use machine learning libraries like torch. As long as a method doesn't mutate the state of the objects it's still a pure function, python even makes that explicit with the self parameter.

6 hours ago
skwyckl
:elixir-vertical_4::py::r::js:

It's rather you carry your state with you, from function to function. Sometimes, a class is nicer, and I am primarily a FP developer.

9 hours ago
ChalkyChalkson

Why not both? If the methods of a class don't mutate the state in place you're still dealing with pure functions.

6 hours ago
Smalltalker-80

Ah, your code does not run in the real world then?

1 hour ago
MoveInteresting4334
:rust::j::ts::py::hsk:

The one thing my anarchist friend and I agree on.

2 hours ago
bestjakeisbest

Something something when you touch the functional developer's PROstate

2 minutes ago