[swift-evolution] [Pitch] making where and , interchangeable in guard conditions.
erica at ericasadun.com
Tue May 24 12:07:35 CDT 2016
The where clause is not a stylistic flourish because it is still best used to constrain conditions that are semantically
related to conditions. Upon acceptance as now, there are no compiler checks that mandate any relationship.
The difference is that (1) coders will be allowed to move Boolean assertions out of where clauses when there is no
relationship, and (2) they will be allowed to order the statements as desired. Under the current system, all boolean
clauses must be conjoined and expressed as the first item of the list (except after availability clauses, as the one exception)
> On May 24, 2016, at 11:01 AM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> With the implementation of your proposal, will there be anything that can be written in where clauses that cannot be written after a comma (in the context of guard statements specifically)? If not, does the where clause become entirely a stylistic flourish?
> On Tue, May 24, 2016 at 11:57 Erica Sadun <erica at ericasadun.com <mailto:erica at ericasadun.com>> wrote:
> There is no way I could figure out how to restrict Boolean assertions to mentioned variables therefore I left where clauses entirely untouched.
> I'd recommend people adopt in-house standards where Boolean assertions in where clauses should be semantically tied to the condition
> clause that introduces them.
> I will add this as a note.
> -- E
>> On May 24, 2016, at 9:29 AM, Xiaodi Wu <xiaodi.wu at gmail.com <mailto:xiaodi.wu at gmail.com>> wrote:
>> Does this proposal distinguish between "where clauses [...] restricted to a Boolean assertion tied to variables connected to the binding or pattern condition" and "unrelated Boolean assertions [that] should be allowed to stand on their own"?
>> Or are both types of boolean assertions now permitted either following a comma or following a where clause?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution