Patrick Bennett wrote: > Hmmm, thanks, but it's a bit 'non-obvious' to casual Ruby programmers > (who will have to understand my code). 'to_a' is pretty darn clear. :( > Matz, somebody? Why is to_a being obsoleted? :( I would not call "to_a" very obvious, as compared to, say, "to_array" (if one existed). "[ *o ]" is more obvious in a sense that it is comprised of two constructs one MUST know to read any Ruby program: "[]" makes an array and "*" expands an object in-place. Gennady. > > Gennady wrote: > >> Patrick Bennett wrote: >> >>> I find it immensely useful when dealing with arrays to be able to >>> convert a source argument (that may or may not be in an array) into >>> an array so I can concatenate it, perform a set-union on it, etc. >>> with a destination array. >>> What is the real reason for this, and if it's being obsoleted, what >>> am I supposed to use instead if I need to insure I'm dealing with an >>> array ? >>> >> I was also surprised to learn that Object#to_a is going to be >> obsolete. However, I immediately found a replacement for it that I >> like even more: >> >> instead of doing >> o.to_a >> >> I do now >> [ *o ] >> >> And this is not reported as obsolete in Ruby 1.8.1 yet ;-) >> >> Gennady. >> >> > >