[swift-users] Why can't Swift instance methods call class methods without qualification?

Jens Alfke jens at mooseyard.com
Fri Jul 1 16:28:11 CDT 2016

> On Jul 1, 2016, at 2:02 PM, Rick Mann via swift-users <swift-users at swift.org> wrote:
> The problem is, you can never be sure what was intended in the method two(), below:

Sure you can. It’s easy to tell that it calls the instance method, because if it were calling the class method there would have to be a “Foo.” in front of it.

You’re first arguing that class-method calls should have the same syntax as instance-method calls, and then complaining that having class and instance methods with the same name is ambiguous … but the reason for the ambiguity is because they’d be hard to tell apart using your proposed syntax. That’s not coherent.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160701/363f1b62/attachment.html>

More information about the swift-users mailing list