This is from a reply by Jan W.
Best practice seems to be
- Use format/3 to emit non-term output.
- When writing a library, use the print_message/2 indirection for talking to the user.
- Use writeq/1 or write_canonical/1 to write terms that need to be read by Prolog.
- Use portray_clause/1 for listing clauses. This predicate must ensure that reading returns the same clause given the same operator declarations.
- Use print/1 only for debug/3 and other interactive use of your program.
- Be careful with portray/1. Only use it for very specific terms for libraries or better, include a dedicated portray library for a specific library. rdf_portray.pl is such as beast for dealing with RDF.
- write/1 should never have been added to Prolog.