jbsf / blindside

Blindside provides dependency injection capabilities for Objective-C on iOS and OS X
MIT License
71 stars 43 forks source link

Refuse to call -init on classes which provide alternate init methods #40

Closed briancroom closed 9 years ago

briancroom commented 9 years ago

Here's my take on #24. Thoughts @akitchen, @jbsf?

akitchen commented 9 years ago

39 is merged - do you want to take a look at reorganizing this now?

briancroom commented 9 years ago

Done and rebased! Do you have any feedback on the contents of the exception message that this introduces @akitchen? I want to make sure we are providing as much guidance as possible when people encounter this situation.

akitchen commented 9 years ago

I'm not sure but I think this might be too opinionated. Sometimes a call to a bare init is still valid even if there is an initWithFoo: available.

If I recall, the original issue was about not using -init when it has been overridden with an implementation like

- (id)init {
  [self doesNotRecognizeSelector:_cmd];
  return nil;
}

... and instead raising an exception with a helpful message

briancroom commented 9 years ago

Point taken. I'm going to open a new PR with a more lenient approach to this.

akitchen commented 9 years ago

42 is merged; closing... thanks for your efforts here!