From: William Djaja Tjokroaminata Date: 2002-09-17T03:51:58+09:00 Subject: Re: Is Ruby Array#shift/unshift Efficient? Hi Matz, Thanks a lot for the response. Now this is a general question to anyone. In the field of data structures, there are so many of them, and each one is efficient for certain types of operation. However, it seems that most scripting languages provide only array and hash, like Ruby, Python, and Perl. The original Tcl still provided array, list, and hash. Some other languages like Lua even provides only hash. In using a scripting language, aren't we concerned with the underlying data structure itself? Is the answer: 1) Beside array and hash, other data structures are not "practical", in the sense that they are very rarely used. 2) In a scripting language, the efficiency of array vs. list is immaterial as compared with the overhead of the scripting language itself. 3) Or something else? I think this is interesting, as in C++ I always have to decide at least to use a vector or a list (or even a deque) when I need an ordered collection. But in Ruby, there is no such choice (at least using the built-in classes). Regards, Bill ============================================================================= Yukihiro Matsumoto wrote: > |For the next stable release of Ruby (with shift() fixed), will these two C > |calls still be valid: > | > | len = (long) RARRAY (someArray)->len; > | obj = rb_ary_entry (someArray, i); > Yes. > matz.