[RFC] Operator priorities extensions

Jose E. Marchesi jemarch@gnu.org
Sat Nov 15 00:12:09 GMT 2025


> Hi People.
>
> On Thu, Nov 13, 2025 at 05:00:38PM -0800, chris hermansen wrote:
>> Jose and list;
>> 
>> On Thu, Nov 13, 2025 at 4:45 PM Jose E. Marchesi <jemarch@gnu.org> wrote:
>> 
>> >
>> > Hello people.
>> >
>> > There are two potential extensions regarding priority of operators that
>> > I would like to explore.
>> >
>> > Dyadic operators are always given some priority, which is an integral
>> > number between 1 and 9, for example:
>> >
>> >    prio // = 9
>> >
>> > The first potential extension is something that someone wrote to me
>> > privately about: to allow using a real number as well as an integral
>> > number.  This would expand the number of possible priorities from nine
>> > to infinite:
>> >
>> >    prio // = 6.5
>> >
>> 
>> While my living depends on floating point numbers and I love them dearly, I
>> think this is moving into sledgehammer - thumbtack territory.  Personally I
>> would prefer between 1 and 100, which to me would give plenty of range for
>> fine tuning.
>> 
>> Also generally I haven't seen a compelling demonstration of the need for
>> changing it at all; I believe (I have no data to back this up) that the
>> choice of 1 - 9 was probably based on thinking that if one had 100 choices
>> (or infinite) one might have trouble recalling that some operator is 49 and
>> the other 51 (or 4.9 and 5.1) and maybe just decide to use parentheses
>> instead.
>> 
>
>
> I totally support Chris here.
> Real numbers for priority is a very bad practical idea.
> In theory, it's amazing, but in practice, I only can imagine a lot of pain for
> no benefit.

Yes I am of the same opinion.

>> >
>> > That gives // ore priority than + and - (6) but less than / and * (7).
>> >
>> > The second potential extension is to allow to refer indirectly to the
>> > priority of some other operator, by name.  So for example, if we wanted
>> > // to have the same priority than the integer division operator %, we
>> > would write:
>> >
>> >    prio // = %
>> >
>> 
>> I like this second idea as it is also good documentation, whereas "prio //
>> = 4" forces one to either remember what else is 3,4,5 or to go and look it
>> up.
>> 
>
>
> I agree.
> What about `prio // = prio %'? To be more consistent.

I don't like the idea of having to repeat `prio' there.  Is it really
confusing to not do so?


More information about the Algol68 mailing list