Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

And the object responds to the "foo" message by calling a method.

The difference is whether we're discussing the invocation or the response. OP's usage of method isn't incorrect in this case if it's discussing the response. It is true that all message responses (including accessors) are implemented using methods.



> It is true that all message responses (including accessors) are implemented using methods.

An object can respond to a message even though it doesn't have a method with that name. A classic example are Rails' dynamic finders:

  User.methods.include?(:find_by_name)
   => false
  User.respond_to?(:find_by_name)
   => true


> An object can respond to a message even though it doesn't have a method with that name.

Sure, by using a different method (method_missing); its still all method calls.


Yes and the responses are implemented with methods. Always.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: