• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Making an object accessible by both MyDocument AND a custom class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making an object accessible by both MyDocument AND a custom class


  • Subject: Re: Making an object accessible by both MyDocument AND a custom class
  • From: Ondra Cada <email@hidden>
  • Date: Wed, 25 Sep 2002 20:33:26 +0200

On Wednesday, September 25, 2002, at 07:43 , Joe Lester wrote:

You certainly CAN send messages to nil!

You bet you can. With a neat nothing-happens result. Hell, it is thoroughly documented in the very first reading anyone should take -- the ObjC itself.

I do it all the time.

Tastes differ, but I prefer other pastimes.

It sends the message up the responder chain.

It does not, never did, and with a probability very very close to one never will.

Have you not heard of a nil target before?

A nil *target* very deeply differs from a nil *recipient*. The former is at some level -- very probably, but not necessarily, in NSApplication.m -- catched by some code of kind

- (BOOL)sendAction:(SEL)theAction to:(id)theTarget from:(id)sender { // OVERSIMPLIFIED!!!!
if (theTarget) {
... scan the reponder chain to find somebody who responds to theAction ...
theTarget=...the found responder object...
}
[theTarget performSelector:theAction withObject:sender];
return theTarget!=nil;
}

the latter is just that, [nil whatever], and by definition does sweet nothing.

Can I get a witness out there please?

I guess it's difficult to find a witness for such a nonsense ;)

Nevertheless, what completely escapes me, is how on earth after Jim pointed out your mistake, along with pointing you to the sendAction:to:from: method, you can continue writing such garbage without either checking the docs or trying a simple three-or-so-line testing programme, just to be sure -- since it would show you that you are wrong indeed?!?
---
Ondra Hada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: Making an object accessible by both MyDocument AND a custom class
      • From: Ondra Cada <email@hidden>
  • Prev by Date: re: nil messaging...
  • Next by Date: Re: Making an object accessible by both MyDocument AND a custom class
  • Previous by thread: Re: Making an object accessible by both MyDocument AND a custom class
  • Next by thread: Re: Making an object accessible by both MyDocument AND a custom class
  • Index(es):
    • Date
    • Thread