From: "Mark J. Reed" Date: 2004-01-24T09:29:57+09:00 Subject: Re: Why is to_a going to be obsolete? On Sat, Jan 24, 2004 at 01:17:20AM +0100, Michael Vondung wrote: > As one of those who use Ruby casually, I wholeheartedly concur. to_s > and to_i were among the first things I learned, so to_a always made > perfect sense to me. [ *o ] may make more sense to more experienced > programmers, but it merely seems more cryptic to _me_. :) Anyway, > isn't that a bit inconsistent? No, because to_a will still exist and will still be the way to get arrays out of objects which are collections of some sort. All that's going away is the default to_a of class Object, which returns a one-elment array containing the receiver. That has never made sense to me. I mean, if I have an object obj and I want an array containing it, I would just write [ obj ]. If the object may or may not already be an array and I don't want to add a level of arrayness if it is, which feels fuzzy but never mind, then I would write [ *obj ]. There's no new syntax there; that's just how you do that in Ruby. Calling to_a would not occur to me unless I had something that I knew was some sort of collection object and wanted to get its members as an array - that's what to_a was made for, and that's what it'll *still* be for even if Object#to_a -> [ self ] goes away. -Mark