From: Chad Perrin Date: 2007-07-19T06:46:47+09:00 Subject: Re: syntactic sugar buzz On Thu, Jul 19, 2007 at 06:31:46AM +0900, Robert Dober wrote: > > Hmmm, nil#split makes not much sense I agree, but what about > nil#to_i? > Actually that is Off-Topic, I have to admit :(. I think to_i() fits in well enough. You're specifically returning a different type in this case. While an array looks like a type, from a certain perspective, it's actually a collection of "things" of some other type(s) -- it's a data structure, not a datum. As such, I'm not sure the same rules should apply. The closest thing to a nil.split that makes sense to me is nil.to_a which, by the way, already exists. > ri NilClass#to_a ---------------------------------------------------------- NilClass#to_a nil.to_a => [] ------------------------------------------------------------------------ Always returns an empty array. nil.to_a #=> [] -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] John W. Russell: "People point. Sometimes that's just easier. They also use words. Sometimes that's just easier. For the same reasons that pointing has not made words obsolete, there will always be command lines."