On Nov 2, 2005, at 4:22 PM, Trans wrote:
> gwtmp01 / mac.com wrote:
>> Now you are right back to where we started.
>> You don't need any special new syntax or behavior :
>>
>>
>> def proxy(a)
>>    if a.respond_to? :call
>>      actual(a.call)
>>    else
>>      actual(a)
>>    end
>> end
>>
>> I guess you could argue that ->identifier is just syntactic sugar
>> for identifier.call but it doesn't seem worth it to me--at least
>> not in the same way that a[index] is useful sugar for a.[](index)
>>
>
> No, I think he was still working with implict execution. The -> is
> PREVENTING the call.


My bad. But that doesn't mean anything other than swapping the
two cases.  You still don't need any new syntax or special objects
to do what was suggested.  Although I can't really see the
usefulness of sprinkling  respond_to? checks everywhere just to
suppress the evaluation of a Proc-like object.

The other example of using a proxy object to carry around
a computation and to detect when a method is sent to the
not-yet-computed value is more interesting, but also doesn't require
any changes to Ruby.



Gary Wright