Dan Doel wrote: > Hi, > > I was reading the comp.lang.functional group, and happened across a > little discussion of Ruby vs. Python on there. > One thing the Python guy asked was whether you could pass a function in > Ruby so that you could call it like: > > f(args) > > Which looks more like a real function call. And I must admit, that at > first, I was kind of put off at not being able > to pass functions around in Ruby and call them like normal functions > (I've since gotten used to the alternatives). > It got me thinking, why isn't it possible to overload a () operator for > this purpose? Was it a design decision of > the language or does it just add too much of a hassle for the parser? Or > was it something else? > > Not that I'm complaining or anything, since I don't mind the way Ruby > does it. I'm just curious what the reasoning > was. Here's one construction that becomes possible because () is not an operator: def foo 3 end foo = foo() foo += 1 p foo # ==> 4 If () were an operator, the "foo()" syntax would have to be interpreted as sending a #call message to the value of the local var "foo". I don't know if that's the main justification or a side effect, though.