From: Bill Kelly Date: 2002-12-01T08:57:45+09:00 Subject: Re: Scalars Hi, From: "Daniel Carrera" > > > Apart from syntax, there's nothing special about Array or Hash objects in > > Ruby, so there's no special word for them. > > Yes there is. You just called them "array" and "hash". How do you call > something that is neither? Point is, I think, that they're all objects. And, with respect to variables referring to any given object, there's no difference from the variable's point of view. x = 1 x = Hash.new x = Array.new x = {} x = [] x = FubarSpecialHash.new x = AlmostAnArrayButMaybeAStackOrQueueAlso.new How is a Hash different from a FubarSpecialHash? Well from the variable's 'perspective' it isn't... irb> x = 1 1 irb> class Fixnum; def [](idx); self + idx; end; end nil irb> x[3] 4 ... Now Fixnums have some bizarre "array-like" indexing behavior. ;-D What do you call them now? The variable 'x' still refers to the same object we initialized it with... Hope this helps (?) Regards, Bill