|
|
|
|
|
by lukego
924 days ago
|
|
My impression is that this comes down to expectations. You might have a function: foo(x,y) = x + y and multiple dispatch means you can call that with integers, or floats, or arrays, or GPU-resident arrays, or automatically-differentiating numbers, or symbolic algebra terms, or... Just because you can, does that mean you should? It depends... |
|
foo(x::Number) = x+1
And then someone else creates a new type thats a subtype of Number. And they run foo(x) and get errors or unexpected output.
Problem is the new type they created doesn't follow the assumptions that foo expects. Throw multiple dispatch into the mix and it gets even harder.