4 ms·
> Objects are bags of functions, not bags of data. That is just silly. I'd be willing to swallow the following revised version, in the context of immutable pro
by kazinator 8y ago
> Objects are bags of functions, not bags of data.
That is just silly. I'd be willing to swallow the following revised version, in the context of immutable programming: "classes are bags of functions, not bags of data."
An object (class instance) is then just a datum which serves as a domain value to these functions. Given that domain value, each function in that bag-of-functions class produces a range value: and that bag of range values comprises the properties of the object.
Under traditional mutable OOP, those functions are impure in ways that logically require the object-datum to carry a representation of state somehow.
And anyway, since functions are data (being first class values), any bag of functions is necessarily a kind of bag of data.