Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #3071

Undefine Method Only Marks the Method Undefined

From Su Zhang <zhangsu@live.com>
Newsgroups comp.lang.ruby
Subject Undefine Method Only Marks the Method Undefined
Date 2011-04-17 17:37 -0500
Organization Service de news de lacave.net
Message-ID <c362ab059556406ae9960b3915006349@ruby-forum.com> (permalink)

Show all headers | View raw


Hello,

According to the book Programming Ruby by Dave Thomas, "an
undefined method still exists - it is simply marked as being undefined."
Why is it not completely removed?

I find this somewhat related to the fact that an object still cannot be
dumped after "undefing" its singleton methods.

obj = Object.new

def obj.foo
end

p obj.respond_to? :foo  # => true

class << obj
  undef foo
end

p obj.respond_to? :foo  # => true

Marshal.dump(obj)       # => error

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Undefine Method Only Marks the Method Undefined Su Zhang <zhangsu@live.com> - 2011-04-17 17:37 -0500
  Re: Undefine Method Only Marks the Method Undefined Michael Edgar <adgar@carboni.ca> - 2011-04-17 18:11 -0500
  Re: Undefine Method Only Marks the Method Undefined Josh Cheek <josh.cheek@gmail.com> - 2011-04-17 18:11 -0500
  Re: Undefine Method Only Marks the Method Undefined Su Zhang <zhangsu@live.com> - 2011-04-17 19:11 -0500

csiph-web