What is the reasoning behind making top level methods in Ruby private instance methods of Object? If they were somehow made public how would that change things?
Asked
Active
Viewed 116 times
2
-
Okay, I just realized that if top level methods were mixed into Object as public methods this would allow you to send any object this message. This would be counter intuitive. Leaving this up in case anyone Googles it with same question. – slindsey3000 Nov 30 '11 at 00:27
-
It is perfectly acceptable and even considered good style to answer your own question on StackOverflow. *You* figured it out, you *deserve* the reputation. Plus, if anyone *does* google this same question, it won't show up as "unanswered". – Jörg W Mittag Nov 30 '11 at 02:27
-
@JörgWMittag: Hopefully it'll become an answer, but slindsey has only 58 rep at the moment, and you need 100 rep to self-answer within 8 hours, according to http://meta.stackexchange.com/questions/86185/minimum-reputation-for-answering-your-own-question-should-be-higher-than-what-is/86186#86186 – Andrew Grimm Nov 30 '11 at 03:17
-
@JörgWMittag: He also has to wait 8 hours to post an answer according to http://meta.stackoverflow.com/privileges/edit-community-wiki – Andrew Grimm Nov 30 '11 at 05:27
-
Can you answer your question now? – Andrew Grimm Mar 27 '12 at 23:23
1 Answers
1
If top level methods were mixed into Object as public methods this would allow you to send any object this message. This would be counter intuitive.

slindsey3000
- 4,053
- 5
- 36
- 56