[m-rev.] for review: reversing operator priorities

Zoltan Somogyi zoltan.somogyi at runbox.com
Tue Nov 8 12:12:05 AEDT 2022



On Mon, 7 Nov 2022 13:58:13 +1100, Mark Brown <mark at mercurylang.org> wrote:
> > > While it may be counter intuitive, I don't consider it a design error.
> > > It's not uncommon to have lower numerical values representing higher
> > > priorities since it does make sense to start with the highest priority,
> > > and counting up from zero is obvious and less arbitrary than counting
> > > down from some positive value. 

I agree that the old priority scheme makes sense from the point of view
of a language implementor. But the relevant audience is not the language's
implementors, but the language's users, and we have ample evidence that
numerically higher priority mean lower *actual* priority is causing problems
for them. Even for people whom it does not confuse, such as me, the
extra mental gymnastics it requires is unwelcome.

> > We have a few operators that bind less tightly than comma, though, so
> > making this further change would not be backwards compatible.
> 
> Hmm, the obvious one is semicolon.

And a bunch of other operators that would be keywords in languages
defined by context-free grammars, as opposed to operator precedence
grammars. And it will stay that way while the most frequent nonatomic
language construct, conjunction, has its syntax defined by the relationship
between the priority of the comma operator, and the priorities of the operators
of other language constructs.

> > I'm not
> > sure how much impact that would have in practice.
> 
> A lot then. :-(

Indeed.

Does anyone intend to review the actual diff, as opposed
to the concept?

Zoltan.





More information about the reviews mailing list