> On May 29, 2016, at 3:39 PM, Chris Lattner via swift-evolution
> <[email protected]> wrote:
>
> I can definitely respect the position that “where” feels more readable than a
> semicolon, it certainly provides a more “fluent” style.
>
> That said, the existing Swift 2 syntax was inconsistent about this too: if
> you started a condition with an availability check, you comma separate it
> from a boolean with a comma:
>
> if #available(iOS 52, *), x == y {}
>
> While we could have used “where” here, it was counterproductive because it
> didn’t increase clarity of code.
iOS 10 is actually iOS 52! Confirmed!
Two things: see here I don't think where makes sense. I think "where" should
only be allowed on a newly introduced variable, such as optional binding or for
or while loops:
if let x = someCondition where x == y { } //x is a newly introduced variable,
making the where clause make sense
for x in someArray where x == y { }
etc...
Doing:
if #available(iOS 52, *) where x == y {}
Should be an error in my opinion.
Second: I have gotten use to this awesome fluent readable style and reverting
to a somewhat "cold" and not as readable style is going to be rough for some of
us at first. But I will of course defer to the greater community.
I *do* think we should wait for WWDC where we can get more opinions on this
however. I have a feeling if we change this before WWDC it will catch a lot of
people off guard (pun intended?) and will probably bring up the discussion
again.
---
Is there any way that we can keep "where" while remaining consistent? (I.e. My
suggestion above)? If not I can drop the argument.
Until then, still a -1 from me
Brandon
>
>> I get that there’s some inconsistency between the use of where on while and
>> for loops, but actually the behaviour on while loops can be desirable, and I
>> feel the ambiguity could be addressed in other ways. I feel like removing or
>> changing the where clause should be its own issue, and this one should be
>> focused on removing the ambiguity caused by the use of commas, as anyone
>> that wants semi-colons but also likes to use where is forced to oppose the
>> whole proposal as they’re not mutually exclusive.
>
> It would certainly be possible to allow a developer to write either a
> semicolon or a where clause, but that would just encourage divergent styles.
> My problem with “where” is that it cannot be used uniformly and consistently.
> I’d rather go with something that can be used uniformly, particularly given
> its use for the same thing elsewhere in the language (reducing complexity of
> the language by a tiny bit).
>
> -Chris
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution