From: Peter Ertl Date: 2005-10-27T04:47:48+09:00 Subject: Re: how private is private in ruby? not a big deal.. i pretty much enjoy the freedom of ruby! I have years of java type safety and design pattern torture behind me and ruby is the light at the end of the tunnel :-) however, wouldn't it make sense to forbid Object#send when using a specific taint level? > --- Urspr�ngliche Nachricht --- > Von: James Edward Gray II > An: ruby-talk@ruby-lang.org (ruby-talk ML) > Betreff: Re: how private is private in ruby? > Datum: Thu, 27 Oct 2005 04:38:36 +0900 > > On Oct 26, 2005, at 2:32 PM, Peter Ertl wrote: > > > Why is this allowed / possible? > > > > class MyUltraSecretKeystore > > private > > def key > > return "nobody-should-read-this-ever" > > end > > end > > > > ks = MyUltraSecretKeystore.new > > > > $ puts ks.send(:key) > > > >> "nobody-should-read-this-ever" > >> > > > > *yuk* > > > > so I can just use [public] for _everything_ as well, right? > > It's true that there are many ways to bypass method scope. Ruby > trusts us to do the right thing. We consider things like send() and > instance_eval() to be tools. They are perhaps dangerous at times, > but they are also very powerful. It's a trade-off. > > If you're looking for iron-clad laws, Ruby's dynamic nature will > probably not appeal to you much. > > James Edward Gray II >