On 28 Nov 2008, at 11:46 am, Bill Bumgarner wrote:

At best, your app's standard sliders will behave in a decidedly non- standard fashion. At worst, your app's standard sliders will crash.


Could you explain how that's a real possibility? I don't see that.

If Apple's implementation of -scrollWheel: does something different from mine then, yes, the behaviour would change. It might not change significantly, since presumably Apple wouldn't implement this to play "The Star-Spangled Banner" or make the control flash red, white and blue, but instead to just drive its value up and down.

Secondly, if my category takes effect then it will override Apple's implementation anyway, so I'd see no difference *in my app*. It might differ from other apps, but it already does in that other apps' sliders don't respond to the scrollwheel. Also, if Apple were to add this method to NSSlider, surely it would just be part of the class definition for it, rather than in a separate category? If so, my category would always prevail. If it were added in a category, it would be pot-luck whose version prevailed, which is certainly undesirable, but not exactly unsafe, as such.

I can't envisage a realistic scenario where a crash could occur, but do enlighten me as I'm certainly not familiar with every pitfall here.

What use is it, if it's such a bad idea?

They have lots of uses:

Sure, I'm aware of the general utility of categories. I was referring to the specific case where a category is permitted to override a method. You call it a "misfeature", but Apple don't - it's still documented, albeit with a number of caveats. Even if they couldn't remove the functionality for legacy reasons they could start documenting it in a much more strongly worded fashion to state that this is simply not permitted. As long as they don't do that, and as long as the developer is aware of the consequences, I take it as permitted.

I'd still agree that subclassing is the better option, but I don't see the category approach is necessarily completely off-limits either.

BTW, subclass or not, the code I posted also needs to do a check for - isEnabled.

--Graham


_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to