[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re[8]: Recent key-value encoding changes to NSObject.
From: |
Manuel Guesdon |
Subject: |
Re[8]: Recent key-value encoding changes to NSObject. |
Date: |
Mon, 11 Feb 2002 19:24:54 +0100 (CET) |
On Mon, 11 Feb 2002 18:10:22 +0000 (GMT) Nicola Pero <address@hidden> wrote:
>|
>| > >| I suggest that you do as follows in your custom subclass -
>| > >|
>| > [...]
>| > >| /* If there is an ivar, use it. */
>| > >| This should support all your needs -
>| > >|
>| > >| ivars take precedence over everything else.
>| > >| dictionary values take precedence over getXXX.
>| > >| getXXX are still used when all else fails.
>| >
>| > But getXXX should be called before ivar access (during the valueForKey
>process). :-(
>|
>| You can use storedValueForKey: which looks up ivars before set/get
>| methods.
>|
>| So I suppose you could change as follows -
>|
>| - (id) storedValueForKey: xxx
>| {
>| if (ivar)
>| {
>| return [super storedValueForKey: xxx];
>| }
>|
>| if (canFindInDictionary)
>| {
>| return valueFoundInDictionary;
>| }
>|
>| return [super storedValueForKey: xxx];
>| }
>|
>| - (id) valueForKey: xxx
>| {
>| if (ivar)
>| {
>| /* Call storedValueForKey: as that looks up ivars first! */
>| return [super storedValueForKey: xxx];
>| }
>|
>| if (canFindInDictionary)
>| {
>| return valueFoundInDictionary;
>| }
>|
>| /* Call super's implementation. */
>| return [super valueForKey: xxx];
>| }
>|
>| Modulo all approximations and code to fill in, it might work. :-)
Yes, it should work but IMHO, it's more ugly than my patch (and efficiency
seems to decrease because we make one more
ivar lookup. Sorry, I still think my patch was more orthogonal.
To close this discussion, if it's really annoy you and Richard, I'll put a copy
of the NSObject code in the
EOGenericObject and we'll end with this too long thread.
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
- Re: Re[6]: Recent key-value encoding changes to NSObject., (continued)
- Re: Recent key-value encoding changes to NSObject., Richard Frith-Macdonald, 2002/02/11
- Re: Re[2]: Recent key-value encoding changes to NSObject., Nicola Pero, 2002/02/11
- Re[4]: Recent key-value encoding changes to NSObject., Manuel Guesdon, 2002/02/11
- Re: Re[4]: Recent key-value encoding changes to NSObject., Nicola Pero, 2002/02/11
- Re[6]: Recent key-value encoding changes to NSObject., Manuel Guesdon, 2002/02/11
- Re: Re[6]: Recent key-value encoding changes to NSObject., Nicola Pero, 2002/02/11
- Re[8]: Recent key-value encoding changes to NSObject.,
Manuel Guesdon <=
- Re: Re[6]: Recent key-value encoding changes to NSObject., Richard Frith-Macdonald, 2002/02/11
Re[4]: Recent key-value encoding changes to NSObject., Manuel Guesdon, 2002/02/23