On Aug 17, 2011, at 6:30 PM, Conrad Shultz wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 8/17/11 3:11 PM, Michael Crawford wrote:
>> For those who are interested, here is a simple answer to my
>> original question.
>> 
>> @implementation NSTextView (csstest)
>> 
>> -
>> (NSDraggingSession*)beginDraggingSessionWithItems:(NSArray*)items 
>> event:(NSEvent*)event source:(id<NSDraggingSource>)source { return
>> nil; }
>> 
>> That's it.
> 
> Please don't do that.
> 
> It is usually bad practice to override(*) a method in a category.  It
> is highly fragile, particularly because you don't know (and shouldn't
> care) how the frameworks are implemented internally.

Yep, I know.
> 
> Furthermore, wherever the category gets picked up, you are overriding
> that method.  So when you have some other NSTextView (or subclass
> thereof) that you DO want to support dragging, it will (inexplicably)
> not work.
> 
Yep.  I know that too.  Not applicable.  There will be NO dragging.

> Finally, I will note that the particular method you chose is 10.7+
> only, so this presumably won't work at all on Snow Leopard and
> earlier.  I recall that you said this is for an internal project, so
> maybe that's OK, but personally I wouldn't jump on a Lion-only
> approach this early on for something which has very good and more
> broadly compatible alternate solutions.
> 
Yep.  I know.  Your right.  I agree, not my call.

> I would STRONGLY encourage you to reconsider your approach and perhaps
> try what I previously suggested vis-a-vis the responder chain.  Though
> I obviously can't see what you are doing in its entirety, I get the
> impression that you are painting yourself into an uncomfortably small
> corner by - wait for it - "fighting the framework."
> 
Not my call, either.  I make sure clients have all the info and then do as I'm 
told.  I find I get paid better when I don't ignore their directives.

> *: To be very clear here, I am talking about OVERRIDING a method, not
> the intended use of categories which is to ADD a method.
> 
> 
> - -- 
> Conrad Shultz
> 
> Synthetiq Solutions
> www.synthetiqsolutions.com
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iD8DBQFOTED0aOlrz5+0JdURAo0TAJsE3geERkN0qttbpy5gEai/Q+xgMgCdEEv3
> Zss2o6N/tquQp9jNJmVhpsg=
> =cteS
> -----END PGP SIGNATURE-----

Conrad, thank you for your concern.  I know you want me and others reading this 
thread to follow practices that are safe and lead to robust resilient software.

I only wanted to post for completeness.  What I was looking for was a specific 
answer to a technical question.   Since no-one had the answer, I posted it.  
The answer was the API call not the category override, in which it was 
implemented, FOR TESTING.

Thanks, guys.

-Michael

_______________________________________________

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

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

Reply via email to