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?

How far under the hood do we want to look?

> 
> 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? ;)
> 
> Please elaborate on what you meant by this, because I am interested.
> ( My conception of ruby's type system might have been wrong)

I'm going to punt and refer you to this:

http://www.rubygarden.org/ruby?TypesInRuby

which, hopefully, is both correct and reasonably complete.

The short answer is, Ruby objects have a type, which essentially is "the 
type that responds to those methods I happen to respond to."

In /most/ cases, asking an object for its class is sufficient for 
determining type, but that gets back to the real topic: Not all objects 
of, say, class String are assured to respond to the same messages, and 
to the extent that so-called String objects differ in their 
message-acceptance, they are different types.



James
-- 

http://www.ruby-doc.org       - Ruby Help & Documentation
http://www.artima.com/rubycs/ - The Journal By & For Rubyists
http://www.rubystuff.com      - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com     - Playing with Better Toys
http://www.30secondrule.com   - Building Better Tools