Hi --

On Tue, 10 Jan 2006, Gregory Brown wrote:

> On 1/9/06, James Britt <james_b / neurogami.com> wrote:
>> Gregory Brown wrote:
>>> ...
>>> The fear in part has to do with type checking.  Ruby being typeless
>>
>> Ruby is not typeless.
>
> Aren't all ruby objects under the hood of type VALUE?

But Ruby != Ruby-under-the-hood :-)

> sandal@karookachoo:~$ irb
> irb(main):001:0> 3.type
> (irb):1: warning: Object#type is deprecated; use Object#class
> => Fixnum
>
> So... aren't we supposed to ignore type now? ;)

The reason #type is deprecated is not that there's no such thing as
type, but that having a #type method that returns the object's class
leads people to think that type and class are the same.  In fact, my
understanding is that the only reason Matz resorted to a #type method
was that there were problems getting the parser to treat "class" as a
method name, even with an explicit receiver.

> Please elaborate on what you meant by this, because I am interested.
> ( My conception of ruby's type system might have been wrong)

The type of a Ruby object, as I understand it, is basically its
capabilities, at a given point during runtime.  So objects have types
-- but the types themselves are anonymous and, in a sense, circular.
(The type of x is "the type that objects that do what x does have".)


David

-- 
David A. Black
dblack / wobblini.net

"Ruby for Rails", from Manning Publications, coming April 2006!
http://www.manning.com/books/black