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

2016-07-04 Thread Rick Mann via swift-users
> Karen Stone wrote: >> I believe there’s real value in being explicit about referencing class >> members. It helps both the reader of the code and it makes writing code >> with typical IDE conveniences like code completion less cluttered and more >> informative. Unfamiliar class methods

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

2016-07-03 Thread Nicholas Outram via swift-users
Good point. Again, from an educator perspective, one view is to think of the Class itself as a singleton object in memory, with its own set of iVars and methods that operate upon them. Although declared and defined in one source, when you visualise as objects / relationships in memory, one

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

2016-07-02 Thread Nicholas Outram via swift-users
You are right of course. I'm looking at this more from the eyes of an educator, where anything that reduces ambiguity helps. Students naively gravitating towards a singleton pattern is one of the battles I face. Some learners don't even properly understand the difference or risks. Invoking a

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

2016-07-01 Thread Kerry Hazelgren via swift-users
> On Jul 1, 2016, at 11:06 AM, Kate Stone via swift-users > wrote: > >> On Jul 1, 2016, at 11:01 AM, Jens Alfke via swift-users >> > wrote: >> >> >>> On Jul 1, 2016, at 10:28 AM, Nicholas Outram via swift-users >>>

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

2016-07-01 Thread Kate Stone via swift-users
> On Jul 1, 2016, at 11:01 AM, Jens Alfke via swift-users > wrote: > > >> On Jul 1, 2016, at 10:28 AM, Nicholas Outram via swift-users >> > wrote: >> >> class methods may mutate "mutable static variables”

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

2016-07-01 Thread zh ao via swift-users
Swift forces you to use class name to alert you on the fact that static variables and methods (may) affect the other instances of the class as static variables are shared between instances. That does make sense. Zhaoxin On Fri, Jul 1, 2016 at 11:57 PM, Jens Alfke wrote: > >

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

2016-06-30 Thread David Sweeris via swift-users
I'm pretty sure you can have instance and static methods with the same name. Requiring `Type.foo()` instead of just `foo()` would tell the compiler which one you want. - Dave Sweeris > On Jun 30, 2016, at 21:01, Rick Mann via swift-users > wrote: > > >> On Jun 30,

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

2016-06-30 Thread zh ao via swift-users
Just a choice made by the language designers to distinguish the call at the call site. 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

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

2016-06-30 Thread Rick Mann via swift-users
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