[#75687] [Ruby trunk Bug#12416] struct rb_id_table lacks mark function — shyouhei@...
Issue #12416 has been reported by Shyouhei Urabe.
3 messages
2016/05/23
[#75763] [Ruby trunk Feature#12435] Using connect_nonblock to open TCP connections in Net::HTTP#connect — mohamed.m.m.hafez@...
Issue #12435 has been reported by Mohamed Hafez.
3 messages
2016/05/28
[#75774] Errno::EAGAIN thrown by OpenSSL::SSL::SSLSocket#connect_nonblock — Mohamed Hafez <mohamed.m.m.hafez@...>
Hi all, every now and then in my production server, I'm
4 messages
2016/05/30
[#75775] Re: Errno::EAGAIN thrown by OpenSSL::SSL::SSLSocket#connect_nonblock
— Mohamed Hafez <mohamed.m.m.hafez@...>
2016/05/30
Or does MRI's OpenSSL::SSL::SSLSocket#connect_nonblock just return
[#75782] Important: Somewhat backwards-incompatible change (Fwd: [ruby-cvs:62388] duerst:r55225 (trunk): * string.c: Activate full Unicode case mapping for UTF-8) — Martin J. Dürst <duerst@...>
With the change below, I have activated full Unicode case mapping for
4 messages
2016/05/31
[ruby-core:75322] [Ruby trunk Bug#12337] inconsistency between Fixnum#coerce and Bignum#coerce
From:
eregontp@...
Date:
2016-05-03 09:27:26 UTC
List:
ruby-core #75322
Issue #12337 has been updated by Benoit Daloze.
I had a question about Bignum#coerce in http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/75176.
I think it has limited value to have Bignum.coerce(Fixnum) or Fixnum.coerce(Bignum) return [Bignum, Bignum] instead of just the operands,
as it creates a Bignum in the Fixnum range, which is inconsistent with all other methods and might cause performance problems.
With #12005 this would be naturally the result with additionally no class distinction.
But indeed, Fixnum.coerce(Bignum) => [Float, Float] as currently is even worse probably (and shows how rarely {Bignum,Fixnum}#coerce are used in practice).
----------------------------------------
Bug #12337: inconsistency between Fixnum#coerce and Bignum#coerce
https://bugs.ruby-lang.org/issues/12337#change-58452
* Author: Akira Tanaka
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.4.0dev (2016-05-01 trunk 54866) [x86_64-linux]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
I found 1.coerce(2.0) is [2.0, 1.0] but
(2**100).coerce(2.0) raises TypeError
```
% ./ruby -ve 'p 1.coerce(2.0)'
ruby 2.4.0dev (2016-05-01 trunk 54866) [x86_64-linux]
[2.0, 1.0]
% ./ruby -ve 'p (2**100).coerce(2.0)'
ruby 2.4.0dev (2016-05-01 trunk 54866) [x86_64-linux]
-e:1:in `coerce': can't coerce Float to Bignum (TypeError)
from -e:1:in `<main>'
```
This is a documented behavior.
```
% ri Bignum.coerce|cat
= Bignum.coerce
(from ruby core)
------------------------------------------------------------------------------
big.coerce(numeric) -> array
------------------------------------------------------------------------------
Returns an array with both a numeric and a big represented as Bignum objects.
This is achieved by converting numeric to a Bignum.
A TypeError is raised if the numeric is not a Fixnum or Bignum type.
(0x3FFFFFFFFFFFFFFF+1).coerce(42) #=> [42, 4611686018427387904]
```
But I think this is bad bahavior.
Fixnum and Bignum should work seamlessly.
For example, this exposes the platform is 32-bit or 64-bit.
2**40 is Fixnum on 32-bit environment and Bignum on 64-bit environment.
So, (2**40).coerce(2.0) behaves differently: returns an array on 64-bit and
raises TypeError on 32-bit platform.
```
32bit-platform% ./ruby -ve 'p (2**40).coerce(2.0)'
ruby 2.4.0dev (2016-05-01 trunk 54866) [x86_64-linux]
[2.0, 1099511627776.0]
64bit-platform% ./ruby -ve 'p (2**40).coerce(2.0)'
ruby 2.4.0dev (2016-05-01 trunk 54864) [i686-linux]
-e:1:in `coerce': can't coerce Float to Bignum (TypeError)
from -e:1:in `<main>'
```
I think the behavior of Bignum#coerce should be changed
to match Fixnum#coerce (actually defined at Numeric).
---Files--------------------------------
int-coerce.patch (2.37 KB)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>