Re: Is that really a bug at all? (was: Re: Ugly bug in Foundation, beware!)
Re: Is that really a bug at all? (was: Re: Ugly bug in Foundation, beware!)
- Subject: Re: Is that really a bug at all? (was: Re: Ugly bug in Foundation, beware!)
- From: Marcel Weiher <email@hidden>
- Date: Sun, 6 Jun 2004 14:57:43 +0200
On 4 Jun 2004, at 17:24, Brent Gulanowski wrote:
On Jun 3, 2004, at 6:00 PM, Marcel Weiher wrote:
If the original contained something (say, a newspaper with
images), the contents of the copy does not change when the contents
of
the original changes. That's why it is called a *copy*.
Welcome to programming with *references*! :-))
This is somewhat specious, regardless it being correct.
No.
It is quite possible to add a semantic abstraction over top of a
language where it
does not already exist. All languages in fact simply do this to the
machine language anyway.
You are confusing two different operations: adding semantic
abstractions *to* a language and implementing a new language with the
semantic abstraction you want in terms of another language. The latter
is always possible, as long as the original language is Turing
complete. The former is not.
If you are saying that the semantic abstraction of value passing is
only partially implemented (and I think that is what you are accusing
Apple of),
Not at all. I am saying that Apple should stop pretending that they
can add this semantic abstraction to Objective-C in any meaningful way,
because they can't and are causing confusion.
In the case of a Cocoa collection like NSArray, are you saying that
using by-value semantics for -copy would be wrong because
-insertObject:AtIndex: (amongst others) uses reference semantics, or
are you saying that it would be wrong to re-design NSArray to adhere
fully to by-value semantics due to the by-reference nature of
Objective-C?
I am saying you *cannot* redesign NSArray to adhere fully to be-value
semantics because of the nature of Objective-C. Any attempt to do so
will, by necessity, be incomplete, and quite probably rather useless.
In other words, where's the inconsistency: the interfaces
of the class to one another, or the class design Ondra is expecting and
the language it is in? Or between different classes? Or all three?
Between Ondra's expectations, which were fuelled by some of the
class-designs as implemented, and the language, which cannot actually
deliver on what is being hinted at.
I'll accept the first easily, but need more convincing of the
class-versus-language conflict, if someone is willing. If Cocoa were
completely re-written with by-value semantics, would that be "bad"?
Not necessarily. Just impossible in Objective-C in a general fashion.
Is there an inherent technical (vs. philosophical) problem with
using both
by-value and by-reference semantics if the difference is clear and
logical?
Just try it!!
Marcel
_______________________________________________
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.