Re: Is "-init" really needed?

2017-08-07 Thread Jens Alfke
> On Aug 7, 2017, at 5:23 PM, Carl Hoefs wrote: > > Is the use of +new discouraged also? No, I use it all the time. It’s simply shorthand for [[XXX alloc] init]. These days with ARC, I tend to use +new instead of factory class methods — e.g. [NSMutableArray

Re: Is "-init" really needed?

2017-08-07 Thread Carl Hoefs
> On Aug 7, 2017, at 5:17 PM, じょいすじょん > wrote: > >> >> On Aug 8, 2017, at 9:09, Jens Alfke wrote: >> >> >>> On Aug 7, 2017, at 5:02 PM, David Hoerl wrote: >>> >>> But then I though - heck, if Foo has NSObject as its

Re: Is "-init" really needed?

2017-08-07 Thread じょいすじょん
> On Aug 8, 2017, at 9:09, Jens Alfke wrote: > > >> On Aug 7, 2017, at 5:02 PM, David Hoerl wrote: >> >> But then I though - heck, if Foo has NSObject as its super class, gee, maybe >> -init isn't really need. I mean, if all of Foo's ivars and properties

Re: Is "-init" really needed?

2017-08-07 Thread Greg Parker
> On Aug 7, 2017, at 5:02 PM, David Hoerl wrote: > > I recently saw some code where an object was alloced but there was no init: > > Foo *foo = [Foo alloc]; > foo.bar = ... > > My blood pressure soared! My pulse quickened! I started breathing rapidly! > > But then I though

Re: Is "-init" really needed?

2017-08-07 Thread Jens Alfke
> On Aug 7, 2017, at 5:02 PM, David Hoerl wrote: > > But then I though - heck, if Foo has NSObject as its super class, gee, maybe > -init isn't really need. I mean, if all of Foo's ivars and properties are > initialized, its a shortcut, right. -[NSObject init] happens to be a

Is "-init" really needed?

2017-08-07 Thread David Hoerl
I recently saw some code where an object was alloced but there was no init: Foo *foo = [Foo alloc]; foo.bar = ... My blood pressure soared! My pulse quickened! I started breathing rapidly! But then I though - heck, if Foo has NSObject as its super class, gee, maybe -init isn't really