On 25.03.2011 22:22, Iain Barnett wrote:
>
> On 25 Mar 2011, at 19:06, serialhex wrote:
>
>> ...personally i think it would be nice to be able to define new operators
>> (like the aforementioned +?) that way when a situation like this comes up,
>> one can simply:
>>
>> op_def +?  # maybe? i'm assuming it'd have special syntax...
>>   # stuff
>> end
>>
>> and get on with life, making your code cleaner&  simpler.  IDK how well this
>> would work or its potential ramifications, but i think it fits into the
>> 'flavor' of ruby to be able to do such things (i mean, you can define/change
>> damn near *everything else* in the language, why not operators?)
>> hex
>
> I agree. In Haskell, for instance, you can make a prefix function
> into  an infix by surrounding it with backticks, e.g.
>
>      plus 1 2
>
> becomes
>
>      1 `plus` 2
>
> Something similar would be helpful on occasion, IMO.

But that's something different than defining a new operator.  It's just 
fixed syntax for a method call.  That approach doesn't suffer from the 
problems I laid out in my other reply to this thread.

Kind regards

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/