On 22 mai 2014, at 19:46, sergio_101 <sergio.rrd@gmail.com> wrote:

In many cases, an object might have a method (filter, selector, etc) attached to it so that the object can run the correct method..

for instance, an object might have a filterMethod variable with a value 'filterByArtist'..

in ruby, i would do something like:

instance.send(filter_method)

how would i do that in pharo, and is this a bad idea?

"instance perform: filterMethod asSymbol"
If filterMethod is already a symbol you can omit asSymbol. 
It is slower than regular message send but it's also the safest reflective operation since it's the only one that doesn't break object encapsulation.
 

thanks!


--
----
peace,
sergio
photographer, journalist, visionary