Rob Murdock
06/23/2020, 3:15 PMRob Murdock
06/23/2020, 3:16 PMRob Murdock
06/23/2020, 3:17 PMRob Murdock
06/23/2020, 3:20 PMRob Murdock
06/23/2020, 3:20 PMZach Klippenstein (he/him) [MOD]
06/23/2020, 3:24 PMMap
😛Rob Murdock
06/23/2020, 3:25 PMZach Klippenstein (he/him) [MOD]
06/23/2020, 3:28 PMCoroutineContext
is one, Compose’s Ambients is kind of another – they enforce key/value types match but not presence (i.e. compiler enforces that map[stringKey]
returns a String
, but not that that’s only a valid call after map[stringKey] =
)Rob Murdock
06/23/2020, 3:34 PMRob Murdock
06/23/2020, 3:35 PMRob Murdock
06/23/2020, 3:36 PMRob Murdock
06/23/2020, 3:37 PMZach Klippenstein (he/him) [MOD]
06/23/2020, 3:39 PMRob Murdock
06/23/2020, 3:43 PMRob Murdock
06/23/2020, 3:43 PMRob Murdock
06/23/2020, 4:16 PMMatteo Mirk
06/24/2020, 8:18 AMlol if maps remembered the individual type of each key and enforced it at the compiler level without a lot of extra ceremony… yes!maybe what you’re looking for is the Typesafe Heterogenous Container data structure or better the
SymbolMap
structure (described in the same article). It was originally described by Brian Goetz in Effective Java, but it’s easy to port it to Kotlin, I did it once as an afternoon project.Rob Murdock
06/25/2020, 1:37 PM