From: matz@... (Yukihiro Matsumoto) Date: 2000-05-02T18:43:19+09:00 Subject: [ruby-talk:02614] Re: Structs and dictionary keys Hi, In message "[ruby-talk:02613] Structs and dictionary keys" on 00/05/02, Wes Nakamura writes: |What's the purpose of the name when you create a new Struct? | |>From the docs: | |dog = Struct.new("Dog", :name, :age) | |Can you reference something via the name "Dog"? It will be the name of the newly created subclass of Struct. You can access it like Struct::Dog. If you want to leave struct unnamed, just remove first string argument (for 1.5.x) . e.g. dog = Struct.new(:name, :age) |Also, are frozen arrays suitable for dictionary keys? | |Will the second [1,2] always dereference properly? | | { [1,2].freeze => "test" }[[1,2]] Yes. |I know that if you don't freeze the key and then change it, apparently |you can't access the value via the key at all anymore. Use 'rehash' method of Hash class to make them accessible again. matz.