add the/2 annotations from PlDoc comments
Closed this issue · 1 comments
PlDoc has a well-established format for adding type annotations. Convert these type annotations into the/2
declarations in each clause of the associated goal (when not in optimized mode). This will help during debugging and help verify the declared interface.
I prefer using PlDoc comments because:
- people already write them
- the format is tried and tested
- there's one comment per predicate, so type assertions aren't repeated in each clause
Unfortunately, PlDoc comments don't support type unions or type intersections. If a user wants that, he'll have to manually add the type assertions and describe the types in English in the docs.
This can be implemented by asserting user:term_expansion
macros for each matching comment_hook
. The macro just adds type assertions to the top of each clause body.
This is finished. It needs some refinements but works pretty well.