R
Robert Dober
I just stumbled upon this, not sure what is going on here. BTW Ruby,
Ruby1.9 and JRuby behave all the like.
546/46 > cat syntax.rb && echo "--->" && ruby syntax.rb
module M
def % z
puts z
end
extend self
self % "Top" # Line Fourty Two
end
extend M
% "Hi"
send "%", "Low"
o = Object.new.extend M
o % "Bottom"
--->
Top
Low
Bottom
---------------------------------------------------------------------
Additionally if you remove self from line Fourty Two, you get a synatx error.
syntax.rb:9: syntax error, unexpected tCONSTANT, expecting kEND
syntax.rb:13: syntax error, unexpected $end, expecting kEND
---------------------------------------------------------------------
I am quite puzzled, any explanations?
Cheers
Robert
Ruby1.9 and JRuby behave all the like.
546/46 > cat syntax.rb && echo "--->" && ruby syntax.rb
module M
def % z
puts z
end
extend self
self % "Top" # Line Fourty Two
end
extend M
% "Hi"
send "%", "Low"
o = Object.new.extend M
o % "Bottom"
--->
Top
Low
Bottom
---------------------------------------------------------------------
Additionally if you remove self from line Fourty Two, you get a synatx error.
syntax.rb:9: syntax error, unexpected tCONSTANT, expecting kEND
syntax.rb:13: syntax error, unexpected $end, expecting kEND
---------------------------------------------------------------------
I am quite puzzled, any explanations?
Cheers
Robert