From: GOTO Kentaro Date: 2002-10-02T02:43:22+09:00 Subject: Re: thoughts on typelessness At Wed, 2 Oct 2002 02:31:39 +0900, Paul Brannan wrote: > > > > "a string".to_f # >> 0.0, and no runtime error > > > I've always thought this was a bug in the libraries :) > > But we have Float("a string") which raises ArgumentError :) > > But Float(xyz) is not easily overridable for new types. I think I'd > like to see a to_flt that defaults to using to_f, but for Strings will > do error checking (see RCR#109). Hmm, the name to_flt looks to be called by "%f" % obj. How about to_array, to_hash, to_integer and to_string for the name of default dispatch of Array(), Hash(), Integer() and String() respectively? -- Gotoken