Deprecating SELFINIT

View: New views
3 Messages — Rating Filter:   Alert me  

Deprecating SELFINIT

by Quentin Mathé-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everyone,

I'd like to deprecate SELFINIT since it goes against the use of  
designated initializers. SUPERINIT can be used as a replacement when  
the superclass designated initializer is -init.

If you use designated intializers, you usually never call [self init]  
but you rather call the receiver designated initializer which will be  
the one with the greatest number of arguments. Then this designated  
initializer calls the superclass designated initializer which in some  
cases will be -init, for this case SUPERINIT is useful.

Explanations about the initializer rules are available here:
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/CocoaObjects.html#/ 
/apple_ref/doc/uid/TP40002974-CH4-SW58

I would also be in favor of enforcing the use of designated  
initializers in the coding guidelines, because they make the code  
harder to break, specially when you modify code that you haven't  
written or touched for a while. With them subclassing a framework  
class is also easier.

Any comments?

Cheers,
Quentin.

_______________________________________________
Etoile-dev mailing list
Etoile-dev@...
https://mail.gna.org/listinfo/etoile-dev

Re: Deprecating SELFINIT

by David Chisnall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

We talked a bit about this before, and I think you've convinced me.  
It isn't used in too many places in the tree and in some, for example  
most of LanguageKit, self isn't actually overridden so it could just  
be replaced by SUPERINIT.

David

On 27 Aug 2009, at 13:02, Quentin Mathé wrote:

> Hi everyone,
>
> I'd like to deprecate SELFINIT since it goes against the use of
> designated initializers. SUPERINIT can be used as a replacement when
> the superclass designated initializer is -init.
>
> If you use designated intializers, you usually never call [self init]
> but you rather call the receiver designated initializer which will be
> the one with the greatest number of arguments. Then this designated
> initializer calls the superclass designated initializer which in some
> cases will be -init, for this case SUPERINIT is useful.
>
> Explanations about the initializer rules are available here:
> http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/CocoaObjects.html#/
> /apple_ref/doc/uid/TP40002974-CH4-SW58
>
> I would also be in favor of enforcing the use of designated
> initializers in the coding guidelines, because they make the code
> harder to break, specially when you modify code that you haven't
> written or touched for a while. With them subclassing a framework
> class is also easier.
>
> Any comments?
>
> Cheers,
> Quentin.
>
> _______________________________________________
> Etoile-dev mailing list
> Etoile-dev@...
> https://mail.gna.org/listinfo/etoile-dev


_______________________________________________
Etoile-dev mailing list
Etoile-dev@...
https://mail.gna.org/listinfo/etoile-dev

Re: Deprecating SELFINIT

by Quentin Mathé-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le 27 août 09 à 14:41, David Chisnall a écrit :

> We talked a bit about this before, and I think you've convinced me.
> It isn't used in too many places in the tree and in some, for example
> most of LanguageKit, self isn't actually overridden so it could just
> be replaced by SUPERINIT.


ok. Unless someone else has an objection, I'll mark it as deprecated.

Cheers,
Quentin.
_______________________________________________
Etoile-dev mailing list
Etoile-dev@...
https://mail.gna.org/listinfo/etoile-dev