If I say
x.hello()
In Java, object x is “calling” the method it contains.
In Ruby, object x is “receiving” the method it contains.
Is this just different terminology for expressing the same idea or is there a fundamental difference in ideology here?
Coming from Java I find Ruby’s “receiver” idea quite baffling. Perhaps someone could explain this in relation to Java?
In your example
xis not callinghello(). Whatever object contains that snippet is “calling” (i.e., it’s the “caller”). In Java,xcan be referred to as the receiver; it is receiving the call to thehello()method.