3 ms·
> I'm not familiar with Dart but I believe the same applies to all the C-derived syntax languages Yes, you're correct. It's not a unique property of Dart, but
by munificent 7y ago
> I'm not familiar with Dart but I believe the same applies to all the C-derived syntax languages
Yes, you're correct. It's not a unique property of Dart, but it's an example of a case where the whitespace in your source code is important, even if you just use it as an input to the automated formatter.
> how about not adding another operator, but automatically choosing based on whether the type on the left is nullable?
We could do that, but that just kicks the problem down the road. It means the type of the surrounding expression would itself become nullable (because a null-safe subscript operator can always evaluate to null). So the user still has to handle it at some point. It's better to make them handle it at the first place that null can appear so that they know where it's sneaking into their code.