Hi --

On Mon, 25 Nov 2002, ts wrote:

> >>>>> "d" == dblack  <dblack / candle.superlink.net> writes:
>
> d> I'm actually not in favor of having "kind_of?" branching recommended
> d> in the FAQ at all, both for the reasons Dave has mentioned and because
>
>  Well, you can remove it from the FAQ but you'll never stop ruby to do this
>
> pigeon% ruby -e 'File.open([])'
> -e:1:in `open': wrong argument type Array (expected String) (TypeError)
>         from -e:1

True, and it serves a purpose, but I wouldn't want to use that as a
model for how to design and handle classes in Ruby.  For one thing,
it doesn't even recognize Ruby's own String masquerading:

  class Thing
    def to_str
      "filename"
    end
  end

  File.open(Thing.new, "w")

  => op.rb:7:in `open': wrong argument type Thing (expected String)
     (TypeError)
     from op.rb:7

so I would tend to regard it as a quite special case.


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav