------ art_50118_4434524.1159806785864 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 10/2/06, Trans <transfire / gmail.com> wrote: > > > > At times I have had such thoughts too. After all Ruby is largely a > Document and Test oritented language b/c of it's high degree of > dynamicisim. There is at least one feature of the private/protected vs. > public system that is valuable though: you can catch public calls via > method_missing even when there are private/protected methods defined. > Eg. > > class X > def method_missing( name ); name; end > private > def bird; "hoot!"; end > end > > x = X.new > x.bird #=> "bird" > x.send(:bird) #=> "hoot!" > > I only recently came to understand this myself and it made a big > difference in how I handled certain usecases of method_missing. Unless > you see a better way to hadle this, then I think the private/protected > vs. public distiguish it useful. > > As a side note, I sure would like to see class/module local methods > (not part of inheritance chain) if possible. > > T. Very nice behavior, I do not know what exactly you mean with a class/local method, maybe the following, which mimicks truely private methods. class A @@_I_am = self def method_missing( name, *args, &blk ) raise NoMethodError,"undefined method '#{name}' for #{self}" unless instance_of? @@_I_am send(name, *args, &blk) end private def hello p 42 end end would be a base for what you want? Cheers Robert -- Deux choses sont infinies : l'univers et la bóŐise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------ art_50118_4434524.1159806785864--