i should probably be thoroughly shot down for this...
# language-proposals
h
i should probably be thoroughly shot down for this idea, but: casting maps to data classes or interfaces
Copy code
data class Foo(val foo: Int, val bar: Int)

val foo = mapOf("foo" to 1, "bar" to 2) as Foo
🤢 1
k
You can't overload casting, it has one well defined meaning for all possible situations already.
âž• 5
h
yeah, i've had the idea of allowing
as
to be an overloadable operator, but i believe there is precedent in similar languages like scala for why that is a bad idea and makes readability suffer
e
h
Yeah, I'm getting a brainflop today. Thanks.