gnustep-dev
[Top][All Lists]
Advanced

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

Re[4]: Recent key-value encoding changes to NSObject.


From: Manuel Guesdon
Subject: Re[4]: Recent key-value encoding changes to NSObject.
Date: Sat, 23 Feb 2002 12:58:58 +0100 (CET)

Hi Richard,

On Sat, 23 Feb 2002 07:01:46 +0000 Richard Frith-Macdonald <address@hidden> 
wrote:

 >| 
 >| On Friday, February 22, 2002, at 04:13 PM, Manuel Guesdon wrote:
 >| > Sorry, I was at Fosdem sunday morning but not sunday afternoon (I've 
 >| > planned to visit the city with my girlfriend :-)
 >| > I've seen NSObject has changed but found nothing about accessing 
 >| > GS[GS]etValue externally. Is it possible to have this
 >| > kind of thing soon ?
 >| 
 >| Unfortuanate that I missed you on sunday, bit I did ask a few other 
 >| people their opinions, and we all thought
 >| it unlikely that the ObjC language would change to permit anything other 
 >| than ascii in selector/ivar names
 >| (and even if it did, it would probably be utf8) 

Yes, I agree.

 >| so we could make the 
 >| interfaces for acesseng object
 >| internals use C strings.  So I've starting work on reorganising this 
 >| already - should not take very long.

Well !
I've found also to feature wich could be interesting
        o adding "special keys", may be by generalizing NSArray 
-computeXXforKey:
                An example, it would be nice to use something like
                        address@hidden
                @currentLanguage will be binded in the current language code in 
this case.
                If we have this iordered language list (FR, EN, ES)
                The key will be result will be the same as:
                        - anObject.aDictionary.FR
                                if there is a value for FR in aDictionary
                        - otherwise anObject.aDictionary.EN
                                if there is a value for EN in aDictionary
                        - otherwise anObject.aDictionary.ES
                                if there is a value for ES in aDictionary
                        - otherwise, it will return nil.

        o handling quotes in keys like
                anObject."a.Key".aName
                "a.Key" would be taken a a single key "a.key" not 2 keys "a" 
and "Key".



 >| >> | > BTW, as KVC in GNUstep is in core not in EOF, there's actually 
 >| >> some missing parts in core: NSarray, NSDictionary
 >| >> | and NSMutableDictionary
 >| >> | > implements valueForKey:
 >| >> | > Is it possible to add this to base so this part will be complete 
 >| >> and NSArray/NSDictionary will be conform to
 >| >> | specs ?
 >| >> |
 >| >> | Surely ... if there's anything missing I'd consider it a bug.
 >| >
 >| > Here are additional methods :
 >| > NSObject :
 >| >         - (void)takeStoredValue:value forKeyPath:(NSString *)key
 >| >         - (void)takeStoredValuesFromDictionary:(NSDictionary 
 >| > *)dictionary
 >| >         - (NSDictionary *)valuesForKeyPaths:(NSArray *)keyPaths
 >| >
 >| > NSArray:
 >| >         - (id)valueForKey:(NSString *)key
 >| >         - (id)computeSumForKey:(NSString *)key
 >| >         - (id)computeAvgForKey:(NSString *)key
 >| >         - (id)computeCountForKey:(NSString *)key
 >| >         - (id)computeMaxForKey:(NSString *)key
 >| >         - (id)computeMinForKey:(NSString *)key
 >| >
 >| > NSDictionary:
 >| >         - (id)valueForKey:(NSString *)key
 >| >         - (id)storedValueForKey:(NSString *)key
 >| >         -(id)valueForKeyPath:(NSString*)keyPath
 >| >
 >| >  NSMutableDictionary:
 >| >         - (void)takeValue:(id)value forKey:(NSString *)key
 >| >         - (void)takeStoredValue:(id)value forKey:(NSString *)key
 >| >
 >| > How can we integrate them into base ?
 >| 
 >| I need to find where they are documented, and in which header files they
 >| are declared, so I know what they are supposed to do and can check that
 >| our implementation is the same as the MacOS-X one, and that I declare
 >| them in the correct header files.

For NSArray, it's here:
       
http://developer.apple.com/techpubs/webobjects/WebObjects_4.5/System/Library/Frameworks/EOControl.framework/ObjC_classic/Classes/NSArrayAdditions.html
        and  
http://developer.apple.com/techpubs/webobjects/Reference/Javadoc/com/webobjects/foundation/NSArray.html

For NSDictionary, it's here:
    
http://developer.apple.com/techpubs/webobjects/Reference/Javadoc/com/webobjects/foundation/NSDictionary.html
(sorry, I haven't found this in ObjC part)

We have already code for some of these methods.

 
 >| I can't find the NSObject files you list on MacOS-X, nor can I find the
 >| compute.... methods listed anywhere.
 >| The array and dictionary methods overriding existing NSObject ones look
 >| straightforward and would not need new declarations as they are listed
 >| for NSObject in NSKeyValueCoding.h, but I'd be happier If I could find
 >| them documented in the MacOS-X documentation.
 >| 
 >| >
 >| > Additionaly, there some new methods in Apple doc but I haven't code for 
 >| > them:
 >| >         NSArray 
 >| > 
 >(http://developer.apple.com/techpubs/macosx/Cocoa/Reference/Foundation/ObjC_classic/
 >| > Classes/NSArray.html)
 >| >                  - exchangeObjectAtIndex:withObjectAtIndex:
 >| 
 >| I hadn't seen that.  I checked the documentation, and it's there - but 
 >| without s description of
 >| what it should do.  Now the name makes it seem obvious that it should 
 >| exchange objects in an array -
 >| but that can't be right because an NSArray is not mutable ...

I've seen this too. Probably an error from Apple. I've found this metod name 
interesting because I think it should swap 2 array
values (in a mutable array).


 >| >                 Operators related methods (I think they are related to 
 >| > computeXXXForKey:(NSString *)key)
 >| >                         
 >| > http://developer.apple.com/techpubs/webobjects/WebObjects_5/FoundationRef/
 >| > Java/Classes/NSArray.html
 >| > http://developer.apple.com/techpubs/webobjects/WebObjects_5/FoundationRef/
 >| > Java/Classes/NSArray.html#//apple_ref/java/clm/NSArray/setOperatorForKey
 >| >                         
 >| > http://developer.apple.com/techpubs/webobjects/WebObjects_5/FoundationRef/
 >| > Java/Interfaces/NSArrayOperator.html#BCEJIJAI
 >| 
 >| 
 >| I think if those methods are only in the webobjects documentation, they 
 >| shouldn't be in the base libarary,
 >| and should be a category implemented as part of the webobjects clone.

I don't know hor they are related to computeXXForKey.
May be an even better place for all this KeyValue coding stuff could be in 
extensions ? 

Manuel




reply via email to

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