Complete set of callbacks

Trying to put together a complete list of all potential callbacks:

Class creation Class#inherited (sort-of), or alias #new.
Class reopening/closing
Module creation
Module reopening/closing
Method definition Object#method_added
Singelton-Method definition Object#singleton_method_added
Constant assignment*
Global variable assignment Kernel#trace_var (sort_of)
Class variable assignment
Instance variable assignment
Local variable assignment
Module inclusion Module#included
Module extension Module#extend_object

*Constant assignment may include class and module creation.

See any anything I’m missing?

Thanks,
T.

Class creation Class#inherited (sort-of), or alias #new.

Class instantiation

Class reopening/closing
Module creation
Module reopening/closing
Method definition Object#method_added
^^^^^^
Method removal Module#method_removed
Method undef Module#method_undefined

Singelton-Method definition Object#singleton_method_added

Singleton-method deletion Object#singelton_method_removed
Singelton-method undef Object#singelton_method_undefined

Constant assignment*
Global variable assignment Kernel#trace_var (sort_of)
Class variable assignment
Instance variable assignment
Local variable assignment
Module inclusion Module#included
Module extension Module#extend_object

Maybe this last one should use Module#extended (according to Pickaxe II).

Peter

trans. (T. Onoma) wrote:

Trying to put together a complete list of all potential callbacks:

  Class creation Class#inherited (sort-of), or alias #new.
  Class reopening/closing
  Module creation
  Module reopening/closing
  Method definition Object#method_added
  Singelton-Method definition Object#singleton_method_added
  Constant assignment*
  Global variable assignment Kernel#trace_var (sort_of)
  Class variable assignment
  Instance variable assignment
  Local variable assignment
  Module inclusion Module#included
  Module extension Module#extend_object

  *Constant assignment may include class and module creation.

See any anything I'm missing?

Module#append_features
Kernel#method_missing
Module#const_missing

Then there are things like at_exit and set_trace_func.

Thanks Peter and Joel. Here's the rundown thus far.

  Class creation Class#inherited, AClass#new
  Class reopening/closing
  Module creation
  Module reopening/closing
  Method definition Module#method_added
  Method removal Module#method_removed
  Method undef Module#method_undefined
  Singelton-Method definition Object#singleton_method_added
  Singleton-method deletion Object#singelton_method_removed
  Singelton-method undef Object#singelton_method_undefined
  Constant assignment*
  Global variable assignment Kernel#trace_var**
  Class variable assignment
  Instance variable assignment
  Local variable assignment
  Module inclusion Module::included, Module#append_features
  Module extension Module::extended, Module#extend_object
  Missing Method Object#method_missing
  Missing Constant Module#const_missing
  Object Destruction ObjectSpace#*_finalizer
  Program Termination Kernel#at_exit

  * Constant assignment may encompass class and module creation (?)
  ** Actually a trace rather then a callback
  ++ set_trace_func is not included, it is a separate "universal" catch-all

Please help clarify which are instance methods (#) and which are class methods
(::). Are there any others, or does that cover the entire gambit?

Thanks,
T.

I see why I'm confused now. Take this example:

  --------------------------------------------------------- Marshal#dump

  <snip>

         o = Klass.new("hello\n")
         data = Marshal.dump(o)
         obj = Marshal.load(data)
         obj.sayHello #=> "hello\n"

Dump is being used as module/class method so shouldn't it be 'Marshal::dump' ?
The documentation says they are instance methods, but you can't initialize a
Marshal. What gives?

(Is Marshal singleton, BTW?)

Thanks,
T.

···

On Wednesday 17 November 2004 06:45 am, trans. (T. Onoma) wrote:

Please help clarify which are instance methods (#) and which are class
methods (::).

I've always used :: exclusively for constants, and . for methods.

I much prefer :: over . when referencing method names.

···

On Nov 17, 2004, at 5:51 AM, trans. (T. Onoma) wrote:

On Wednesday 17 November 2004 06:45 am, trans. (T. Onoma) wrote:
> Please help clarify which are instance methods (#) and which are class
> methods (::).

I see why I'm confused now. Take this example:

  --------------------------------------------------------- Marshal#dump

  <snip>

         o = Klass.new("hello\n")
         data = Marshal.dump(o)
         obj = Marshal.load(data)
         obj.sayHello #=> "hello\n"

Dump is being used as module/class method so shouldn't it be 'Marshal::dump' ?
The documentation says they are instance methods, but you can't initialize a
Marshal. What gives?

Er... I meant . (Class.class_method) over :: (Class::class_method())

···

On Nov 17, 2004, at 11:14 AM, Eric Hodel wrote:

I've always used :: exclusively for constants, and . for methods.

I much prefer :: over . when referencing method names.

Actually I knew what you meant b/c I agree. But that's something I've noticed
about Ruby, it tries to accommodate a lot of variant styles and tastes, like
{ ... } or do ... end, and the options to use parenthesis with methods or not
--many variations and ways to do the same things.

Nonetheless, I am still at a loss for what appears to me as documentation
errors in ri. I feel like I must be misunderstanding something, but I can't
see what it is.

T.

···

On Wednesday 17 November 2004 03:42 pm, Eric Hodel wrote:

On Nov 17, 2004, at 11:14 AM, Eric Hodel wrote:
> I've always used :: exclusively for constants, and . for methods.
>
> I much prefer :: over . when referencing method names.

Er... I meant . (Class.class_method) over :: (Class::class_method())

trans. (T. Onoma) wrote:

Nonetheless, I am still at a loss for what appears to me as documentation errors in ri. I feel like I must be misunderstanding something, but I can't see what it is.

My impression is that there are probably numerous small errors in ri.

I'm sure Dave corrects them as he/we find them. I don't know whether
there's any official reporting mechanism for them.

Hal

Thanks Hal. Puts my mind a bit more at ease to know it's not just me and my
craziness.

T.

···

On Wednesday 17 November 2004 06:09 pm, Hal Fulton wrote:

trans. (T. Onoma) wrote:
> Nonetheless, I am still at a loss for what appears to me as documentation
> errors in ri. I feel like I must be misunderstanding something, but I
> can't see what it is.

My impression is that there are probably numerous small errors in ri.

I'm sure Dave corrects them as he/we find them. I don't know whether
there's any official reporting mechanism for them.