[m-dev.] proposal: extension to pragma obsolete

Julien Fischer jfischer at opturion.com
Tue Sep 9 17:18:16 AEST 2014


I think that it would be useful if obsolete pragmas optionally allowed a second
argument that contained a user-defined message that could extend the warning
message that they generate.  For example, instead of just:

     foo.m: 561: Warning: call to obsolete predicate `bar.baz'/2.

We could instead generate:

     foo.m: 561: Warning: call to obsolete predicate `bar.baz'/2.
     foo.m: 561: Use predicate `bar.baz_to_int'/2 instead.

The extended variant of the pragma would look something like:

     :- pragma obsolete(bar.baz/2, "Use predicate `bar.bat_to_int'/2 instead.").

The main question I have is what should the second argument actually be.  There
are three proposals below: (1) use a string literal, (2) use a list of string
literals or (3) make (some of) the functionality of the error_util library
available so we can mark up the warning messages.

     (1) :- pragma obsolete(bar.baz/2, "Use predicate `bar.baz_to_int'/2 instead.").
     (2) :- pragma obsolete(bar.baz/2, ["Use predicate",
          "`bar.baz_to_int'/2 instead"]).
     (3) :- pragma obsolete(bar.baz/2, [words("Use predicate"), sym_name_and_arity("bar.baz_to_int", 2),

(3) obviously provides more control over the eventual output, but is also more
complicated for users.  (For (1) and (2) the strings would just be turned into
error_util words/1 components.)



More information about the developers mailing list