On Oct 12, 5:26 am, John Tamplin <
j...@google.com> wrote:
> That also assumes you control the other type, for example "int" or "num" in
> the case of adding a scalar to a point, as you need to define Point
> num.addToPoint(Point p).
Which does imply monkey-patching int (not a good idea as is evidenced
in ruby and various builtin prototype overriding JS frameworks like
Prototype).
I've got mixed feelings about overloading, and I know it can be a pain
to implement. I do think though that a simple, optional, opt-in,
builtin multi-dispatch mechanism would be beneficial. You can still do
the other things like typeswitches and double dispatch, but at least
you had a quick way to do dispatches without much fuss.