On Fri, Sep 13, 2002 at 04:31:40AM +0900, dblack / candle.superlink.net wrote:
> Once it's possible to sign methods by type, I seriously doubt that
> very many newcomers to Ruby (at the very least) would write very many
> methods where they didn't.  Hard to predict... but I still root for
> the alternative.

One possibility would be to make it hard to make a method that takes
only one type as a parameter:

  class Foo
    def foo(Integer i)
      ...
    end
  end

This might result in:

  TypeError: cannot create specialized method `foo' without a generic
  method `foo' for class Foo
          from (eval):2

Instead, I'd have to write:

  class Foo
    def foo(i)
      raise "Illegal operation"
    end

    def foo(Integer i)
      ...
    end
  end

This would probably deter people from writing non-generic code, but
still allow them to do so.

Just a thought.

Paul