-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Private method support #593
Comments
can you elaborate a bit on the using the exact same specification would, for example, disallow calling private methods of an instance of a given class, from another instance of the same class. this is fine, although I think it should be designed very carefully. protected access level is in fact designed, in Ruby, to allow the behavior above, although, at the same time, Ruby has a very different (much more liberal) idea of public/private compared to, say, Java. |
According to https://twitter.com/yukihiro_matz/status/180090910451834881, Matz feels that |
Personally, prohibiting the overriding ancestor classes's private Using private Using Of course I respect @st0012's final decision 😄 FYI: Ruby's specification for |
I'm personally fine with any solution. The crucial concept is that it's made clear that under the stated conditions:
it's acceptable that the following code is impossible to run: class Sphere
def bigger_than?(other)
volume_in_internal_measure_unit > other.volume_in_internal_measure_unit
end
# following is private method
def volume_in_internal_measure_unit
some_calculation + some_constant
end
end this is acceptable, it's just a design choice to keep in mind. Ruby, for example, tends to be more "public" in terms of methods accessibility, than Java (this example of private method call is very frequent in Java). |
Will implement this in version |
_
prefix instead ofprivate
keyword. Andprotect
won't be support.send
to call private methodsThe text was updated successfully, but these errors were encountered: