[ruby-core:88686] [Ruby trunk Feature#15031] T_RANGE for testing whether object is a Range

From: sameer.deshmukh93@...
Date: 2018-08-27 11:45:13 UTC
List: ruby-core #88686
Issue #15031 has been updated by v0dro (Sameer Deshmukh).


ko1 (Koichi Sasada) wrote:
> `rb_obj_is_range()` can be accepted like `rb_obj_is_proc` and so on.
> `T_xxx` shows data layout of `RVALUE`.

Sure :)

----------------------------------------
Feature #15031: T_RANGE for testing whether object is a Range
https://bugs.ruby-lang.org/issues/15031#change-73743

* Author: v0dro (Sameer Deshmukh)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Range is an in-built type of Ruby and it would be better for C extension
writers if there existed a constant `T_RANGE` that could be directly used
for checking whether a `VALUE` is a `Range`.

Currently we need to write `CLASS_OF(obj) == rb_cRange` in order to make this
happen. Having a `T_RANGE` would help in making C code more idiomatic and fast
in some cases.

That way, one can write `RB_TYPE_P(obj, T_RANGE)`.



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

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next