Re: check/0 hook
Jan Wielemaker <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 12/25/2013 03:53 AM, Michael Hendricks wrote: > I want check/0 to perform some additional checks when one of my libraries > is loaded. For example, if one uses library(mavis), check/0 might check > for goals which fail because of trivial type violations, in addition to the > checks performed already. > > Is a patch likely to be accepted which adds a multifile predicate like > > check:check_hook(Description, Goal). > > then check/0 would do > > findall(Description-Goal, check_hook(Description,Goal), Rules), > % print_message and call(Goal) for each rule > ... I'm in favour. I wouldn't call it a hook. I propose a multifile and dynamic check:checker(Goal, Message) The execution can use a failure driven loop, possibly using a catch with print_message to report errors in the registered checkers without breaking the process. Cheers --- Jan