[m-rev.] for review: Define behaviour of string.to_char_list (and rev) on ill-formed sequences.

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Oct 23 10:48:52 AEDT 2019



On Wed, 23 Oct 2019 10:30:09 +1100, Peter Wang <novalazy at gmail.com> wrote:

> On Wed, 23 Oct 2019 05:04:20 +1100 (AEDT), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> > This diff implements my proposal, and is for post commit review by Peter.
> > 
> 
> > diff --git a/NEWS b/NEWS
> > index 82bcaa356..a5e1c887a 100644
> > --- a/NEWS
> > +++ b/NEWS
> > @@ -231,6 +231,13 @@ Changes to the Mercury language:
> >    predicates and/or functions that programmers should consider using
> >    instead of the obsolete predicate or function.
> >  
> > +* We have added an `obsolete_proc' pragma. While the `obsolete' pragma
> > +  declares all modes of a predicate or function to be obsolete, the
> > +  `obsolete_proc' pragma declares only one mode of a predicate or function
> > +  to be obsolete. Like the updated version of the `obsolete' pragma,
> > +  the `obsolete_proc' pragma may have a second argument naming one or more
> > +  suggested replacements.
> > +
> >  * The Java backend now supports defining foreign types as primitive Java
> >    types.
> 
> The way I understood your proposal was that `pragma obsolete' would
> accept either a NAME/ARITY specification or a NAME(MODES) specification,
> like `pragma type_spec' and the undocumented `pragma require_tail_recursion'.

Yes, it was, but then I thought better of it. The name/arity form is ambiguous,
because e.g. foo/1 applies both to pred foo(in) and func foo(in) = out. On the
other hand, the name(modes) form does not have this ambiguity: it specifies
a predicate, with the function version being specified by name(modes) = retmode.
The code handling both type_spec and require_tail_recursion has to handle
both the ambiguous and the nonambiguous forms, which does not just make
the code more complicated, it also makes the error messages so convoluted
that they are hard to understand.

One of my favourite quotes is:

You cannot make a pussycat out of a lion
by describing its claws in a reference manual.

It means that if the description of some feature in the reference manual
is too complicated, then try to simplify the feature, and not just its description.

> The rest looks fine. Thanks!

You are welcome. I fixed both grammar problems you pointed out.

Zoltan.


More information about the reviews mailing list