Eero Saynatkari wrote:
> On 2006.09.28 14:32, Hal Fulton wrote:
> 
>>Eero Saynatkari wrote:
>>
>>>I would go so far as saying that the standard Ruby syntax for this is
>>>
>>> foo.x y, z
>>
>>I don't know what you mean. That is not valid in Ruby (unless
>>x is a singleton method). In particular it doesn't work if
>>foo.x is a Proc, which is the situation discussed.
> 
> 
> It is valid if x is a method that foo responds to.
> 
> Storing callable objects seems not a very rubyesque
> thing to do--albeit necessary on occasion. In lieu
> of worrying about keeping interface compatibility
> with Python, I would recommend the OP merely make
> the API as idiomatic Ruby as possible.

I think he was merely striving to keep the code
intuitive, not striving for compatibility with
Python as such. I concur with his desire for
intuitiveness (and I concur with your statement
that he should stick to idiomatic Ruby when
writing Ruby).

As for storing callable objects -- in general this
is not an unrubyish practice if done properly; it's
just slightly advanced. Nothing done properly is
unrubyish. ;)

The apparent inconsistency of foo[x] or foo.call(x)
stems partly from the fact that Ruby does not require
declarations as such.

If foo were a Proc and we called it the "intuitive"
way -- foo() -- it would look just like a method call.
This is good for readability in a way, but bad in that
we lose part of the disambiguation. Ruby is happy to
have a local variable foo and a method foo in the same
scope (though naturally I don't recommend it).


Hal