From: "Michael W. Ryder" <_mwryder@...> Date: 2008-05-19T06:45:02+09:00 Subject: Re: A Couple of Questions Regarding Ruby Style Gary Wright wrote: > On May 16, 2008, at 3:50 PM, Michael W. Ryder wrote: >> I also noticed that x = .25 is not allowed > > Float literals must have digits to the left of > the decimal to avoid ambiguity with method calls: > > x = 0.25 > That I figured out a while ago. My comment was that x = .25 is not allowed but x = ".25".to_f or x = Float(".25") is. Many older languages allow x=.25 so having to place the leading zero is a sticking point as I am still not used to having to use it. My main point was the "inconsistency" of a couple of methods that I thought were synonyms for each other. This is a real problem for me as I keep having to experiment to find the correct method and usage for the desired results. It took me a while to figure out how to get my coerce method to return Rational numbers rather than Floats. The examples in Pickaxe and in the rational.rb library all returned Floats. I finally figured out that rather than calling x.coerce(self) I had to call self.coerce(x). A simple change, like using Integer(x) rather than x.to_i for converting to Integers to avoid a problem with "0xa" returning 0 rather than the expected 10. > Gary Wright >