mbonnin
11/04/2020, 10:31 AMemptyList<Value>
would behave differently than emptyList<Node>
?mbonnin
11/04/2020, 11:13 AMvalueList[0]
isn't valid. You could also think of concatening lists but even there, for concatening an empty list, the type argument isn't really important.
I guess what I'm leaning towards is some kind of special handling of empty list values by the compiler. It feels like there could be some help/special features there but that might as well be a rabbit hole of complexifying what is a good type systemDrew Hamilton
11/04/2020, 11:26 AMval valueList: List<Value> = value.children
if (valueList.isNotEmpty())
valueList[0].name
It’s probably undesirable for an implementation detail (use of emptyList
) to have an implicit effect on API signature, no?mbonnin
11/04/2020, 11:35 AMList<Node>
and I could always be more explicit if I really wanted a List<Value>
for this specific case. But maybe that has far reaching implications so I'm ok to having to explicit the signature all the time