[#2367] Standard libraries — Dave Thomas <dave@...>

From ruby-dev summary:

60 messages 2004/02/11

[#2397] PATCH: deprecate cgi-lib, getopts, importenv, parsearg from standard library — Gavin Sinclair <gsinclair@...>

Index: cgi-lib.rb

15 messages 2004/02/12

[#2465] PATCH: OpenStruct#initialize to yield self — Gavin Sinclair <gsinclair@...>

This is a common approach I use to object initialization; I don't know

24 messages 2004/02/19

Re: Problems in mathn, rational, complex, matrix

From: Austin Ziegler <austin@...>
Date: 2004-02-01 14:42:37 UTC
List: ruby-core #2323
On Sun, 1 Feb 2004 18:11:50 +0900, Gavin Sinclair wrote:
> On Sunday, February 1, 2004, 7:02:31 PM, Mathieu wrote:
>> If "mathn" modifies Integer#/, then it surely breaks other libraries
>> that rely on Integer#/ returning an Integer or at least rounding down.
> I agree, but I don't think mathn does that.

irb(main):001:0> require 'mathn'
=> true
irb(main):002:0> 3 / 5
=> 3/5
irb(main):003:0> (3 / 5).class
=> Rational
irb(main):004:0>

That would cause problems with a lot of the software that I've written 
(including PDF::Writer, I think), but Rational also has a #to_i method that 
does what one expects. What won't work if you've got mathn loaded is:

a = 3 /5
b = a * 7

With 'mathn', that returns Rational(21, 5); without it, it returns 0.

I'm not sure what the right answer for this is, because I'm not sure that I 
want to do "b = a.to_i * 7".

-austin
--
austin ziegler    * austin@halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2004.02.01
                                         * 09.38.08




In This Thread