[m-dev.] shims
Julien Fischer
jfischer at opturion.com
Mon Sep 15 15:44:30 AEST 2014
On Mon, Sep 15, 2014 at 3:42 PM, Mark Brown <mark at mercurylang.org> wrote:
> On Mon, Sep 15, 2014 at 3:20 PM, Julien Fischer <jfischer at opturion.com>
> wrote:
> >
> >
> > On Fri, 12 Sep 2014, Peter Wang wrote:
> >
> >> On Thu, 11 Sep 2014 17:26:04 +1000, Peter Wang <novalazy at gmail.com>
> wrote:
> >>>
> >>>
> >>> 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 could not cope with predicates which just have their arguments
> >> reordered (hopefully a rare occurrence).
>
> If you require that other.p/1 not only exists, but has the same
> signature as p/1, then I think it will cope so long as the arguments
> don't have the same type.
>
> (If the signatures don't change, my proposal wouldn't cope either.)
>
> >
> >
> > Over the past few years it's been a very common occurrence in Mercury's
> > standard library. (I'll grant that those reorderings were primarily
> > legacy issues and that APIs built against a current version of Mercury
> > are unlikely to have the same sort of problems.)
>
> In most of these cases the arguments have different types so the
> signature has changed, right?
>
Pretty much.
Cheers,
Julien.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/developers/attachments/20140915/132f4711/attachment.html>
More information about the developers
mailing list