Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Semantics of ^ in value bindings in .wod file.




Am 29.12.2007 um 18:57 schrieb Archibal Singleton:

^foo in the wod is the same as parent().valueForBinding("foo") in java
parent.foo in the wod is the same as parent.valueForKey("foo") in java


The first line requires a parent with foo bound. The second line requires a variable or method named foo.

Thanks for the clarification Uli, the nuance is indeed important and I didn't get it at first.

It's important and unfortunately is not quite right. Assume your parent java has:


public String hello() {return "Hello"}

The parent wod has

MySub : MySub {
   foo = hello;
}

The child MySub has:

MyFoo : WOString {
  value = ^foo;
}

Then you get whatever your parent has bound against the child instance's "foo" binding. This is NOT the same as parent().valueForBinding("foo"), which would get what the parent of the parent of MySub had bound to "foo".

It mainly a shortcut so you don't have to write in the child java:

public Object foo() {return valueForBinding("foo")}

and in the child wod:

MyFoo : WOString {
  value = foo;
}

I'm normally not picky about stuff, but this IS an important concept and in particular valueForKey() and valueForBinding() can be hard to tell apart...

Cheers, Anjo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/email@hidden

This email sent to email@hidden
References: 
 >Semantics of ^ in value bindings in .wod file. (From: Archibal Singleton <email@hidden>)
 >Re: Semantics of ^ in value bindings in .wod file. (From: Ulrich Köster <email@hidden>)
 >Re: Semantics of ^ in value bindings in .wod file. (From: Archibal Singleton <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.