Austin Ziegler ha scritto:
>>yeah, I'm not really suggesting changing Math.sqrt, just an example.
> 
> 
> Yeah, but it's a perfect example of what's wrong with trying to put
> class restrictions as signatures in Ruby methods.

I fail to see how redefining a method is better than defining a 
specialized version for your own purposes leaving all the rest working 
with other implementations, but I am quite dumb usually, so it is ok.

<minisnip>

> Part of it is the mess that is C/C++; part of it is the mess that is
> Java. If I were able to say something like:
> 
>   class Foo acts as java.util.String
>   {
> 	// ...
>   }
> 
>   class Bar
>   {
> 	public String baz(String x) { ... };
>   }
> 
> it might be okay. 
 > I'm not necessarily after an inheritance relationship,
 > but even that's difficult.

I think you could easily do this with a multimethod dispatch defaulting 
on #=== in ruby, asserting a pseudo is-a property like
def String.===( Foo f) true end

But now I understand your reasons, thanks for sharing.