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

Zoltan Somogyi zoltan.somogyi at runbox.com
Thu Apr 29 15:14:01 AEST 2021



On Thu, 29 Apr 2021 14:45:06 +1000 (AEST), Julien Fischer <jfischer at opturion.com> wrote:
> I think that a very strong argument in favour of approach 1 is this: it
> is the syntax we already use in other parts of the language,

Agreed. I think Peter's response may indicate he does too,
but I am not sure. Peter?

> > Approach 3 would be to add an extra  argument, containing simply either
> > "pred" or "func", to the pragma's argument list, just before the argument
> > that now contains just foo/2.
> 
> That's actually what several of the generated pragmas (e.g. exceptions,
> trailing_info) do now.  (Except that they output "predicate" or
> "function" rather than "pred" or "func".)

Yes, and the reason is this:

> (The generated ones should do whatever allows
> them to be most efficiently and unambiguously processed.)

Having one argument for each field in the relevant pragma info
struct is the simplest and most efficient way to process them.
But that is not the primary consideration for the design of the
syntax for pragmas that users are expected to write.

> > We would need to introduce any such changes gradually. We would
> > implement any new syntax alongside the old, generating messages
> > telling programmers to switch to the new form when we find the old.
> > These messages could have severity warning, but with an option to
> > shut them up, such as --no-warn-for-old-pragma-syntax. That would
> > need to persist past the next stable release, after which we could
> > first up the severity to error, and then later still disable the code
> > parsing the old syntax altogether.
> 
> It will need to be done very gradually, over several releases.

Agreed. To help us not forget such things, should we add a new file, 
named maybe RELEASE_NOTES_NEXT, containing NEWS entries for
changes to be done *after* the next release?

Zoltan.





More information about the developers mailing list