[#64517] Fw: Re: Ruby and Rails to become Apache Incubator Project — Tetsuya Kitahata <kitahata@99.alumni.u-tokyo.ac.jp>

What do you think? >> Ruby developers

13 messages 2014/08/23

[#64615] [ruby-trunk - Feature #10181] [Open] New method File.openat() — oss-ruby-lang@...

Issue #10181 has been reported by Technorama Ltd..

10 messages 2014/08/28
[#64616] Re: [ruby-trunk - Feature #10181] [Open] New method File.openat() — Eric Wong <normalperson@...> 2014/08/28

I like this feature.

[#64671] Fwd: [ruby-changes:35240] normal:r47322 (trunk): symbol.c (rb_sym2id): do not return garbage object — SASADA Koichi <ko1@...>

Why this fix solve your problem?

9 messages 2014/08/30
[#64672] Re: Fwd: [ruby-changes:35240] normal:r47322 (trunk): symbol.c (rb_sym2id): do not return garbage object — SASADA Koichi <ko1@...> 2014/08/30

(2014/08/30 8:50), SASADA Koichi wrote:

[ruby-core:64567] [ruby-trunk - Bug #2121] mathn/rational destroys Fixnum#/, Fixnum#quo and Bignum#/, Bignum#quo

From: shibata.hiroshi@...
Date: 2014-08-27 02:44:20 UTC
List: ruby-core #64567
Issue #2121 has been updated by Hiroshi SHIBATA.

Related to Feature #10169: It might be better to make Mathn class deprecated added

----------------------------------------
Bug #2121: mathn/rational destroys Fixnum#/, Fixnum#quo and Bignum#/, Bignum#quo
https://bugs.ruby-lang.org/issues/2121#change-48496

* Author: Charles Nutter
* Status: Assigned
* Priority: Normal
* Assignee: Keiju Ishitsuka
* Category: lib
* Target version: 
* ruby -v: Any 1.8.6 or higher
* Backport: 
----------------------------------------
=begin
 I've known this for a while, but only now realized this is actually a terrible bug.
 
 The mathn library replaces Fixnum#/ and Bignum#/ causing them to return a different value. When the result of a division is not an integral value, the default versions will return 0. I can think of many algorithms that would use this expectation, and most other languages will not upconvert integral numeric types to floating-point or fractional types without explicit consent by the programmer.
 
 When requiring 'mathn', Fixnum#/ and Bignum#/ are replaced with versions that return a fractional value ('quo') causing a core math operator to return not just a different type, but *a different value*.
 
 No core library should be allowed to modify the return value of core numeric operators, or else those operators are worthless; you can't rely on them to return a specific value *ever* since someone else could require 'mathn' or 'rational'.
 
 Note also that 'rational' destroys Fixnum#quo and Bignum#quo. This is also a bug that should be fixed, though it is less dangerous because they're not commonly-used operators.
 
 The following code should not fail; Fixnum#/ should never return a value of a different magnitude based on which libraries are loaded:
 
 {{{
 require 'test/unit'
 
 class TestFixnumMath < Test::Unit::TestCase
   # 0 to ensure it runs first, for illustration purposes
   def test_0_without_mathn
     assert_equal 0, 1/3
   end
 
   def test_with_mathn
     require 'mathn'
     assert_equal 0, 1/3
   end
 end
 }}}
 
 But it does fail:
 
 {{{
 ~/projects/jruby ➔ ruby test_fixnum_math.rb 
 Loaded suite test_fixnum_math
 Started
 .F
 Finished in 0.016003 seconds.
 
   1) Failure:
 test_with_mathn(TestFixnumMath) [test_fixnum_math.rb:11]:
 <0> expected but was
 <1/3>.
 
 2 tests, 2 assertions, 1 failures, 0 errors
 }}}
=end




-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next