• 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: Why is "set" a class method of NSColor?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Why is "set" a class method of NSColor?
      • From: Matt Neuburg <email@hidden>
References: 
 >Re: Why is "set" a class method of NSColor? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: seg fault or not?
  • Next by Date: Re: Why is "set" a class method of NSColor?
  • Previous by thread: Re: Why is "set" a class method of NSColor?
  • Next by thread: Re: Why is "set" a class method of NSColor?
  • Index(es):
    • Date
    • Thread