# from Christopher J. Madsen
# on Saturday 15 March 2008 23:43:

>>This seems like it provides a lot of room
>> for subtle bugs.  How would a plugin declare that it is incompatible
>> with another or otherwise avoid the silent error of "only one of my
>> plugins ran"?
>
>I don't think it would.  That's up to the person selecting the plugins
>to run.  Hopefully, user & system level plugins would be used only for
>things unlikely to conflict with other plugins.

It is still difficult to debug, regardless of hope or intent.  If the 
user breaks something via their config, a loud and obvious error should 
result.

Similarly, maybe the priority should simply be by load-order.  At least 
then a plugin which knows it is incompatible with another can make 
noise.  Still it might be nice to have the noise created via some 
mechanism in the registration (e.g. "conflicts => {Foo => '<= 0.2'}".)

>I don't think many pre hooks will need to short-circuit evaluation.
>  But I think it needs to be possible to prevent the default method
> from being called.  I suppose we could say that if a pre hook
> short-circuits, the remaining pre hooks are still called (but any
> values they try to return would be ignored) and only the default
> method gets skipped.  But I'm not sure that's better.

Maybe the short-circuit (bypassing/replacing the default method) should 
just be defined differently.  That is: replace_METHOD() or something 
and only allow one definition of it.

A few concrete examples would certainly help me work through that logic.

I suppose ACTION_code() or ACTION_dist() would be good examples.  If 
these are modifying files on disk, a bypass probably means that none of 
the other hooks should run.  Further, what are the pre and post hooks 
typically doing in such a case?

When it comes to copying files, a cleaner scheme might be to install a 
chain of filter subs which get each file and take/return a list of 
lines.  But that's quite a bit different than a hook which just e.g. 
copies or generates some extra files or adds a depends().

--Eric
-- 
hobgoblin n 1: (folklore) a small grotesque supernatural creature that
          makes trouble for human beings
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------

Reply via email to