[Nitro] Aspects

transfire at gmail.com transfire at gmail.com
Thu Feb 22 13:11:24 EST 2007



On Feb 22, 4:53 am, "George Moschovitis"
<george.moschovi... at gmail.com> wrote:
> Dear devs,
>
> I pushed the psql patch to the repo. But please keep in mind that the repo
> version now uses a new aspects implementation that it still under
> construction. I am still working on this with Tom.

I've taken a look at the latest aspects.rb you sent me. I realize my
version was over barring in that it added special callbacks to every
method created --and the callbacks themsevles needed efficiency
improvements. But your version has functinal issues. For starters an
initialize method in a mixin is way too fragile. But most importantly,
having to depend on a setup call to do the wrapping is too unreliable.
As a generic tool it would mean having to call that method when ever
there's a chance that some new aspect may get called --and that's a
very slow and inefficent process.

The problem I think in general is that you are just writting this to
be good enough for your Nitro/Og apps. But I have to think about it in
terms of a general purpose tool. Thankfully, with a little patience, I
know we can find a solution that satisfies both our criteria. Also, it
may be a good topic to bring up on ruby-talk to see what insights
others might offer.

For anyone else reading this not familiar with aspects.rb and
wondering what we're talking about, the basic question is this:

  before :some_method, :do_this_method

  after :some_method, :do_this_method

The interface is a little more complicated than this, but that the
basic idea. It's just way to add method intercepts before or after
some method(s). The hardest part is being able to define these
intercepts for methods that may not even exist yet --so "aspects" can
be modular.

(aspects.rb doesn't seem like the best name for this lib, btw, since
by definition aspects are like modules; intercepts.rb would be better
considering what this lib does, but that's an aside issue at this
point.)

T.



More information about the Nitro-general mailing list