Nikky
11/15/2020, 11:40 AMget
.. would avoid some ugly hacks with let
or assigning intermediary variables
not sure if that would promote writing worse code and longer nullsafe call chains..ephemient
11/15/2020, 11:42 AM?.get()
ephemient
11/15/2020, 11:45 AM?[]
but I think it's pretty rare among languages overallNikky
11/15/2020, 12:00 PM[key]
and ?.get(key)
sometimes in the same line or function and the only difference is nullability of the receiver
it just takes some time to get used to reading code like that i guess.. or always using get
over []
andreasmattsson
11/15/2020, 12:23 PMget
when chaining multiple operations (regardless of nullability). And honestly for all operators (e.g. plus(x)
over +
etc), only using the operator form for trivial statements. Probably a matter of taste but that's what I've found most readable and is a simple rule of thumb to follow.