Zac Sweers
05/31/2018, 6:49 PMdata class Foo(val bar: String, val baz: String = "baz")
// somewhere later
val bazValue = getBazValue() ?: Unset
Foo(
bar = "bar",
baz = bazValue
)
Unset
(name could be something better) could be a marker to indicate that you want to defer to the default value. Similar to Unset
. Then you could denote that a value is undefined and basically pretend the argument was never setbenleggiero
05/31/2018, 10:50 PMdefinedExternally
. I bet this wouldn't be too much of a challenge. I love this ideaZac Sweers
05/31/2018, 11:42 PMnwh
06/02/2018, 12:16 PM