• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Why can't Swift instance methods call class methods without qualification?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why can't Swift instance methods call class methods without qualification?


  • Subject: Why can't Swift instance methods call class methods without qualification?
  • From: Rick Mann <email@hidden>
  • Date: Thu, 30 Jun 2016 17:20:41 -0700

Why can my instance methods not call class methods without the class specifier?

class MyClass
{
    func
    foo()
    {
        classMethod()
    }

    class
    func
    classMethod()
    {
    }
}

Why do I have to call MyClass.classMethod()? Just a choice made by the language designers to distinguish the call at the call site? I like C++'s way of treating all static methods as directly available to the instance.

--
Rick Mann
email@hidden



_______________________________________________

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


  • Follow-Ups:
    • Re: Why can't Swift instance methods call class methods without qualification?
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: How can I get a single threaded network call in ObjC on iOS?
  • Next by Date: Re: Why can't Swift instance methods call class methods without qualification?
  • Previous by thread: Re: Issue with read/write to NSFileHandle
  • Next by thread: Re: Why can't Swift instance methods call class methods without qualification?
  • Index(es):
    • Date
    • Thread