We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Understanding Simple State in Immutable Languages
33
clicks
Source: reddit.com
The article discusses the challenges of thinking about state in immutable programming languages, particularly through a specific example of a coin flip CLI. The author questions how to conceptualize simple state when every change results in a new state rather than modifying the existing one. In the comments, various contributors offer insights into handling state by treating it as an argument to functions, emphasizing that a process owns the state in Elixir, which ensures that only designated processes can read or modify it. They suggest that instead of changing states, one should create and pass new states, accommodating the functional programming approach prevalent in Elixir and similar languages.
Related posts
© HashMerge 2024