This code does produce an error (SystemStackError: stack level
too deep), since you recursively call the instance method b
(which _is_ defined).
From previous posts I assume you are not using MRI; that might
be the reason why the code behaves differently for you.
If so, you should mention that in your posts, or even better
always test "problematic" code with MRI.
Regards,
Marcus
···
Am 07.08.2016 um 14:56 schrieb A Berger:
Why are there NO errors shown for undefined b (and x2) ?
class A
def b
33
puts 99, b
end
end
#puts x1 ## would be an error
puts A.new.b
puts x2 ## no error? Seems never reached?!!