Why we have implicit receiver in Ruby?

Hello Guys

I have 2 questions regarding Ruby core OOP concepts.

  1. I understand clearly about the differences between explicit call (i.e. with self) and implicit call (i.e. without initialized class object or self in an instance method) of a method. But only question that creates confusion sometimes is that when we have explicit receivers that does very neat and clear job of receiving a method with self (since it refers current object) rather than implicit (which I believe is very uncertain in situations like when to use method or variable of same name initialized) then why we still have to call methods implicitly? I mean is it just a preference or is it necessary because of proper usage of Private and Public methods?.

  2. Just to get cleared here that in general OOP Private methods are bound within the class itself and cannot be accessed in subclasses or outside however those methods which need to be private but also need to be accessed in subclasses then protected methods are used over there. But in Ruby both Private and Protected methods are accessed in inherited class and only difference is that private methods can only be called implicitly and protected methods can either be called implicitly or explicitly. So I don’t understand the philosophy over here that only because of implicit calling functionality in ruby, General definitions of Private methods differs?

Please clear me if I am wrong somewhere.

Thank You

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.