From: kjana@...4lab.to (YANAGAWA Kazuhisa) Date: 2002-10-08T20:53:22+09:00 Subject: Re: Clearing arrays etc. in extensions In message <200210080230.g982UiY10524@sharui.nakada.kanuma.tochigi.jp> nobu.nokada@softhome.net writes: > > or simply set the len > > field to 0. > > If you modify an object directly, it's better to call > rb_check_frozen(). Cheking whether frozen or not, in iteration or not, $SAFE permits modifying the array or not. Then set len 0, and resize the underlying bin if necessary. That's what done in rb_ary_clear(), implementing Array#clear and is exported for C extension in intern.h :-) I've look ruby-1.6.7 and -1.7.2. Perhaps more older version also have the external declaration. -- kjana@dm4lab.to October 8, 2002 Out of sight, out of mind.