Hi Paul,

I think this is really a fundamental/philosophical question.  When we
create a Ruby object in C, should we create the C data from inner to
outer, or from outer to inner?  In standard C, it does not matter.  In
Ruby, because of the presence of garbage collector, however, it can make a
difference between a code which crashes and which does not.

If it is inner to outer, we need to use the stack.  If it is outer to
inner, we need to do two-step initialization.  Which is the better or even
probably the right way?  I am surprised that not many people have answers
or even opinions on this.  (Are we the C-writing Rubyist really a
minority?)

I don't think a "it does not matter" answer will be good, as this should
be one the disciplines in writing Ruby in C.  Without this discipline, the
resulting bug may be very hard to trace.

Regards,

Bill
=========================================================================
Paul Brannan <pbrannan / atdesk.com> wrote:
> In that case, if you really have a single outer object holding thousands
> of inner objects, then a two-step initialization might be best.  This is
> how an Array works; you first create the Array, and after it is created,
> you put objects into the Array.

> Paul