On Nov 2, 2005, at 9:37 AM, Trans wrote: > I think you've made this appear more complicated than it is. It's not > so magical. A var references an object, so this amount to nothing more > than (psuedo) > > var.lamda? ? var.call ? var > > under the hood. And I am sure there is very fast way to do this. Even if there is a fast way of doing it, I think your proposal requires that it be done for *every* expression. The only way to avoid that would be some sort of data-flow analysis to discover which variables don't reference one of these Proc-like objects. But I think there is a bigger problem. If I'm following you, you suggested that there would be a special syntax to indicate that the Proc-like object *not* be called but instead be returned as a references. You wrote: def pass_it_on( x ) x # calls it ->x # returns it back end So now you are in a sense reversing the syntax of ruby such that you need an explicit marker to *not* call the implied object/method. But there is no way to know when you need to use that syntax unless you already know that the reference contains this special object. For example def proxy(a, b, c) actual(a, b, c) end def actual(e, f, g) e + f + g end proxy(dfn; 1; end, dfn; 2; end, dfn 3; end) Where do the three "anonymous methods" get evaluated? In proxy before the call to actual or in actual before the call to '+' or somewhere in '+' itself? > The use of term is just what its called in the sense that it is not > tied to the method table, but to a free varaible. So this is possible: > > a = [] > a[1] = dfn ; 1 ; end So it is just an object, which has it's own set of methods. But one of those methods (:call ?) gets executed whenever the reference gets evaluated and you can defer the evaluation by prepending '->'. I don't see how the object you are proposing can be passed around since as soon as you omit the '->' prefix it is going to get evaluated and result in a 'regular' reference to some object. Gary Wright