From: "Wolfgang Nádasi-Donner" Date: 2007-12-12T23:04:25+09:00 Subject: Re: redefineable not operator murphy schrieb: > this is the coolest thing since the ordered hashes ^_^ Well, I want to do some written up thinking and dreaming in direction of Ruby 2 (or 3?), because I hope that all this discissions here don't stop December, 24th, 2007 ;-) When I'm putting together some features of Ruby 1.9, more operators can be redefined, Unicode characters can be used freely for method definition (example "real ��" instead of "lambda"), and when I remember very foggy about features of Algol68 to redefine operators and priorities (please don't ask me about details - it's too long ago I used the language), and when I look at the presentation of Jim Weirich (RubyConf 2007)... ...I end up with the question "why not thinking about free definition and redefinition of infix operators and their priorities for future versions of Ruby?". This includes wired operators like "&&" and "||", because methods which fulfil the semantics are easy to write in Ruby... module Kernel def my_and (t=self) ? yield : t end def my_or (t=self) ? t : yield end end require 'test/unit' class Test_my_logical < Test::Unit::TestCase def test_my_and assert_equal( 1&&2 , 1.my_and {2} ) assert_equal( false&&2 , false.my_and {2} ) assert_equal( nil&&2 , nil.my_and {2} ) end def test_my_or assert_equal( 1||2 , 1.my_or {2} ) assert_equal( false||2 , false.my_or {2} ) assert_equal( nil||2 , nil.my_or {2} ) end end This together with the open classes and modules in Ruby can lead to a very interesting scenario. We can define a special Ruby variant in Ruby (a DSL if you like this TLA), which can be used simply by an tailored (e.g. via .irbrc) irb from a user. So - please don't hit me or, even worse, put my sender address to a spam list. I post this with the intention to produce some dreams and ideas for versions of Ruby, that are beyond 1.9.x. I have no idea for an implementation - I didn't think about it, but for me this here looks like a logical continiation of the road. Wolfgang N��dasi-Donner