from me on the conditional conformance.
Forwarding to the wrapped value isn't the only way to conform Optional to Sequence. It might be the most obvious, but only by a little. You could also consider an Optional to be a sequence (Collection, even) of 0 or 1 values. See some prior discussions (split across two threads): Revisiting Optionals as Sequences & Revisiting Optionals as Sequences
Furthermore this could produce subtly surprising behavior — imagine you have let x: [[Int]]
. In that case Array(x.map { $0 + [] })
is a no-op. If during later refactoring x
becomes [[Int]]?
, suddenly Array(x.map { $0 + [] })
produces something completely different.