Scalars

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?

Hi,

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…

x = 1
1
class Fixnum; def ; self + idx; end; end
nil
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

···

From: “Daniel Carrera” dcarrera@math.umd.edu

Ruby’s objects usually know how they liked to be called. If you have a
variable “ref” that holds a reference to an object call “ref.class.name”
and it will tell you its name.

···

On Sun, 2002-12-01 at 00:28, Daniel Carrera wrote:

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?