4 ms·
The null coalescing operator is nice, but it can be overused. I recently saw some Swift code that was riddled with question marks everywhere, which()?.made?.the
by EvenThisAcronym 11y ago
The null coalescing operator is nice, but it can be overused. I recently saw some Swift code that was riddled with question marks everywhere, which()?.made?.the?.code?()?.very?.difficult?.to?().read.
- WorldWideWayne 11y agoI wonder if it would be useful to have some kind of block scope for null coalescing? (Alternatively, why can't the programmer just specify the root coalesce and have the compiler figure out the rest?) Beyond that, I imagine the solution is to just bake null coalescing into the language somehow. Then maybe you'd want to have a block scope for non-null coalescing code.