(2013/05/15 14:38), dbussink (Dirkjan Bussink) wrote:
> If we're changing something anyway, it makes far more sense to change to either RARRAY_AREF or rb_ary_entry in extensions. I also discussed this on irc (#ruby-core) with ko1 and he also agrees with me in that respect. 

My thoughts are:

  (1) rb_ary_entry() (and accessor APIs) is enough for most of case
      (except perforamance such as Hanmac said [ruby-core:55003])
      So I agree with dbussink that recooment such APIs for C ext
      programmer is good idea. For example, emphasize in README.ext.

  (2) similar to RARRAY_AREF().
      In fact, I want to replace all simple array reference
      with this macro. So I want to backport this macro
      (related macros).

  (3) I think RARRAY_PTR() is needed in a few cases for performance and
      usability with C functions.
      I want to introduce RARRAY_PTR_USE(ary, ptr, expr).
        /* example code */
        RARRAY_PTR_USE(ary, ptr, {
          memset(ptr, 0, RARRAY_LEN(ary));
        });
      In this macro, we can observe that `ptr' is live only in `expr'.

and

  (4) I'm negative to introduce RARRAY_PTR_RO().
      I don't think it helps, at least MRI.


Thanks,
Koichi

-- 
// SASADA Koichi at atdot dot net