[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Underpinnings of Method Wrapping

T. Onoma

11/28/2003 9:11:00 PM

Its important that we clearly seperate the issue of "surface" syntax from the
underlying machanics of method wrapping. We can pretty much use any notation
that is decided upon. But then how does it work underneath the hood?

My proposal, irregardless of the (IMHO elegant) syntax it presents, has a
solid and tried implementation behind it. This fact may easily go overlooked.
So i just want to take a second and specify that here.

It works simply by using a natural extension to singletons. In fact, I spent
the day hacking the Ruby source code to implement "meta-singletons".
Basically, it allows you to define singletons on singletons (on singletons)
etc. This implements a stackable wrap. And it optimizes wraps by only
creating a new metaclass layer when necessary. (see Pickaxe p245 end of
Object-Specific Classes) That's all there was to it.

If we extend this facility to handle pre and post and give singletons a class
literal syntax, plus some lower level methods for manuipulating the
stack....well, that should do it.

Thoughts?

-t0