is there any way to bypass using a built-in infix ...
# announcements
f
is there any way to bypass using a built-in infix function for a specific statement (ie: I'm using a library that has a "to" function and it's always using Kotlin's "to" to create a Pair)?
p
Maybe this will help?
import <http://foo.to|foo.to> as myTo
f
can't do that unfortunately, the "to" is a member function (and the lib isn't in Kotlin)
l
AFAIK, you must import Kotlin's
to
for it to work. Maybe you can import it as another name?
f
don't think so, it's defined as
public infix fun <A, B> <http://A.to|A.to>(that: B): Pair<A, B>
so I can't really import it
p
Can you give more details or example? You say that there is a member function
to
and when you try to call it, extension function
to
is called? This should not happen as member function is always winning agains extension function.
f
oh nevermind I'm dumb, there's no
to(other: T)
function on the serviceBinder, so it's defaulting to using the
<http://A.to|A.to>
function for tuples. Still kinda confusing though
p
it is not “for tuples” 🙂 it is extension function for any type 🙂
f
yeah that's what was confusing me, I assumed that the serviceBinder had a
to
function with the same signature so it should have used that one, but apparently HK2 is inverted compared to Guice (
bind(instance).to(class)
instead of
bind(class).to(instance)
). Or maybe I just need more coffee 😛 Thx for the help though!