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

Jens Alfke jens at mooseyard.com
Fri Jul 1 10:57:50 CDT 2016


> On Jun 30, 2016, at 6:47 PM, zh ao via swift-users <swift-users at swift.org> wrote:
> 
> You should be aware of using static methods as it may change static variables, which affects all instances of that class. Normally I think static methods is designed to use outside the class instance, if you have to use it inside its instance method. You may need to rethink the pattern you do. 

This doesn’t make any sense to me. All class-based OO languages have static/class methods, so this isn’t specific to Swift. And any method can change static class variables. There’s nothing special about static methods that makes them less suitable for use by instance methods.

—Jens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160701/7e6fae87/attachment.html>


More information about the swift-users mailing list