[swift-evolution] [Pitch] Retiring `where` from for-in loops

L. Mihalkovic laurent.mihalkovic at gmail.com
Wed Jun 15 00:44:58 CDT 2016



> On Jun 15, 2016, at 3:57 AM, Jon Akhtar via swift-evolution <swift-evolution at swift.org> wrote:
> 
> How about the goal of it being a delightful language to program in.

Historyprooves that goals are rarely enterely wrong... It is how they are carried out that more often is questionable.


> I think that is getting lost in proposals like these. Optimizing for some mythical new user, who really isn’t present on this list to give an opinion seems like a false argument to make, and your technical sophistication makes you a less qualified than most to say what is and what isn’t confusing to new users because you haven’t been one in a long time.

Now the problem with that is : do you design for day 1 or do you design for day-n (where n > bigEnoughToDoLot). I hope NEITHER, which makes hte complete beginer equally disqualified as I am then. Swift is here to stay for next 20 years at least... it can't just be designed for the extremes, and the role of chris and team is to see past the knee-jerk reactions of newcomers to see how they can put mechanisms in place that will secure the future. 

> -1 Leve it in. It is perfectly simple as is. Not confusing at all. There are far more confusing aspects to the language than this.

But there are limited opportunity to hide great power behind simple looking constructs, and that is a fact, regardless of the number of users who can see/understand it. Objc thrived for 30 years because the apple world was very closed onto itself. Today arguably the most powerful language (richness of abstractions, universality) for writing appleOS apps is in the hands of microsoft. Maybe apple will settle for this situation, leaving people who feel limited by swift to switch to c#. But make no mistake, other languages will come (rust is already usable to make ios apps), and many of the people who are 7 today and learning, will already feel limited 2 years from now if swift does not step up where it can.

> 
> Cheers
> 
> From: <swift-evolution-bounces at swift.org> on behalf of Xiaodi Wu via swift-evolution <swift-evolution at swift.org>
> Reply-To: Xiaodi Wu <xiaodi.wu at gmail.com>
> Date: Tuesday, June 14, 2016 at 13:50
> To: "L. Mihalkovic" <laurent.mihalkovic at gmail.com>, David Waite <david at alkaline-solutions.com>
> Cc: swift-evolution <swift-evolution at swift.org>
> Subject: Re: [swift-evolution] [Pitch] Retiring `where` from for-in loops
> 
> Why are you unhappy about this design goal? Simple != simplistic, and powerful != complicated. Approachability has to do with the slope of the learning curve, not how high the curve goes.
> 
> 
>> On Tue, Jun 14, 2016 at 14:18 L. Mihalkovic <laurent.mihalkovic at gmail.com> wrote:
>> 
>> 
>> Regards
>> (From mobile)
>> 
>> On Jun 14, 2016, at 7:16 PM, David Waite via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>>> I’m a bit late to this conversation, and I don’t totally understand the goal.
>>> 
>>> There are a *lot* of things you can do in for…in loop with pattern matching that also would supposedly go against this interpretation of approachability. Pattern matching in general might be considered to go against this interpretation.
>>> 
>>> Is this pitch saying statements such as:
>>> 
>>> for i in 1..<100 where i%2 == 1 {…} 
>>> 
>>> should be disallowed, while statements like
>>> 
>>> for case let view? in views { … }
>>> 
>>> are still approachable enough to warrant being supported in the language?
>>> 
>>> FWIW, I wouldn’t support removing where based on current arguments without either the keyword “where" being eliminated completely from the language, and/or adding equivalent intuitive functionality to Sequence with same-class performance, e.g. a .where(...) equivalent to .lazy.filter(…). 
>>> 
>>> I’ve known about and used the feature since it was first added to Swift (learned via the language book), and don’t fully understand the confusion that some developers may have - especially since ‘while’ is already a keyword and could have been used if that was the actual semantics.
>>> 
>>> -DW
>>> 
>>>> On Jun 14, 2016, at 10:32 AM, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
>>>> 
>>>> And from the WWDC Platforms SOTU: "Swift is super simple and approachable.... It's great as a first language. And in fact, we think this is so important that when we designed Swift this was an explicit design goal."
>> 
>> Yup... Doesn't bode well for power users... "Swift.. Address your needs from 7 till 77... unifies the entire family"
>> 
>>>> I would be absolutely against adding any more sugar to the for loop. In that sense, `where` sets a terrible example that certain features of sequences deserve contextual sugar. (And before someone points it out again, I've already argued why `for...in` holds its own weight, namely difficulty of writing a correct `while` replacement and progressive disclosure to the learner so that the concept of iterators can be learned afterwards.)
>>>> 
>>>> In short, I would very much be opposed to adding keywords "for fun."
>>> 
>> 
>>> _______________________________________________
>>> swift-evolution mailing list
>>> swift-evolution at swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-evolution
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160615/b99ea895/attachment.html>


More information about the swift-evolution mailing list