On Sun, 18 Feb 2007, Stefan Rusterholz wrote:

> Care to explain why you chose defining a method with the sole purpose of
> raising an exception over removing the method instead?

yes - for illustration  ;-)

a simpler example

   harp:~ > cat a.rb
   require 'singleton'

   a = Object.new.instance_eval{ @x = 42 and self }
   p a.dup

   a.instance_eval{ class << self; include Singleton; end }
   p a.dup


   harp:~ > ruby a.rb
   #<Object:0xb75cbb44 @x=42>
   /home/ahoward//lib/ruby/1.8/singleton.rb:71:in `dup': can't dup instance of singleton Object (TypeError)
           from a.rb:7


this is a side effect of strong dynamic type systems: the interpreter/compiler
cannot know until runtime if a methods signature makes sense becaues there are
an infinite variety of ways the semantics of a msg sent to an object might
change betweent two transmissions to the same object.  if you don't like this
there are two choices:

   - use language with a strong static type system.  this rules out python,
     java, c++, c, perl, lisp, and smalltalk

   - dispair

regards.

-a
-- 
we can deny everything, except that we have the possibility of being better.
simply reflect on that.
- the dalai lama