[libxml-devel] << operator
Charlie Savage
cfis at savagexi.com
Thu Aug 21 15:23:13 EDT 2008
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://rubyforge.org/pipermail/libxml-devel/attachments/20080821/fc9140fe/attachment.bin>
More information about the libxml-devel
mailing list