A contrived example, but this code absolutely irritates the shit out of me:

Class F
  def a=(b)
    @z = b + 1
    return @z
  end
  def a
    return @z
  end
end

f = F.new
x = f.a = 1
p f.a  # Prints 2
p x    # Prints 1

That's bizarre. What is going on there? Print statement show that def a= is called before def a, so can x ever be set to 1?

Charlie

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to