M
Modular9mo ago
sora

How to disambiguates the call to `f`?

Consider the following code:
trait A: ...
trait B: ...

@value
struct S(A, B):
...

fn f[ty: A](s: ty): ...
fn f[ty: B](s: ty): ...

fn test():
let s = S()
f(s)
trait A: ...
trait B: ...

@value
struct S(A, B):
...

fn f[ty: A](s: ty): ...
fn f[ty: B](s: ty): ...

fn test():
let s = S()
f(s)
What do I pass to f as the parameter? Named trait instance can be helpful here.
1 Reply
Aamir
Aamir9mo ago
Something like f[A](s) would be good!
Want results from more Discord servers?
Add your server