Hi, 

From: ts <decoux / moulon.inra.fr>
Subject: Re: $SAFE = 3.5?
Date: Thu, 6 May 2004 17:07:19 +0900
Message-ID: <200405060807.i4687Dx16666 / moulon.inra.fr>
> svg% cat b.rb
> #!/usr/bin/ruby
> fp = open('hoge', 'w')
> wp = proc{|s| p $SAFE; fp.print(s)}
> 
> puts '========================='
> $SAFE = 4
> class << a = [12]
>    def to_s
>       $stderr.puts "coucou :-)"
>       super
>    end
> end
> wp.call(a)
> svg% 

Ok. You are a nice cracker. :-)
Well, how about this?
-----------------------------------------------------------------------
def foo(fp)
  wp = proc{|s| p $SAFE; fp.print(s)}
  proc{|s| $SAFE=4; wp.call(s.to_s)}
end
wp = foo(open('hoge', 'w'))

puts '========================='
$SAFE = 4
class << a = [12]
   def to_s
      $stderr.puts "coucou :-)"
      super
   end
end
wp.call([12])
wp.call(a)
-----------------------------------------------------------------------
-- 
                                  Hidetoshi NAGAI (nagai / ai.kyutech.ac.jp)