ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:88666] [Ruby trunk Feature#15030] Have T_INTEGER constant for checking Integer types in C API
       [not found] <redmine.issue-15030.20180827051206@ruby-lang.org>
@ 2018-08-27  5:12 ` sameer.deshmukh93
  2018-08-27  5:49 ` [ruby-core:88670] " hanmac
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: sameer.deshmukh93 @ 2018-08-27  5:12 UTC (permalink / raw
  To: ruby-core

Issue #15030 has been reported by v0dro (Sameer Deshmukh).

----------------------------------------
Feature #15030: Have T_INTEGER constant for checking Integer types in C API
https://bugs.ruby-lang.org/issues/15030

* Author: v0dro (Sameer Deshmukh)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
After Integer unification in Ruby 2.4, I think it makes sense to introduce a T_INTEGER 
type that helps in directly testing if a Ruby object is an Integer in C API.

For example, currently we need to write `RB_TYPE_P(obj, T_FIXNUM)` for this purpose. 
However since ruby 2.4 onwards deprecates Fixnum and Bignum, I think it makes sense
to have a `T_INTEGER` type so that one can write `RB_TYPE_P(obj, T_INTEGER)` directly
to test for both 64-bit and > 64-bit integers.



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:88670] [Ruby trunk Feature#15030] Have T_INTEGER constant for checking Integer types in C API
       [not found] <redmine.issue-15030.20180827051206@ruby-lang.org>
  2018-08-27  5:12 ` [ruby-core:88666] [Ruby trunk Feature#15030] Have T_INTEGER constant for checking Integer types in C API sameer.deshmukh93
@ 2018-08-27  5:49 ` hanmac
  2018-08-27  6:05 ` [ruby-core:88672] [Ruby trunk Feature#15030][Rejected] " ko1
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hanmac @ 2018-08-27  5:49 UTC (permalink / raw
  To: ruby-core

Issue #15030 has been updated by Hanmac (Hans Mackowiak).


hm that is not that easy, while Fixnum and Bignum are deprecated on the ruby side,
on the C side they still exist

thats why a single T_INTEGER check might not work that way you want

----------------------------------------
Feature #15030: Have T_INTEGER constant for checking Integer types in C API
https://bugs.ruby-lang.org/issues/15030#change-73727

* Author: v0dro (Sameer Deshmukh)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
After Integer unification in Ruby 2.4, I think it makes sense to introduce a T_INTEGER 
type that helps in directly testing if a Ruby object is an Integer in C API.

For example, currently we need to write `RB_TYPE_P(obj, T_FIXNUM)` for this purpose. 
However since ruby 2.4 onwards deprecates Fixnum and Bignum, I think it makes sense
to have a `T_INTEGER` type so that one can write `RB_TYPE_P(obj, T_INTEGER)` directly
to test for both 64-bit and > 64-bit integers.



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:88672] [Ruby trunk Feature#15030][Rejected] Have T_INTEGER constant for checking Integer types in C API
       [not found] <redmine.issue-15030.20180827051206@ruby-lang.org>
  2018-08-27  5:12 ` [ruby-core:88666] [Ruby trunk Feature#15030] Have T_INTEGER constant for checking Integer types in C API sameer.deshmukh93
  2018-08-27  5:49 ` [ruby-core:88670] " hanmac
@ 2018-08-27  6:05 ` ko1
  2018-08-27 10:02 ` [ruby-core:88682] [Ruby trunk Feature#15030] " eregontp
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ko1 @ 2018-08-27  6:05 UTC (permalink / raw
  To: ruby-core

Issue #15030 has been updated by ko1 (Koichi Sasada).

Status changed from Open to Rejected

+1 for Hanmac.

C extension writers should check T_FIXNUM or T_BIGNUM explicitly.


----------------------------------------
Feature #15030: Have T_INTEGER constant for checking Integer types in C API
https://bugs.ruby-lang.org/issues/15030#change-73729

* Author: v0dro (Sameer Deshmukh)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
After Integer unification in Ruby 2.4, I think it makes sense to introduce a T_INTEGER 
type that helps in directly testing if a Ruby object is an Integer in C API.

For example, currently we need to write `RB_TYPE_P(obj, T_FIXNUM)` for this purpose. 
However since ruby 2.4 onwards deprecates Fixnum and Bignum, I think it makes sense
to have a `T_INTEGER` type so that one can write `RB_TYPE_P(obj, T_INTEGER)` directly
to test for both 64-bit and > 64-bit integers.



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:88682] [Ruby trunk Feature#15030] Have T_INTEGER constant for checking Integer types in C API
       [not found] <redmine.issue-15030.20180827051206@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2018-08-27  6:05 ` [ruby-core:88672] [Ruby trunk Feature#15030][Rejected] " ko1
@ 2018-08-27 10:02 ` eregontp
  2018-08-27 11:57   ` [ruby-core:88687] " Eric Wong
  2018-08-28  6:49 ` [ruby-core:88706] " ko1
  2018-08-31  8:16 ` [ruby-core:88780] " nobu
  5 siblings, 1 reply; 7+ messages in thread
From: eregontp @ 2018-08-27 10:02 UTC (permalink / raw
  To: ruby-core

Issue #15030 has been updated by Eregon (Benoit Daloze).


There are certainly cases where a C extension wants to check the argument is an Integer, and its range doesn't matter, isn't it?
Is there a macro to check for that easily?

----------------------------------------
Feature #15030: Have T_INTEGER constant for checking Integer types in C API
https://bugs.ruby-lang.org/issues/15030#change-73740

* Author: v0dro (Sameer Deshmukh)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
After Integer unification in Ruby 2.4, I think it makes sense to introduce a T_INTEGER 
type that helps in directly testing if a Ruby object is an Integer in C API.

For example, currently we need to write `RB_TYPE_P(obj, T_FIXNUM)` for this purpose. 
However since ruby 2.4 onwards deprecates Fixnum and Bignum, I think it makes sense
to have a `T_INTEGER` type so that one can write `RB_TYPE_P(obj, T_INTEGER)` directly
to test for both 64-bit and > 64-bit integers.



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:88687] Re: [Ruby trunk Feature#15030] Have T_INTEGER constant for checking Integer types in C API
  2018-08-27 10:02 ` [ruby-core:88682] [Ruby trunk Feature#15030] " eregontp
@ 2018-08-27 11:57   ` Eric Wong
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Wong @ 2018-08-27 11:57 UTC (permalink / raw
  To: ruby-core

eregontp@gmail.com wrote:
> There are certainly cases where a C extension wants to check the argument is an Integer, and its range doesn't matter, isn't it?
> Is there a macro to check for that easily?

```
Not currently, just two calls to RB_TYPE_P but that's a trivial
static inline wrapper (no macros when a static inline will do).

For case, statements, perhaps something like:

    #define case_T_INTEGER case T_FIXNUM: case T_BIGNUM

Along the same lines, I've used the following outside of Ruby
for dealing with EAGAIN/EWOULDBLOCK:

    #if defined(EWOULDBLOCK) && (EWOULDBLOCK != EAGAIN)
    #  define case_EAGAIN case EAGAIN: case EWOULDBLOCK
    #else
    #  define case_EAGAIN case EAGAIN
    #endif

    switch (errno) {
      case_EAGAIN: ...
      default: ...
    }
```

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:88706] [Ruby trunk Feature#15030] Have T_INTEGER constant for checking Integer types in C API
       [not found] <redmine.issue-15030.20180827051206@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2018-08-27 10:02 ` [ruby-core:88682] [Ruby trunk Feature#15030] " eregontp
@ 2018-08-28  6:49 ` ko1
  2018-08-31  8:16 ` [ruby-core:88780] " nobu
  5 siblings, 0 replies; 7+ messages in thread
From: ko1 @ 2018-08-28  6:49 UTC (permalink / raw
  To: ruby-core

Issue #15030 has been updated by ko1 (Koichi Sasada).


Eregon (Benoit Daloze) wrote:
> There are certainly cases where a C extension wants to check the argument is an Integer, and its range doesn't matter, isn't it?

For example?



----------------------------------------
Feature #15030: Have T_INTEGER constant for checking Integer types in C API
https://bugs.ruby-lang.org/issues/15030#change-73763

* Author: v0dro (Sameer Deshmukh)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
After Integer unification in Ruby 2.4, I think it makes sense to introduce a T_INTEGER 
type that helps in directly testing if a Ruby object is an Integer in C API.

For example, currently we need to write `RB_TYPE_P(obj, T_FIXNUM)` for this purpose. 
However since ruby 2.4 onwards deprecates Fixnum and Bignum, I think it makes sense
to have a `T_INTEGER` type so that one can write `RB_TYPE_P(obj, T_INTEGER)` directly
to test for both 64-bit and > 64-bit integers.



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:88780] [Ruby trunk Feature#15030] Have T_INTEGER constant for checking Integer types in C API
       [not found] <redmine.issue-15030.20180827051206@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2018-08-28  6:49 ` [ruby-core:88706] " ko1
@ 2018-08-31  8:16 ` nobu
  5 siblings, 0 replies; 7+ messages in thread
From: nobu @ 2018-08-31  8:16 UTC (permalink / raw
  To: ruby-core

Issue #15030 has been updated by nobu (Nobuyoshi Nakada).


Use `RB_INTEGER_TYPE_P()`.

----------------------------------------
Feature #15030: Have T_INTEGER constant for checking Integer types in C API
https://bugs.ruby-lang.org/issues/15030#change-73825

* Author: v0dro (Sameer Deshmukh)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
After Integer unification in Ruby 2.4, I think it makes sense to introduce a T_INTEGER 
type that helps in directly testing if a Ruby object is an Integer in C API.

For example, currently we need to write `RB_TYPE_P(obj, T_FIXNUM)` for this purpose. 
However since ruby 2.4 onwards deprecates Fixnum and Bignum, I think it makes sense
to have a `T_INTEGER` type so that one can write `RB_TYPE_P(obj, T_INTEGER)` directly
to test for both 64-bit and > 64-bit integers.



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-08-31  8:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-15030.20180827051206@ruby-lang.org>
2018-08-27  5:12 ` [ruby-core:88666] [Ruby trunk Feature#15030] Have T_INTEGER constant for checking Integer types in C API sameer.deshmukh93
2018-08-27  5:49 ` [ruby-core:88670] " hanmac
2018-08-27  6:05 ` [ruby-core:88672] [Ruby trunk Feature#15030][Rejected] " ko1
2018-08-27 10:02 ` [ruby-core:88682] [Ruby trunk Feature#15030] " eregontp
2018-08-27 11:57   ` [ruby-core:88687] " Eric Wong
2018-08-28  6:49 ` [ruby-core:88706] " ko1
2018-08-31  8:16 ` [ruby-core:88780] " nobu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).