Re: File Extensions Problem
Re: File Extensions Problem
- Subject: Re: File Extensions Problem
- From: "Michael Ash" <email@hidden>
- Date: Thu, 28 Aug 2008 11:52:46 -0400
On Wed, Aug 27, 2008 at 6:59 PM, R.L. Grigg
<email@hidden> wrote:
> Hmm, I guess the wrinkle in this particular case is if the "contract" doesnt
> specify something that the programmer assumes to be safe to do (like
> enumerating backwards), how can you know how to implement your end? I guess
> there are times when the underlying implementation details can/must
> influence your highlevel design?
When at all possible, your code should only be influenced by
underlying implementation details in the realm of performance, not
correctness.
This business of copying the array is a good example. It's fine to
write code that depends on the array no longer being copied, so long
as it still performs acceptably (although potentially worse) if the
array is copied.
There are a lot of cases where you have to make assumptions about
which technique is fastest, and this in turn depends on how those
techniques are implemented at a low level. But so long as your code
merely becomes slower when the assumptions change, but still
functions, this is generally not a problem.
In the case of enumerating backwards, the documentation says a lot
about how you should never mutate collections that you're enumerating
and nothing about it being safe to mutate while enumerating backwards.
The conclusion there should be obvious.
Mike
_______________________________________________
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