From: Laurent Sansonetti Date: 2008-03-15T09:40:15+09:00 Subject: RARRAY_PTR Hi, Currently, ruby.h defines RARRAY_PTR as a macro to access the internal C array of the RArray structure (which represents the Array class). This macro is used in many places in the Ruby code (and extensions) to get an element at a particular index VALUE v = RARRAY_PTR(ary)[42]; But some people also use it to set values RARRAY_PTR(ary)[0] = Qnil; I think this macro is dangerous because it exposes too much internals. Also, it is difficult to re-implement RArray using a different storage structure and efficiently support this macro at the same time. In MacRuby I am working on a new implementation of the Array class and will not be able to support this macro for inline modifications. I therefore suggest to introduce the following macros: RARRAY_GET_AT(ary, idx) ... RARRAY_SET_AT(ary, idx, value) ... (The names can be changed of course.) And start to deprecate RARRAY_PTR. Thoughts? RSTRING_PTR is perhaps another case, if people use it to modify the internal buffer. But as long as it's read-only it's safe I think. Laurent