It seems that it's not possible to use the unary +@ operator for Fixnum
in a "short form" way :
class Fixnum
def +@
puts "YES #{self}"
end
end
=> nil
+50
=> 50 # Unexpected result : should print YES 50
+(50)
YES 50
=> nil
Although, the +(fixnum) form is working... i wish i could use the
shorter form!
I suspect Ruby's parser to perform some unexpected "optimization"
here...
--
Posted via http://www.ruby-forum.com/.