[m-dev.] Unique Modes and Transaction Logic
paul at bone.id.au
Sun Jul 20 18:16:19 AEST 2014
On Sun, Jul 20, 2014 at 06:00:57PM +1000, Mark Brown wrote:
> Does OO necessarily entail side effects? The definitions of OO don't
> seem to mention it, but every major OO system has them. Perhaps this
> is only because they've chosen to use functional syntax for their
> method calls, and don't want to use up the single output in returning
> a final state?
I think this depends on your definition of an object. If this definition
says that an object has state, and state may be modified, then unless you
make the effect of modifying state part of a method's declaration (see effect
typing) then yes, class-based OO programming has side-effects.
Note that in prototype-based OO programming[2, 3] modifying an object creates
a new object rather than destructively modifying the existing object, so it
does not need to have side effects. IMHO prototype-based OO programming has
it's own issues, in particular whether a given object implements a given
method is not decidable at compile time, so it must be dynamically checked
rather than statically checked.
More information about the developers