On Jul 21, 2007, at 12:42 AM, Marcus Denker wrote:

> What Ted suggests is to use a special "selector name" object (or an  
> object encodig
> Selector + Arguments) instead of symbols for #perform and then search
> *the complete system* for this on "senders of". This them will catch  
> Selectors that
> are not referenced from a method, but stored in an iVar in some  
> object.
>
> For Squeak, this would mean that this would be not allowes:
>
>       self perform: #hallo
>
> but this instead:
>
>       sel := Selector named: #hallo.
>       self perform:  sel.

I am not sure what the original proposal would gain, because typically  
you do not do a

        self perform:#hallo.

where #hallo is any constant/literal selector, because if it were  
constant/literal, then you could just write the message-send naturally:

        self hallo.

However, the fact that you need to use #perform: when you want to have  
a variable selector has bothered me for some time, because it is a  
weird asymmetry that, for example, functional programming languages do  
not seem to share:  if you get passed a function (function pointer in  
C and the like), you can call it using natural syntax.  So what I  
would like to see would be some sort of "selector variable", a  
variable that can be used in a standard message expression but is  
actually variable:

        |  variableSelector:withArg: |

        variableSelector:withArg:  :=  self computeSelector.                    
" probably  
need to check arity for compatibility here "
        self variableSelector:'hello' withArg:2.

Not sure this is workable/agreeable in a Smalltalk context, but  
something like it would be really nice.  IMHO.

Marcel


_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc

Reply via email to