Re: Why is "set" a class method of NSColor?
Re: Why is "set" a class method of NSColor?
- Subject: Re: Why is "set" a class method of NSColor?
- From: Jens Alfke <email@hidden>
- Date: Fri, 4 Dec 2009 10:07:53 -0800
On Dec 4, 2009, at 9:56 AM, Matt Neuburg wrote:
I have a vague feeling that, once again, it's a nomenclature thing. It
should really have a name that makes clear you're setting something
about
the graphics context (like setForContext or something)...
In this context <sic> "set" means "set the receiver to be used by the
current graphics context". There are a couple of graphics-related
classes that have this method.
I don't like this design, as it's not very object-oriented and relies
on global state (the "current context"). It would be better to have a -
setColor: method on NSGraphicsContext. It's been in AppKit forever,
though, and I think it came from the PostScript model, where there is
always a global graphics context that all operators implicitly refer
to. In the newer CoreGraphics APIs (that replaced Display PostScript),
they switched to making context an explicit parameter of every drawing
call.
—Jens_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden