• 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: cocoa-dev digest, Vol 2 #2366 - 12 msgs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cocoa-dev digest, Vol 2 #2366 - 12 msgs


  • Subject: Re: cocoa-dev digest, Vol 2 #2366 - 12 msgs
  • From: Mark Smith <email@hidden>
  • Date: Wed, 21 May 2003 12:11:55 -0400

Regardless of it's merit, it's a common C++ idiom for writing
exception safe code.

Obviously, and I understand the reasoning that leads to such a
solution. I even thought it was a Good Thing, initially. It took me
a while to realize just how much of a coding horror it is.

I can't see why this qualifies as a "coding horror" for anyone fluent in C++. It's arguably just a kind of Method Object. If the issue is revealing intent, then you could either make the name more obviously a verb:

AutoSaveGraphicsContext save;

or add an explicit method:

GraphicsContextSaver saver;
saver.save();

but the latter will be pointlessly redundant (and more error-prone) to a C++ programmer. The real "coding horror" here is surely the attempt to simultaneously use two languages with totally different rules and idioms rather than anything inherently wrong with either one of them alone.
_______________________________________________
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.
  • Prev by Date: Re: Future Objective-C changes
  • Next by Date: Re: Multiple Targets in Project Builder
  • Previous by thread: Re: Multiple Targets in Project Builder
  • Next by thread: getting rid of text-field contextual menu
  • Index(es):
    • Date
    • Thread