My first guess was to define a `fun Map<Any, An...
# announcements
r
My first guess was to define a
fun Map<Any, Any>.cast(value: RubyHash) = value.toMap()
. But this doesn't work.
a
you have a
LinkedHashMap
and need to turn it into a
RubyHash
?
r
The other way around. I have a
RubyHash
and need to turn it into a
LinkedHashMap
a
RubyHash
implements
Map
, is there a specific reason you need a
LinkedHashMap
?
r
Damn, I might have been blind when I've looked it up. Thanks
But just for the record. Would it be possible to define some smart casting to different types?
And the reason why I used
LinkedHashMap
is, that I need a fixed order in which the elements were put into the map
u
How would you want a cast like that to work. It would be possible to implement a mapper from one type to another? Casts don’t really change the type of something but rather makes it more concrete
a
@Ron K nope, no custom smartcasting or implicit casting in kotlin