Peter Vandenabeele wrote in post #970618:
> Colin Law wrote in post #970616:
>> On 25 December 2010 00:37, Peter Vandenabeele <lists@ruby-forum.com>
>> wrote:
> ...
>>> I am not in favor of D because it silently changes the class
>>> of the result and this violates the principle of least surprise.
>>> If you want Rational, use it from the start then.
>>
>> For D there is no reason why the class of the result needs to change
>> to Rational. It could stay as BigDecimal but internally store the
>> data as a Rational.
In this case there would be no advantage to storing as a Rational.
Sounds like you want an ExactNumber class that abstracts both.
For the record, I think BigDecimal / BigDecimal = BigDecimal is the
correct design.
>
> Ah, I see. I had not thought it that way.
>
> Thanks,
>
> Peter
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
Sent from my iPhone
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment