[swift-evolution] [Pitch] Make the first parameter in a function declaration follow the same rules as the others

Myles La Verne Schultz myleslschultz at icloud.com
Wed Mar 9 21:06:47 CST 2016


> On Mar 9, 2016, at 5:24 PM, Rudolf Adamkovič via swift-evolution <swift-evolution at swift.org> wrote:
> 
> +1
> 
> P.S. During my Swift tutoring lessons, the current behavior confuses everybody to no end.

…are we sure this isn’t just because people are just down right daft at times.  I would in no way consider the Swift 2 syntax confusing.  It’s ugly (compared to the proposed 'func foo(x: Int, y: Int)') and frustrating to be sure, but not confusing.  Like all students learning something, sometimes one just have to take something at face value—it is what it is and that’s life, haha.  Sometimes I really find myself wondering if anyone has ever read “The Swift Programming Language” text.  It always seems like people spend more time just “playing around" with Swift—learning by trial and error.  That’s a bad idea for learning anything as experimenting and understanding what the result requires knowing something in the first place.

No offense, but if people would spend more time learning the language instead of comparing it to other languages while they learn it, they may not have such problems.  Perhaps even a good number of the arguments put forth on these threads may not come up either… food for thought.

I’m definitely +1 on making ‘func' and and ‘init' have the same type of argument signature.

    func foo(x: Int, y: Int) // Looks so much BETTER!!!!

Myles

> R+
> 
>> On 9 Mar 2016, at 19:58, Joe Groff via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> Our accepted naming guidelines have embraced first argument labels for functions and methods. This weakens our justification for making the first parameter declaration in a `func` declaration behave differently from the others, implicitly being unlabeled. It seems pretty clear to me we should make all of the parameter declarations behave uniformly:
>> 
>> func foo(x: Int, y: Int) // Should declare foo(x:y:), instead of foo(_:y:)
>> func foo(_ x: Int, y: Int) // Explicitly declares foo(_:y:)
>> 
>> This would also make `init` and `func` parameters behave consistently, which is nice. There may still be hope for our keyword argument rules to one day be shorter than the Smalltalk spec…
>> 
>> -Joe
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto: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/20160309/316102ea/attachment.html>


More information about the swift-evolution mailing list