Is ELM pass by reference or pass by value?

Viewed 188

I'm playing around with ELM, and I wanted to clarify whether it is pass by value or pass by reference. Any thoughts on this?

2 Answers

As Markus said, everything is immutable in Elm, so you don't really need to be concerned about reference vs value.

Conceptually, everything is passed by value and references do not exist. Compiled code will however pass references around because it's faster and because that's just what JS does. The situation might change when/if Elm starts compiling to WASM or other languages.

In a language like Elm where everything is immutable, there is no difference between pass by value and pass by reference.

Related