Re: NSRunningApplication executableURL issue in Swift
Re: NSRunningApplication executableURL issue in Swift
- Subject: Re: NSRunningApplication executableURL issue in Swift
- From: Quincey Morris <email@hidden>
- Date: Wed, 11 Mar 2015 05:44:51 +0000
On Mar 10, 2015, at 22:26 , Bavarious <email@hidden> wrote:
>
> Much like in Objective-C. If you write
>
> void someFunction(id obj) {
> NSLog(@"%@", [obj bundleURL]);
> }
>
> the compiler picks *some* method that matches that selector
So how come this behavior has been imported into Swift? What problems does having it there actually solve? Other languages are going to laugh at us and take our lunch money if we have types like ‘NSURL!?’.
> —which method is undefined. This can be problematic when multiple methods have the same selector but different types; in particular, when one method has a floating-point type in its signature and another method doesn’t.
That’s what I don’t understand for Swift. None of the reasons I can imagine for *not* removing this behavior from Obj-C** seem applicable to Swift.
** such as:
#1: Historical precedent (Swift is all-new source code)
#2: Ugly cast syntax to clarify which selector is intended (Swift has ‘as!’)
#3: Obscures full-on polymorphism (rarely used in many classes of apps, more common usage of limited polymorphism is better expressed via protocols, which are more capable in Swift)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden