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

Paul Bone paul at bone.id.au
Mon Sep 15 11:47:23 AEST 2014


On Thu, Sep 11, 2014 at 07:54:13PM +1000, Mark Brown wrote:
> On Thu, Sep 11, 2014 at 12:35 PM, Zoltan Somogyi
> <zoltan.somogyi at runbox.com> wrote:
> > On Wed, 10 Sep 2014 23:31:47 +1000, Mark Brown <mark at mercurylang.org> wrote:
> >> If the more general case is really wanted, 'comment' and
> >> 'verbose_comment' attributes could be added. For example:
> >>
> >> :- pragma obsolete(string.substring/3, [
> >>         superseded_by(string.between/3),
> >>         comment("The new string operations were introduced to help
> >> provide better Unicode support."),
> >>         verbose_comment("If Start + Count = End then substring(String,
> >> Start, Count) = between(String, Start, End).")
> >>     ]).
> >
> > I like this, but I would prefer one change. As you argue, I think
> > there should be a second argument that expresses one of three things:
> >
> > (a) there is no replacement for the obsolete entity
> > (b) there is a direct, semantically identical replacement for the obsolete entity
> > (c) there is a direct, but semantically different replacement
> >
> > (b) and (c) would be accompanied by the name of the replacement.
> 
> Note also that the user may wish to list more than one potential
> replacement, for (c) at least.

Another alternative - I'm not sure if it's a good one - is to makes these
"is it a replacment" items format components.  This allows the developer to
easily specify more than one replacement, but it makes it easier for the
developer to provide incomplete, confliciting or misleading information.

I think I prefer Zoltan's proposial with the addition that (c) be allowed to
take a list of replacements.


-- 
Paul Bone



More information about the developers mailing list