From: matz@... (Yukihiro Matsumoto) Date: 2003-02-22T13:58:24+09:00 Subject: Re: Does Struct#to_a guarantee the order of the values Hi, In message "Does Struct#to_a guarantee the order of the values" on 03/02/22, Tim Hunter writes: |Suppose I use Struct to generate a class and then create an instance |of the class like this: | |F = Struct.new('F', :x, :y, :z) |f1 = F.new(1,2,3) | |Can I be sure that f1.to_a returns [1,2,3] and never [3,2,1] or |[2,3,1]? That is, does F#to_a guarantee that the values in the array |are in the same order that the instance variables were specified to |Struct.new? | |Same for F#members. Will the strings in the array be in the same order |that the symbols were specified to Struct.new? Yes. Struct is array (not hash) with symbolic index. matz.