> 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
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
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
> 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
>>>
> 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”
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:
>
>
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,
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
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