From: Ken Bloom Date: 2008-12-06T01:32:12+09:00 Subject: [ruby-core:20378] Re: Behavior: autoload calls rb_require() directly On Thu, 04 Dec 2008 16:51:10 +0900, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: [ruby-core:20217] Re: Behavior: autoload calls > rb_require() directly" > on Wed, 3 Dec 2008 02:57:13 +0900, Dave Thomas > writes: > > |If you're worried about fragility, then isn't the ability to redefine > |Fixnum#+ more of an issue? > > I mentioned about fragility just because that will be an issue for Ruby > 2.0. For MRI replacing core methods affect less, just because core > functionality is done by C functions. But implantation like Rubinius > suffers more. I think we will soon need to start discussing > separating/protecting core implementation from user code by some kind of > namespaces or packages. > > matz. Actually, you can already see this kind of fragility in irb. There are lots of things that I might redefine while working in IRB, just because I want to see how they work. If they break something IRB depends on, then IRB will throw an exception and exit immediately. The simplest case I can think of at the moment: [bloom@cat-in-the-hat ~]$ irb irb(main):001:0> $SAFE=4 /usr/lib/ruby/1.8/irb.rb:265:in `signal_status': Insecure: can't modify instance variable (SecurityError) from /usr/lib/ruby/1.8/irb.rb:147:in `eval_input' from /usr/lib/ruby/1.8/irb/ruby-lex.rb:244:in `each_top_level_statement' from /usr/lib/ruby/1.8/irb/ruby-lex.rb:230:in `loop' from /usr/lib/ruby/1.8/irb/ruby-lex.rb:230:in `each_top_level_statement' from /usr/lib/ruby/1.8/irb/ruby-lex.rb:229:in `catch' from /usr/lib/ruby/1.8/irb/ruby-lex.rb:229:in `each_top_level_statement' from /usr/lib/ruby/1.8/irb.rb:146:in `eval_input' from /usr/lib/ruby/1.8/irb.rb:70:in `start' from /usr/lib/ruby/1.8/irb.rb:69:in `catch' from /usr/lib/ruby/1.8/irb.rb:69:in `start' from /usr/bin/irb:13 [bloom@cat-in-the-hat ~]$ -- Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/