Topic: Just an idea

Instead of ==, I think it would be nice and readable if you could simply write "is", for example:

x+=1
if x is 5                               # instead of...  (x == 5)
  do_something
end

do_something  if (val is true)          # instead of...  (val == true)

Re: Just an idea

The only way i could think of doing this is to extend each class with an 'is' method, and call it like

if x.is 5
  do_something
end

It's not perfect, but a step closer.

Sam

Re: Just an idea

If you wanted to implement Sam's suggestion, you could just alias the == method.

To do this, you could try adding this to your environment.rb (or putting it in a .rb file in your lib directory, and adding require 'filename'):

Object.constants.each do |c| 
  cl = c.constantize
  if cl.respond_to?("==") && cl.is_a?(Class)
    cl.class_eval { alias is == }
  end
end

Alex

Re: Just an idea

And that, my friends, is what's so cool about Ruby.