From: Mathieu Bouchard Date: 2002-01-21T14:01:59+09:00 Subject: Re: Hello! Array sub classing? On Mon, 21 Jan 2002, Markt wrote: > They have to be there... somewhere... implied as part of a deeper method > or invisible, private to the class. > Since the data is stored, there has to be a delimiter. > Hmm.. OK... maybe not... could be just a bunch of pointers.... A Ruby value can only be one of these: special values: nil, false and true. small integers (FixNum) identifiers (Symbol) pointers (to allocated objects) And in an Array you can only put Ruby values. There are no gimmicks. When you call String#split, the result is an array of pointers to string objects (shortcut: we say: an array of strings) > Then again, when a string contains commas, it can be treated as a set of > elements... a string is constructed mostly like an array; one exception is that instead of being ruby values, its elements are 0-255 numbers, assumed to be ascii codes. another exception is that several common methods still don't behave the same way. for example, the for-loop (#each) on an array goes element by element, but the for-loop on a string goes by spans of characters (the default is line-by-line). ________________________________________________________________ Mathieu Bouchard http://hostname.2y.net/~matju