> On 7 Sep 2016, at 11:28, Quincey Morris <quinceymor...@rivergatesoftware.com> 
> wrote:
> 
> On Sep 6, 2016, at 21:14 , Gerriet M. Denkmann <gerr...@mdenkmann.de> wrote:
>> 
>> But I cannot get this to work.
> 
> Meaning … ?? A compiler error? What does the source code look like, of the 
> protocol with the class func in it? What is the error message?

Struggling in a Playground I get lots of different compiler errors with 
different tries.
The first one I remember: “class” was not allowed in a protocol extension, I 
was told to use “static” instead.

> 
>> NewSuper uses this classFunction like:
>> func otherFunction( arg: UInt64) -> UInt64
>> {
>>      return self.dynamicType.classFunction(  arg ) + 21
>> }
> 
> If this is how you’re using it, it’d be clearer for the method you’re 
> currently calling “classFunction” to be an instance method called something 
> like “utilityFunction”. The only real reason it would *have* to be a class 
> function would be if you’re calling it in a context where there is no 
> instance — and the above is not that.

This is a very good idea. I was using a class function, only because it does 
not access any of the ivars.
But it could be an instance method as well (and, as you mentioned: it better 
should be).

I’ll try to fix this in my code.

Thanks a lot!

Kind regards,

Gerriet.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to