[m-dev.] pragmas should specify pred/func as well as name and arity
Peter Wang
novalazy at gmail.com
Thu Apr 29 15:16:28 AEST 2021
On Thu, 29 Apr 2021 14:54:30 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
>
>
> On Thu, 29 Apr 2021 14:33:34 +1000, Peter Wang <novalazy at gmail.com> wrote:
> > > However, for pragmas that assert something, such as promise_pure,
> > > applying them to both a predicate and a function when the programmer
> > > intended applying them to only one is a more significant problem.
> > > I believe we should update the pragmas that use the first syntax
> > > to first allow, and eventually require, the programmer to say whether
> > > they mean pred foo/2 or func foo/2.
> >
> > Can we require something more specific than name/arity if there is
> > actual ambiguity?
>
> I presume you mean "ONLY when there is an ambiguity".
Yes.
>
> My answer would be "no". Just because there is no ambiguity now
> does not mean there won't be later. If e.g. a pragma says foo/2,
> and the only foo/2 is currently a predicate, then the meaning of the
> pragma should not change to apply to func foo/2 as well, when
> it is added later. Having a pragma written now apply to code
> written in the future would be ... surprising.
The compiler would warn about the ambiguity though.
We already have the behaviour that names that were not ambiguous
initially may become ambiguous with additional imports, or changes
to imported modules.
Peter
More information about the developers
mailing list