Lazily registering hooks?

Martin Pool mbp at canonical.com
Mon May 31 03:18:22 BST 2010


On 31 May 2010 12:12, Robert Collins <robertc at robertcollins.net> wrote:
> Some things that I particularly like about the current hook system,
> and would really like preserved in any updates are:
>  - the hook point definitions are near the calling code
>  - the core doesn't care about what hooks exist, its generic
>  - plugins can define new hooks points as well as any other area

I think in this model we would keep all of them except the first.  I
can kind of see how it's useful to have hooks sorted near the code
that calls them, on the other hand it's useful to have hooks sorted
together so you can get an overview.  Presumably in branch.py you
could search through for references to hooks and then look them up
centrally...

It is important we not only be able to define new hook points but also
the metadata about them in plugins, and to also have that lazy loaded
when it's needed.  Just registering for a hook shouldn't necessitate
loading _either_ the hooked-in code or the code that calls the hook.

-- 
Martin <http://launchpad.net/~mbp/>



More information about the bazaar mailing list