From: Navindra Umanee Date: 2005-01-30T15:25:03+09:00 Subject: Re: Ten Things Every Java Programmer Should Know About Ruby E S wrote: > You're exactly right. Ruby is /strongly/ typed, meaning that each > object is of a discrete, well-defined type, but it is not strictly No offense, but I never said anything of the sort... :-) I don't know what the definition of type in Ruby is, but as far as I can tell it is anything but discrete. Types overlap inasmuch as the method names they respond to overlap. It really only seems to make sense to talk about methods and not to get hung up on types. A "biggest" type in Ruby (that is, a type that can pass for almost any type) is probably the object that implements all methods, or simply, method_missing. However there can be different implementations of method_missing, and so matters get very murky indeed because the behaviour of two different biggest types by this definition can be very different. Probably the biggest *biggest* type is an object that implements all methods and returns itself each time. Even then it might not always quack like a duck. It really isn't too clear. :-) > Well, Ruby does guarantee that you can't call 'foo' on an object that > doesn't implement that method. Yes... foo and method_missing. > No, a label for a Socket object (e.g. 'foo' in 'foo = Socket.new') may > point to a different type of an object. The object itself doesn't > change. This is a really important bit. I hope we can stop talking about variables... please see the example code I have given in the other emails where an object changes its type. Cheers, Navin.