Here is a code snippet:

class Foo
        @a
        @b
        @reference
       
        def initialize()
            @reference = [@a, @b]
        end

        attr_writer :a, :b, :reference
        attr_reader :a, :b, :reference
end

f = Foo.new()
f.reference[0] = 1
puts f.a  #nil  WTF!

What I am trying to do is refer to an instance variable both by its 
index in some array, and also directly.

Any help would be greatly apreciated.

SH