Re:Your Code Might Not Need State
by giovannibonetti on Tuesday March 28, 2023 @06:35AM
(#35338500)
That is exactly the premise of a pure functional programming language like Elm.
Full stack Elm would be nice, but there’s also F#, OCaml, Haskell that can all do more.
Re:Your Code Might Not Need State
by stevewodil on Tuesday March 28, 2023 @05:56AM
(#35338159)
The Frontend local data store is essentially what a lot of state management libraries offer. Look at how you store and dispatch changes in something like redux.
I think this type of pattern (not necessarily redux specifically) is definitely the future of Frontend state if it’s not already the current paradigm
Re:Your Code Might Not Need State
by chrisweekly on Tuesday March 28, 2023 @07:59AM
(#35339350)
It is already the dominant paradigm.
React: f(State) => UI
Redux: (State, Action) => newState
How does inference fit into this?
inference?
This is how most web frontend and backend development was done for a couple decades, with PHP which (conceptually) starts a new interpreter instance for each request, and discards all state afterwards (and before PHP there was PERL and other cgi-bin scripts that actually started a new process each time), and HTML pages that lose all state on every page transition. If anything, the currently popular state of having very little request isolation inside nodejs servers and long-running SPAs is the anomaly. And at least on the server side this didn't come about from a desire to have more state, it's just an accidental side effect.
That’s a wasteful approach though. Ideally you want your auth, validation/parsing, routing, db connection etc. all ready to go when a request comes in. There are parts that ought to be stateless and parts that shouldn’t.
Re:Your Code Might Not Need State
by HervalFreire on Tuesday March 28, 2023 @10:55AM
(#35342098)
That future is already here. All WebApps abstract state to some external program.
Bare in mind this is only for web dev.
Many other things outside of web dev cannot abstract state so easily. For example: The person who programs the database itself must deal with state.
We will still have state, just it will live only in data stores (like Postgres) or infrastructure components (like Kafka). Most dev work will be writing declarative code for manipulating and providing access to such systems.
I even think this will reach front end development, where the UI is an access layer to a local datastore.