Notes on PLDoc, PLunit, modules... for anyone interested

Always good if nice stories popup on the internet! A quick read make me propose a few changes:

  • :- use_module(["", ""]).
    I would not propose to push strings for importing modules. Probably even move important, do not include the extension. If you leave that out you need no quotes at all and the system will automatically manage .qlf files: If present and more recent than the .pl file and compatible with the current system, it will load it. If present but otherwise unusable and writable, it will create a new .qlf file and use it.

  • assertion(Move = [does(white, mark(3, 1)), does(black, noop)])
    If a test produces an answer, you better use test(Name, Var == Value), which expresses the test is supposed to succeed and bind Var to Value (you can also use =@= or even =:=). Using the second argument of test to specify the expected result mostly leads to better feedback. I only use assertion/2 if it is useful to test intermediate results.

  • The type hierarchy is flawed in a number of places. I think @dtonhofer provided a diagram for this? Some examples

    • I don’t know about constant
    • There are nowadays also rational numbers
    • blob is above atom. Atom is a subtype of blob.
    • Text can also be lists of codes or chars
    • boolean is a subtype of atom.
    • callable is a disjunctive type of atom and compound.
  • listing(:What)
    Do not forget ?- edit(What). That makes it really easy to get to the source of anything without knowing where it is defined!