[swift-users] Why can't Swift instance methods call class methods without qualification?
Jens Alfke
jens at mooseyard.com
Fri Jul 1 19:15:30 CDT 2016
> On Jul 1, 2016, at 3:24 PM, Rick Mann via swift-users <swift-users at swift.org> wrote:
>
> Maybe it's just my C++ upbringing
I think that’s it, yes. (No offense intended.) Different languages have very different ways of doing things. C++ has a very intense focus on performance, and that’s led to its object model being very limited (I could say “crippled”) compared to almost any other OO language. Part of this is the way that static methods are really just namespaced functions, not true methods.
> Hmm. It sounds like you're saying it is the way it is as a side-effect of the language implementation.
No, it’s a side effect of the language design. I could go into more detail, but I’d just be repeating what Brent said, basically.
If you really want to dive into this rabbit hole, I suggest learning about Smalltalk, which is in most respects the original OO language, and the direct ancestor of Obj-C’s OO features. Metaclasses are a pretty deep concept and well worth learning about. (I remember poring over the class hierarchy diagram in the flyleaf of the Smalltalk-80 “Blue Book” as a college student…)
—Jens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160701/f795e32a/attachment.html>
More information about the swift-users
mailing list