Astronaut4449
12/27/2021, 4:39 PMto
from the stdlib and make it some encapsulated function of a map builder scope so that we can write:
val squared = mapOf { // this refers to some MapBuilderScope<K,V> with builder inference
1 to 1 // `to` is only visible in the `MapBuilderScope`
2 to 4
3 to 9
}
mcpiroman
12/27/2021, 4:52 PMAstronaut4449
12/27/2021, 4:57 PMmcpiroman
12/27/2021, 4:59 PMrnett
12/27/2021, 9:23 PMAstronaut4449
12/29/2021, 4:05 PMto
pollutes the global namespace and extends the Any?
type. Having a limited scope of to
inside a builder context would eliminate that issue imho.Joffrey
01/03/2022, 4:45 PMassociate
family. Also it would prevent things like map { a to b }.toMap()
(but more complicated) in cases where associate
cannot be directly used for some reason, and force people to use the Pair()
constructor manually. I'm not sure it's objectively better tbhAstronaut4449
01/03/2022, 5:18 PM