3 ms·
> to me the term "value" only makes sense in a mutable context - if the variable can't be mutated, it is it's own value I'm so confused by this haha. A value
by DonaldPShimoda 7y ago
> to me the term "value" only makes sense in a mutable context - if the variable can't be mutated, it is it's own value
I'm so confused by this haha.
A value is a term in a language's grammar that cannot be further reduced by the semantics of that language.
In some OO languages, objects may be values but functions or types may not. (Though this has been changing lately as more OO languages are getting on board with higher-order functions, for example.)
In most FP languages, functions and types are also values. In the lambda calculus, two out of the three possible terms are values. In the pi calculus, types become values (and, therefore, values become types).
This is where I was going with my previous comment: FP languages tend to have a wider variety of "values" than the OO languages, which instead just have lots of extra core forms in the language that don't directly translate to the values of the language's semantics.