• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ADC Core Data article
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ADC Core Data article


  • Subject: Re: ADC Core Data article
  • From: Marcel Weiher <email@hidden>
  • Date: Sun, 10 Apr 2005 00:38:18 +0200


On 9 Apr 2005, at 16:01, Charlton Wilbur wrote:
On Apr 9, 2005, at 8:03 AM, Marcel Weiher wrote:
On 9 Apr 2005, at 10:37, Byron Ellis wrote:
On Apr 9, 2005, at 12:44 AM, Marcel Weiher wrote:

Wow! I must have missed that one. How do I express [matrix matrixTranslatedBy:2.3 y:[slider floatValue]] in KVC? Or how about: [[array1 select] isEqual:[array2 each]]?


[matTranslator setValue:matrix forKey:@"matrix"];
[matTranslator setValue:[NSNumber numberWithFloat:2.3] forKey:@"x"];
[matTranslator setValue;[NSNumber numberWithFloat:[slider floatValue] forKey:@"y"];


//alternately
//[matTranslator bind:@"y" to:slider withKeyPath:@"value" options:nil];


[matTranslator valueForKey:@"translated"];


I don't see how this shows that KVC is isomorphic to message sending, as it assumes the existence of an additional element that is not part of KVC, at least I didn't notice a MatTranslator class as part of KVC. I could have missed it, though... ;-)



It's the right idea. Every message can be decomposed into setting one key for each argument,

Actually, Objective-C *messages* can't be decomposed this way, they have to specified in one go to objc_msgSend(). You have to reify them (for example using an NSInvocation). In fact, your example can be recast without KVC, but still retaining the reified message/ procedure:


[matTranslator setMatrix:matrix];
[matTranslator setX:2.3];
[matTranslator setY:[slider floatValue]];

So the crucial transformation is creating objects/classes for all the messages you want to send, and I don't see how you can claim that that's an isomorphism. That doesn't mean it isn't a mapping, but the KVC mapping can't be done alone and it isn't an isomorphic one.

You certainly can find equivalent implementations that at some point use KVC, but that wasn't what you claimed.

[snip]


[[array1 select] isEqual:[array2 each]]?


This one is easier.

Yes.

foo = [array1 getValueForKey: @"select"];
bar = [array2 getValueForKey: @"each"];
[foo setValue: bar forKey: @"isEqualInput"];
[foo valueForKey: @"isEqualResult"];

Apart from not working at all, this certainly isn't an isomorphic mapping.


Marcel


-- Marcel Weiher Metaobject Software Technologies email@hidden www.metaobject.com Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc. 1d480c25f397c4786386135f8e8938e4


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: ADC Core Data article
      • From: Charlton Wilbur <email@hidden>
References: 
 >Re: ADC Core Data article (From: Philippe Mougin <email@hidden>)
 >Re: ADC Core Data article (From: Shawn Erickson <email@hidden>)
 >Re: ADC Core Data article (From: Charlton Wilbur <email@hidden>)
 >Re: ADC Core Data article (From: Marcel Weiher <email@hidden>)
 >Re: ADC Core Data article (From: Byron Ellis <email@hidden>)
 >Re: ADC Core Data article (From: Marcel Weiher <email@hidden>)
 >Re: ADC Core Data article (From: Charlton Wilbur <email@hidden>)

  • Prev by Date: Re: ADC Core Data article
  • Next by Date: Re: ADC Core Data article
  • Previous by thread: Re: ADC Core Data article
  • Next by thread: Re: ADC Core Data article
  • Index(es):
    • Date
    • Thread