>>>>> "Matthias" == Matthias Lampert <ml / sph.de> writes:

    Matthias> There are people who miss a feature like
    Matthias> abstract/virtual classes in Ruby.  I was one of them, I
    Matthias> admit.

    Matthias> By the time I learned, though, that I could implement
    Matthias> this feature myself.  Just like here.

I did something similar at one point.  I didn't bother with the
constructor check, but I did implement a module method named
"abstract" that was used much like attr_reader and attr_accessor.  For
example...

    class Abstract
      def do_something
        an_abstract_method
      end

      abstract :an_abstract_method
    end

Declaring a method to be abstract was equivalent to defining it like
this...

    def an_abstract_method
      fail "Abstract method an_abstract_method called"
    end

Other than giving a more explicit error message, the effect was much
the same.  Forgetting to define an abstract method would cause an
exception.  The major benefit in my mind was that the abstract method
was clearly documented for the readers of class Abstract.

I didn't end up using the concept.  It didn't work cleanly when trying
to use mixins to define abstract functions.

If someone is interested, I can dig up the code for it (although it
isn't hard to write from scratch).

-- 
-- Jim Weirich     jweirich / one.net    http://w3.one.net/~jweirich
---------------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct, 
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)