<https://i.imgur.com/NluduIk.png> any way i can wo...
# announcements
l

https://i.imgur.com/NluduIk.png

any way i can work around this problem ? i want to be able to instantiate
Y
with either a
String
or an
X
d
Since you can't rename constructors you can't use
@JvmName
here. You could use
operator fun invoke
in a companion object to simulate the syntax
l
ty
l
Value classes don't exist after compilation. Therefore, both constructors will have the same parameter type (String). The point of value classes is to not have generic parameters type like String to avoid improper usage. Ideally, you should keep only the constructor taking X if possible.
l
ik, but this is a special case where i want to be able to use both the value class or the underlying type directly
🆗 1
k
isn't this smell?
☝️ 1
hm maybe it would be smell otherway around
l
definitely a smell, but i think its a necessary evil