anObject perform: (mySymbol, ':' ) asSymbol with: aValue
stef

On Jul 18, 2011, at 9:59 PM, tgiaccone wrote:

> I've been playing with smalltalk casually now, for months and really like it.
> But I"m 
> clearly still a newb.
> 
> I've reached the point in a small project where I want to set the values on 
> my object based on the values that are in a dictionary. The dictionary is
> filled
> with a set of keys that represent attributes on the object.  So for a simple
> example,
> imagine I have an object which has accessors for 'title' and 'title:'.
> 
> I want to iterate across the set of keys, being certain that each key is a
> valid msg
> to send to myOBject. The send the object the message with the value from the
> dictionary. 
> 
> Now, I  understand that I can do:
> 
> myObject perform: 'title' asSymbol.
> 
> and use that as a way to message myObject with the selector 'title'
> 
> As I understand it this is equivalent to getting the value with:
> 
> myObject title
> 
> What I've looked for an been unable to find is how to set the value.
> 
> What is the equivalent to:
> 
> myOBject title: 'A new title'.
> 
> using perform? 
> 
> Thank you for your help.
> 
> 
> Tony
> 
> --
> View this message in context: 
> http://forum.world.st/Setting-values-using-reflection-tp3676289p3676289.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> 


Reply via email to