Complete set of callbacks

T

trans. (T. Onoma)

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.
 
J

Joel VanderWerf

trans. (T. Onoma) said:
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.
 
P

Peter

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
 
T

trans. (T. Onoma)

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.
 
T

trans. (T. Onoma)

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?

(Is Marshal singleton, BTW?)

Thanks,
T.
 
E

Eric Hodel

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?

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

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

Eric Hodel

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())
 
T

trans. (T. Onoma)

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())

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.
 
H

Hal Fulton

trans. (T. Onoma) said:
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
 
T

trans. (T. Onoma)

| > 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.

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

T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
474,161
Messages
2,570,892
Members
47,430
Latest member
7dog123

Latest Threads

Top