[m-dev.] pragmas should specify pred/func as well as name and arity

Zoltan Somogyi zoltan.somogyi at runbox.com
Thu Apr 29 15:25:12 AEST 2021



On Thu, 29 Apr 2021 15:16:28 +1000, Peter Wang <novalazy at gmail.com> wrote:
> > 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.

No, it does not.  It simply applies the pragma to every pred_info
with the given name/arity. See do_add_pred_marker in add_pragma.m.

> We already have the behaviour that names that were not ambiguous
> initially may become ambiguous with additional imports, or changes
> to imported modules.

That is different. Pragmas always apply to the entities defined
in the current module, so their meaning cannot be affected either
by changing the set of imported modules, or the contents of imported
modules.

Zoltan.





More information about the developers mailing list