On Saturday 27 November 2004 01:37 pm, Florian Gross wrote:
| trans. (T. Onoma) wrote:
| > So I was thinking/wondering if it were possible to have an a variant
| > initializer that _always_ calls super? it would make sense to have one
| > for both begin and end positions. So the above example becomes:
| >
| >   module Example
| >     def initialize_pre
| >       @examples = []
| >     end
| >     def add( ex )
| >       @examples << ex
| >     end
| >   end
|
| Rite will have AOP-style method:pre, :post and :wrap hooks. However I'd
| also like to see a solution for this quite common problem before the
| release of Ruby 2. Maybe there already is a good way of doing this that
| I'm just not aware of.

I doubt that's a good thing. To me pre, post and wrap are pretty much hacks. 
And I do not believe these hooks will even work here. Consider:

  module M
    def initialize:pre
      print "A"
    end
    def initialize
      print "M"
    end
  end

  class C
    include M
    def initialize
      super
      print "C"
    end
  end

  C.new ; puts

what will be the output?

T.