--- copy_object(obj)

    ruby 1.7 feature

    self  obj Ƥ֤ޤself Υ
    ѿðۥ᥽åɤѲޤ

    쥷Ф freeze Ƥ뤫obj Υ饹쥷
    Υ饹ȾȤʤ㳰 TypeError ȯޤ

    ǥեȤǤ(Object#copy_object )嵭 freeze å
    ӷΥåԤ self ֤Υ᥽åɤǤ

    obj.dup ϡ֥ȤФ 
    copy_object Ƥ

        obj2 = obj.class.allocate
        obj2.copy_object(obj)

    obj2 ФƤ obj α֡󥹥ѿեʥ饤
    򥳥ԡ뤳Ȥʣޤclone ϡ
    ðۥ᥽åɤΥԡԤޤ

        obj = Object.new
        class <<obj
          attr_accessor :foo
          def bar
            :bar
          end
        end

        def check(obj)
          puts "instance variables: #{obj.inspect}"
          puts "tainted?: #{obj.tainted?}"
          print "singleton methods: "
          begin
            p obj.bar
          rescue NameError
            p $!
          end
        end

        obj.foo = 1
        obj.taint

        check Object.new.copy_object(obj)
                # => instance variables: #<Object:0x4019c9d4>
                #    tainted?: false
                #    singleton methods: #<NoMethodError: ...>
        check obj.dup
                # => instance variables: #<Object:0x4019c9c0 @foo=1>
                #    tainted?: true
                #    singleton methods: #<NoMethodError: ...>
        check obj.clone
                # => instance variables: #<Object:0x4019c880 @foo=1>
                #    tainted?: true
                #    singleton methods: :bar

    copy_object ϡRuby 󥿥ץ󥿤Τʤ򥳥ԡ뤿
    ˻()ޤ㤨 C ǥ饹硢
    򥤥󥹥ѿݻʤ礬ޤä
     copy_object ǥԡ褦ƤȤǡdup  clone 
    ɬפʤʤޤ

