https://kotlinlang.org logo
a

Alexey Anufriev

02/25/2020, 10:34 PM
hi guys, I develop a DSL, one of the methods I have called
to
inside
TuplesKt.class
there is also
to
method and in practice when I test the DSL my method is not resolved but the one from
stdlib
how ot overcome this?
d

dam5s

02/25/2020, 11:19 PM
If when you import it it is not directly accessible and replacing the
to
from the standard library, then I'm afraid you'll have to find another name for it.
a

Alexey Anufriev

02/26/2020, 12:26 AM
hacky way would be to hide
to
using imports and aliases, I can import
to
as
toKt
and then my
to
will be resolved
k

Kroppeb

02/26/2020, 1:48 AM
Yeah, although a nice feature,
to
was a very poorly choice to construct a
Pair
. Makes it very difficult to use it in any DSL. On top of that,
Pair
doesn't really convey a conditionality like
to
does unless you are using it in the creation of maps.
l

lucasqueiroz

02/26/2020, 3:42 AM
You could use backticks in the methods name, and call it with them too. Not the most beautiful option but it works
2 Views