• 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: Cocoa Bindings - nondebuggable, non-obvious, procedural ???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa Bindings - nondebuggable, non-obvious, procedural ???


  • Subject: Re: Cocoa Bindings - nondebuggable, non-obvious, procedural ???
  • From: Philippe Mougin <email@hidden>
  • Date: Thu, 6 Jan 2005 17:56:31 +0100

First, let me say that I enjoy this thread too, except that I'm starting to have weird dreams about it at night (I'm in a world where object frameworks are alive, run very fast and and eat people), which is not good considering I will have to explain the whole OOP & Cocoa stuff to my analyst.

Let's go back to our discussion:

Le 6 janv. 05, à 01:41, Charlton Wilbur a écrit :

On Jan 5, 2005, at 5:10 PM, Philippe Mougin wrote:

For example, consider the extreme situation: imagine a world in which all and every part of Cocoa would be only using KVC to interact with our objects. We would be of course free to use object-oriented programming inside our own code, but Cocoa would only interact with our objects in terms of "give me the value associated with this key" and "associate this value with this key". I think we would not consider Cocoa to be an object-oriented framework, right?

Well, given that I'm about to demonstrate that message passing and KVC are isomorphic to each other, I think I must disagree with that statement.

So if I understand correctly, and getting back at my example with the greaterThan: method, instead of writing:


result = [a greaterThan:b]

We would write, using your model:

[a setValue:[NSArray arrayWithObjects:b, nil] forKey:@"greaterThan"];
result = [a valueForKey:@"greaterThan"];

Great. But you don't manage to demonstrate that this has anything to do with KVC.
There is a flaw in you demonstration when you state that:


So our most recent example could also have been written:
	foo.inputMessage("doSomethingWithAndWith", @list(bar, baz));
	quux = foo.outputMessage("doSomethingWithAndWith");

which has a striking similarity to:
[foo.setValue: [NSArray arrayWithObjects: bar, baz, nil] forKey: @"doSomethingWithAndWith"];
quux = [foo valueForKey: @"doSomethingWithAndWith"];

...and conclude that your language and KVC are equivalent.

The "striking similarity" you see is only at the very superficial level of methods signatures. But you left out completely the semantics of KVC, which are defined by the KVC documentation and attach to the setValue:forKey: and valueForKey: methods a particular behavior. Unfortunately, the semantics provided (or mandated) by KVC cannot support the semantic of the language you describe, and consequently your language cannot be considered as something equivalent to KVC.

For instance, the semantic of -(void)setValue:(id)value forKey:(NSString *)key in KVC is (short version): "Sets the property of the receiver specified by key to value".

This semantic is way too precise and narrow to support the semantic of messaging in general which, depending on the message that is sent, can be absolutely anything.

Again, the similarity between your model and KVC is only at the method signature level.

The semantic of KVC (which is its "raison d'etre") is about setting and getting the values of the properties of an object. Given such semantics it is impossible to support the more general behavior of "invoking an arbitrary method that can do whatever it wants".

Best,

Philippe Mougin
http://www.fscript.org


_______________________________________________ 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: Cocoa Bindings - nondebuggable, non-obvious, procedural ???
      • From: Charlton Wilbur <email@hidden>
References: 
 >Re: Cocoa Bindings - nondebuggable, non-obvious, procedural ??? (From: Philippe Mougin <email@hidden>)
 >Re: Cocoa Bindings - nondebuggable, non-obvious, procedural ??? (From: Charlton Wilbur <email@hidden>)
 >Re: Cocoa Bindings - nondebuggable, non-obvious, procedural ??? (From: Philippe Mougin <email@hidden>)
 >Re: Cocoa Bindings - nondebuggable, non-obvious, procedural ??? (From: Charlton Wilbur <email@hidden>)

  • Prev by Date: Re: Undo logic location?
  • Next by Date: Which controller is it...??
  • Previous by thread: Re: Cocoa Bindings - nondebuggable, non-obvious, procedural ???
  • Next by thread: Re: Cocoa Bindings - nondebuggable, non-obvious, procedural ???
  • Index(es):
    • Date
    • Thread