[m-dev.] shims

Peter Wang novalazy at gmail.com
Thu Sep 11 17:26:04 AEST 2014


Hi,

When a (standard) library predicate is deprecated, the user faces a
choice: update code now and break compatibility with older versions of
the library, or face breakage in the future.  We try to give a lot of
time in which to make that choice.  In the meantime the compiler keeps
nagging, and it's hard to know when to make the break anyway.

Ideally you could update code immediately but maintain a fallback for
older libraries.  I don't think there is a way to do it currently, so
perhaps it is time for another pragma, e.g.

    :- pragma shim(p/1, other.p/1).

    p(X) :- ...

This says that p is a shim for other.p.  The clauses of p are only used
if other.p is unavailable (not visible in the current module).  If
other.p *is* available then p just forwards to other.p, and the given
clauses of p are not checked semantically so that compilation will not
break due to calling an obsolete predicate that has been since removed.

Peter



More information about the developers mailing list