On 04/28/2011 01:24 PM, Brian Candler wrote:
> Thanks for all the feedback, at least I know I hadn't missed something
> obvious :-)
>
> I found an interesting thread here too:
> http://www.ruby-forum.com/topic/67759

Tangentially, I wonder if anything like the following (very rough proof 
of concept) has been used instead of Struct.

class Hash
   def structify!
     keys.each do |key|
       class << self; self; end.class_eval do
         define_method key do
           fetch key
         end
         define_method "#{key}=" do |val|
           store key, val
         end
       end
     end
   end
end

h = {:foo => 1, :bar => 2}
h.structify!
p h.foo # 1
h.foo = 3
p h.foo # 3
p h     # {:foo=>3, :bar=>2}
p h.oof # undefined