19

Python lists are implemented by CPython as amortized arrays. How are are Ruby arrays implemented, and for which implementations?

EDIT:

Partial answer here.

4
  • 5
    The source code is available. Have you looked at it? Is there something in there that you don't understand? Commented Nov 14, 2011 at 7:51
  • 7
    Use the source, Luke: github.com/ruby/ruby/blob/trunk/array.c Commented Nov 14, 2011 at 8:01
  • 7
    @muistooshort Why don't you look at array.c and check for yourself? The source is legible, but the macros and multitude of stdlib wrappers doesn't make a quick read. (Besides which, I'm a C programmer, but not all newcomers to Ruby are.) This is the type of question that I would think a Rubyist can answer in an instant, but would take me significantly longer to research for each Ruby implementation. I can't comprehend the hostility and downvotes. Commented Nov 14, 2011 at 18:23
  • 15
    I have nominated this for reopening as this question is now the second link on google (after the source code) for "ruby dynamic array implementation". Frankly, the question is a good one, and lots of people are now coming here and seeing this ridiculous close reason ("not a real question"? really?) and rant about lack of research (frankly, I'm not a fan of reading C implementations of complex data structures, and I don't think most people are... yet I'm sure most Ruby experts are well aware of how the basic data structures of their language work and could answer this in a heartbeat). Commented Jul 6, 2016 at 16:21

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.