Skip to content
  • Xavier Noria's avatar
    c5c0bb5a
    Restore the original order of const_added and inherited callbacks · c5c0bb5a
    Xavier Noria authored
    Originally, if a class was defined with the class keyword, the cref had a
    const_added callback, and the superclass an inherited callback, const_added was
    called first, and inherited second.
    
    This was discussed in
    
        https://bugs.ruby-lang.org/issues/21143
    
    and an attempt at changing this order was made.
    
    While both constant assignment and inheritance have happened before these
    callbacks are invoked, it was deemed nice to have the same order as in
    
        C = Class.new
    
    This was mostly for alignment: In that last use case things happen at different
    times and therefore the order of execution is kind of obvious, whereas when the
    class keyword is involved, the order is opaque to the user and it is up to the
    interpreter.
    
    However, soon in
    
        https://bugs.ruby-lang.org/issues/21193
    
    Matz decided to play safe and keep the existing order.
    
    This reverts commits:
    
        de097fbe
        de48e47d
    c5c0bb5a
    Restore the original order of const_added and inherited callbacks
    Xavier Noria authored
    Originally, if a class was defined with the class keyword, the cref had a
    const_added callback, and the superclass an inherited callback, const_added was
    called first, and inherited second.
    
    This was discussed in
    
        https://bugs.ruby-lang.org/issues/21143
    
    and an attempt at changing this order was made.
    
    While both constant assignment and inheritance have happened before these
    callbacks are invoked, it was deemed nice to have the same order as in
    
        C = Class.new
    
    This was mostly for alignment: In that last use case things happen at different
    times and therefore the order of execution is kind of obvious, whereas when the
    class keyword is involved, the order is opaque to the user and it is up to the
    interpreter.
    
    However, soon in
    
        https://bugs.ruby-lang.org/issues/21193
    
    Matz decided to play safe and keep the existing order.
    
    This reverts commits:
    
        de097fbe
        de48e47d
Loading