From: Joel VanderWerf Date: 2003-05-16T06:26:33+09:00 Subject: Re: public/protected/private syntax Guillaume Marcais wrote: > I tend to find the public/protected/private keywords in Ruby a little odd. > They don't seem to fit the Ruby syntax. What about the following syntax (for > Ruby 3.0 :)? The scope of the method would be known by the first caracters of > its name, the same way as the scope of a variable is determined by $, @, @@ > or nothing. So: > > class Test > def method1; end # public method > def _method2; end # protected method > def __method3; end # private method > end But, in ruby, many methods that you can use without a receiver are in fact private methods of all objects. For example, #puts, #gsub, #require, #fork, ... (most if not all of these are actually inherited from Kernel). That means you would have to type __require 'mylib' all the time.