Value objects: roll your own?
brendan at mozilla.com
Sun Jan 12 18:21:18 PST 2014
Andrea Giammarchi wrote:
> I had same thoughts on being defined inside the class ... it's quite
> common out there but here I see it's very easy to create conflicts
> between classes.
> What if a generic point2d + point3d is defined in both point2d class
> and point3d one ?
The definitions need to be special forms, associated with one (if unary
operator) or two value classes -- if you include number as a value
class. Also, the value class declaration being memoized allows
cross-frame typeof equivalence for free. I forgot to mention this in my
> IIRC Python just consider it's own representation during one
> operation, not associating it with "the caller" of such operation ...
> actually, I've always been envious of these:
Value objects do not use double dispatch for dyadic operators, though.
More information about the es-discuss