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 level.

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.

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to