gnustep-dev
[Top][All Lists]
Advanced

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

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


From: Manuel Guesdon
Subject: Re[6]: Recent key-value encoding changes to NSObject.
Date: Mon, 11 Feb 2002 18:00:56 +0100 (CET)

On Mon, 11 Feb 2002 16:28:03 +0000 (GMT) Nicola Pero <address@hidden> wrote:
 >| > X will have the following methods:
 >| >         -(id)a
 >| >         {
 >| >                 [self storedValueForKey:@"a"];
 >| >         }
 >| >         -(void)setA:(id)anA
 >| >         {
 >| >                 [self takeStoredValue:anA
 >| >                         ForKey:@"a"];
 >| >         }
 >| 
 >| As far as I understand, this implementation of X makes no sense.  If _a is
 >| an ivar, this should be - 
 >| 
 >| - (id)a
 >| {
 >|    return _a;
 >| }
 >| 
 >| - (void)setA: (id)anA
 >| {
 >|   ASSIGN (_a, anA);
 >| }

May be but it can work like this with WO.



>| And this should be 
>| 
>| - (id)b
>| {
>|   return [self whateverMethodToAccessThe_valueDictionary: @"a"];
>| }
>| 
>| - (id)setB: (id)aB
>| {
>|   return [self whateverMethodToAccessThe_valueDictionary: aB  forKey: "b"];
>| }


Sorry, I've made a mistake :-( 
it should be read
        -(id)b
        {
                [self storedValueForKey:@"b"]; (b, not a)
        }


 >| takeStoredValue:forKey: is implemented in terms of b and setB:, not vice
 >| versa.  
 >| 
 >| Unless - ... - unless the Apple documentation is wrong, and when it says
 >| that takeStoredValue:forKey: makes steps 2,3,1 and 4 - that might be
 >| actually wrong, and it might make steps 2,3 and 4 - but not 1.  Then you
 >| could define setA: in terms of takeStoredValue:forKey:, because
 >| takeStoredValue:forKey: would simply not look for setA:.  This would make
 >| a lot of sense, so if anyone has an apple system, could you please check
 >| if takeStoredValue:forKey: does use set<Key>: (as opposed to _set<Key>:)
 >| or not ?

AFAIK, it use set<Key> if this method exists.

Here is some pointer on the steps:
        http://wodeveloper.com/omniLists/eof/2000/June/msg00087.html
        http://wodeveloper.com/omniLists/eof/2000/October/msg00076.html

Manuel
--
______________________________________________________________________
Manuel Guesdon - OXYMIUM <address@hidden>
14 rue Jean-Baptiste Clement  -  93200 Saint-Denis  -  France
Tel: +33 1 4940 0999  -  Fax: +33 1 4940 0998




reply via email to

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