drt24 / gnuprologjava

GNU Prolog for Java
8 stars 5 forks source link

Meta predicate implementation #19

Closed thetrime closed 8 years ago

thetrime commented 8 years ago

This addresses #16

This probably needs some documentation too, but I'm not sure where to put it. There are some tests included.

If you're not familiar with the meta-predicate problem, then http://yfl.bahmanm.com/Members/ttmrichter/yfl-blog/meta-predicates-in-swi-prolog does a pretty good job of explaining it. I independently arrived at exactly the same solution by discovering exactly the same pitfalls, which is encouraging.

I've created a new class ExecuteOnlyMetaCode which extends ExecuteOnlyCode but provides a method to get meta-predicate information. This isn't very pretty, but I wanted to make sure that when installing predicates from Java directly that we had some way for the predicates to indicate their meta-args directly.

Note that there are only 3 classes of meta-arg we care about: quantified (^), normal(+, -, ?) and everything-else. No distinction is made between 3 and :, for example.

drt24 commented 8 years ago

Looks good to me. Some documentation in the manual, possibly referencing the link you provide in the same section as information on modules support would be great. Happy to have that in a separate MR.

thetrime commented 8 years ago

Added some documentation as requested. Also tidied things up in the module section a bit now that I'm getting the hang of texinfo