4 ms·
There's a few more details in the linked mailing list post[0]: Exactly which statements should be included (certainly if and switch, any others)? Further, it
by jayrhynas 11y ago
There's a few more details in the linked mailing list post[0]:
Exactly which statements should be included (certainly if and switch, any others)?
Further, it is important to consider whether the code written using this will actually be better than the code written with these things as statements. For example, the “switch” blocks tend to be very large, and turning them into expressions encourages additional indentation. Swift already allows ‘let’ values to be initialized on multiple paths, so is the win actually that great?
Given that statements-as-expressions would provide another way to do things (they are a purely syntax extension) the barrier should high to add them. They will add complexity and surface area to the language, so they need to pay that complexity.
[0] https://lists.swift.org/pipermail/swift-evolution/2015-December/000393.html https://lists.swift.org/pipermail/swift-evolution/2015-Decem...
- tpush 11y agoWell d'oh, should've clicked the link. Thanks :-) I would argue that allowing 'let' values to be initialized on multiple paths is uglier than having them be always initialized by exactly one expression. But, I see their point.