slindsey3000
slindsey3000

Reputation: 4271

Top level methods: Why they become private instance methods in Object? Why not public?

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?

Upvotes: 2

Views: 119

Answers (1)

slindsey3000
slindsey3000

Reputation: 4271

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.

Upvotes: 1

Related Questions