Value objects: roll your own?
andrea.giammarchi at gmail.com
Sun Jan 12 22:16:21 PST 2014
OK, you actually don't have to reply those question ... I am very looking
forward to put my hands on operators overloads. It feels to me almost as
exciting as binary data ... I'll be waiting patiently until it's shaped and
usable in some engine.
Thanks for all infos so far though,
On Sun, Jan 12, 2014 at 10:11 PM, Andrea Giammarchi <
andrea.giammarchi at gmail.com> wrote:
> what I meant is that you require('point3d') before requiring point2d .. is
> that a concern? Is that like the point4d coming along unexpectedly?
> On Sun, Jan 12, 2014 at 10:04 PM, Brendan Eich <brendan at mozilla.com>wrote:
>> Andrea Giammarchi wrote:
>>> "the call is ambiguous and an error is thrown" .. that's OK, but this is
>>> assuming you know upfront all libraries in the game, right?
>> No, this is just a matter of loading point2d's value class declaration,
>> then point3d's.
>> It's fine to have methods defined for various combinations, but defining
>> them twice, with different bodies even (different dynamic return types), is
>> an error.
>> Now, how about modules? Would this approach cause unknown possible
>>> conflicts all over?
>> It doesn't matter whether you put the value classes in modules or at top
>> I understand the Python approach might not solve this neither,
>> Double dispatch doesn't solve anything here, it requires writing
>> point2d.add and point2d.radd as well as the same for point3d, and
>> typecase'ing in all four on the other argument's runtime type. And then
>> you're stuck sending a PR, when point4d comes along.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss