gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re[4]: KeyValueCoding (was Recent key-value encoding changes to NSOb


From: Richard Frith-Macdonald
Subject: Re: Re[4]: KeyValueCoding (was Recent key-value encoding changes to NSObject.)
Date: Mon, 25 Feb 2002 12:27:40 +0000

On Monday, February 25, 2002, at 11:59 AM, Manuel Guesdon wrote:

On Mon, 25 Feb 2002 11:40:47 +0000 Richard Frith-Macdonald <address@hidden> wrote:

|
| On Monday, February 25, 2002, at 10:17 AM, Manuel Guesdon wrote:
| >
| > I would agree but concerning NSArray compute..., I think it's closely
| > related to it's valueForKey:
| > http://developer.apple.com/techpubs/webobjects/Reference/Javadoc/com/webobjects/
| > foundation/NSArray.html#valueForKey(java.lang.String)
| > <<
| > public Object valueForKey(String key)
| >     Conformance to the NSKeyValueCoding interface. NSArray's
| > implementation is more complex than the default:
| >         * If key indicates an operation that doesn't require an
| > argument, valueForKey performs the operation and returns the result. | > key indicates an operation if its first character is "@". For example,
| > if key is "@count", valueForKey invokes compute on the "count"
| > operator. This has the effect of computing and returning the number of
| > elements in the receiver. Don't use valueForKey for operations that
| > take arguments; instead use valueForKeyPath.
| > * For keys which do not begin with "@", valueForKey creates a
| > new array with the same number of elements as this array. For each
| > element, the corresponding element in the new array is the result of | > invoking valueForKeyPath with key as the key path on the element. For | > example, if key is "firstName", this method returns an array containing | > the firstName values for each of the array's elements. The key argument
| > can be a key path of the form relationship.property. For example,
| > "department.name". valueForKey replaces null values with an instance of
| > NSKeyValueCoding.Null.
| >>>
| >
| > What do you think ?
|
| I think that you are talking about webobjects specific behavior.  You
| can tell this by the fact that this
| is only documented in the webobjects documentation, and the fact that it
| doesn't work like this in MacOS-X
|   (I checked by running a test program on MacOS-X 10.1.3).
|
| It looks to me like most (if not all) of the methods in your source file
| are webobjects specific ones
| which are not present in the apple Foundation.

Please correct me if I'm wrong, but this mean that we'll have a different behavious between NSArray in base and NSArray in GNUstepWeb/EOF:
        Exemple 1:
NSArray -valueForKey:@"something" won't find a value in base but in gsweb NSArray -valueForKey:@"something" will return an array of results of performing valueForKey:@"something" on each object of
the array

Yes.

        Exemple 2:
NSArray -valueForKey:@"lastObject" will return the last object of the array in base but in gsweb NSArray -valueForKey:@"lastObject" will return an array of results of performing valueForKey:@"lastObject" on each object of
the array

Yes.

Same kind of problem in NSDictionary

Yes.

Don't you think the performXXforKey mecanism is interesting not only for EOF but for other uses ?

Yes.
But people wanting it for other uses should be able to link with the appropriate libraries. The fact that an idea is neat is a reason to have it available, but not a reason to include
it with everything.

My point ... which I obviously haven't managed to make clear yet ... is that we should not
introduce unexpected behaviors into the software without good reason.

A program built using the Foundation framework should work much the same way as a program
built using the base library.
A program built using Foundation and WebObjects should work much the same way as a program
built using base and gsweb.

Now I realise that this stuff has been dropped from Apples ObjC API ... but to me that means the best place to put it is probably an EOF clone (since Apple have dropped EOF), and have gsweb depend on the EOF code. I'd like to see a decent EOF as part of GNUstep.

If/when apple move these extra methods into Foundation, we should move them into base. That way, people porting will get the behaviors they expect, and we will be able to use
whichever behavior we want.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]