how do you disambiguate function calls

also, can you disambiguate between these two:
fn __mul__(self, other: MY_SIMD[type,1]):
// splat multiply
fn __mul__(self, other: MY_SIMD[type,simd_width]):
// flat multiply
...

MY_SIMD[type,1]*MY_SIMD[type,1] // error: ambiguous call to '__mul__'
fn __mul__(self, other: MY_SIMD[type,1]):
// splat multiply
fn __mul__(self, other: MY_SIMD[type,simd_width]):
// flat multiply
...

MY_SIMD[type,1]*MY_SIMD[type,1] // error: ambiguous call to '__mul__'
i can call it splat_mul() instead
5 Replies
Helehex
HelehexOP2y ago
it works for builtin simd maybe uses one function? implicit cast splat from SIMD[type, 1] to SIMD[type,simd_width] MLIR stuff?
Moosems/Three Chickens
There’s no way for the compiler to determine which one you’re attempting to call, that’s why it’s ambiguous.
Helehex
HelehexOP2y ago
how does mojo do it
Moosems/Three Chickens
There’s plenty of things they do that users can’t do right now (take the Tuple as an example) but I guess this is probably a question for @Jack Clayton.
Jack Clayton
Jack Clayton2y ago
I'm not sure what's happening here, can you show me what type and MY_SIMD implementations look like?

Did you find this page helpful?