From: Robert Klemme Date: 2012-01-23T20:41:55+09:00 Subject: Re: Microrant on Ruy's Math Skills On Mon, Jan 23, 2012 at 11:51 AM, Peter Vandenabeele wrote: > On Mon, Jan 23, 2012 at 11:40 AM, Robert Klemme > wrote: > >> On Mon, Jan 23, 2012 at 11:35 AM, Peter Vandenabeele >> wrote: >> > On Mon, Jan 23, 2012 at 11:33 AM, Peter Vandenabeele < >> peter@vandenabeele.com >> >> >> Feature request: >> >> >> >> Based on this discussion, it would actually be useful to me if I could >> >> shorten this: >> >> >> >>   amount = BigDecimal.new("15.5") >> >> >> >> to >> >> >> >>   amount = 15.5B >> >> Bad idea IMHO because this requires a parser change and also makes all >> programs implicitly require "bigdecimal" which is usually not needed. >> >> > Maybe >> > >> > 15.5D >> > >> > is better naming (maps to "Decimal" and the %d of format string). >> >> Or >> >> amount = 15.4.to_bd >> amount = 15.4.to_decimal >> amount = 15.4.to_dec >> amount = BD(15.4) >> > > When writing 15.4 ... and then calling a method on it, > it's already too late. > > BD("15.4") would work though ... Darn, right you and Josh are. Well, then these methods should also be defined on String. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/