On Jun 24, 2009, at 8:11 PM, Kyle Sluder wrote:

On Wed, Jun 24, 2009 at 7:55 PM, Peter Ammon<pam...@apple.com> wrote:
Microsoft even says that all objects must be robust against being Dispose()d multiple times, which smacks of sloppiness. If your program disposes of an object twice, then it is structured so that independent usages of the object are not coordinated, and so it is likely that one part of your program uses
an object after it has been disposed by another part.

It's not really sloppiness.  Python behaves the same way with its
contexts; both Python contexts and Dispose() are intended to be used
on objects that hold on to finite resources.  Similarly to Dispose(),
you can't reopen a closed NSStream.

IOW, Dispose() isn't a memory management technique, it's a
limited-resource-management technique.

--Kyle Sluder


Are you saying that it's not sloppy to close a file twice, unlock a lock twice, etc.?

Python doesn't require that its contexts be robust against multiple calls to __exit__ (its answer to Dispose()).

_______________________________________________

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