On Wed, Sep 05, 2007 at 03:19:02PM +0200, Richard Levitte wrote: > In message <[EMAIL PROTECTED]> on Wed, 5 Sep 2007 13:54:23 +0100, Matthew > Sackman <[EMAIL PROTECTED]> said: > matthew> Each hook can return one of three values: everything ok; > matthew> non-fatal error; fatal error. > > Good. We need to decide how that should work, because nil doesn't > necessarely imply an error (let alone that it doesn't describe the > fatality of an error).
Right, so if it was Haskell and not lua then it'd be (a, ErrorStatus) where a is polymorphic in the type of the result of the hook. I suggest something similar - a tuple where one indicates the result of the hook (or nil if no result) and the other indicates the error. But this opens up a large pot of worms. If the hook is some sort of "does x have permission to do y" then when do you stop? Is it a conjunction or disjunction of results? Or is it a 3-valued logic and you just go through the list of hooks until you find a definitive True/False? In which case, what happens if all functions return "meh"? Bother. Maybe this should only be permitted on hooks that don't return a result. It makes in rather easier... simplest thing first and all that? > matthew> > - Do we want a third function that returns information > matthew> > about a hook, such as how many functions are attached and > matthew> > their identities (the id returned by add_hook()), and > matthew> > whatever other data there may be. > matthew> > matthew> How do imagine this to be used? I don't see the value of it > matthew> from the hook's perspective, and whilst it could be valueable > matthew> to a user, if the user doesn't know what hooks they have > matthew> registered then they have other problems. > > Right, and all users are always aware of what is in /etc/monotonerc... Well quite. Matthew _______________________________________________ Monotone-devel mailing list Monotone-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/monotone-devel