First/last keyword rules - each seems to have two different meanings?

I’ve been making a little study of how rules ordering works in 6M62. It mostly makes sense, but I’ve found something that was surprising to me: Rules placed first or last seem to be treated differently depending on whether their first/last placement is due to prefixing the rule preamble, e.g. Last <rulebook name> <conditions> (this is the <rule name>):..., or due to explicit placement directives, e.g. The <rule name> is listed last in the <rulebook name>.

The surprise is simply that these don’t seem to have equivalent meaning with respect to the rules ordering process. Specifically, the group that is placed via the preamble prefix notation seems to be treated as having lower priority than the group placed via the is listed notation. Declarations occurring later in the source code take precedence within each group, but the is listed group as a whole displaces the entire prefix notation group from the start/end of the rulebook.

As an example, given the following:

Ordering study is a rulebook.

This is the infrared study rule: do nothing.
This is the red study rule: do nothing.
This is the orange study rule: do nothing.
This is the cyan study rule: do nothing.
This is the blue study rule: do nothing.
This is the indigo study rule: do nothing.
This is the purple study rule: do nothing.

The orange study rule is listed first in the ordering study rulebook. [3rd.]
The red study rule is listed first in the ordering study rulebook. [2nd.]
The infrared study rule is listed first in the ordering study rulebook. [1st.]

A first ordering study rule (this is the green study rule): do nothing. [5th.]
A first ordering study (this is the yellow study rule): do nothing. [4th.]

The cyan study rule is listed in the ordering study rulebook. [6th]
The blue study rule is listed in the ordering study rulebook. [7th]
The indigo study rule is listed in the ordering study rulebook. [8th]

The purple study rule is listed last in the ordering study rulebook. [10th] [?]

A last ordering study rule (this is the ultraviolet study rule): do nothing. [9th] [?]

it is the purple study rule that ends up last, not the ultraviolet study rule. And adding:

A last ordering study rule (this is the x-ray study rule): do nothing.

to the end of the declarations results in the x-ray study rule being placed after the ultraviolet study rule but before the purple study rule (i.e. final order is purple, x-ray, ultraviolet), whereas instead adding:

This is the x-ray study rule: do nothing.
The x-ray study rule is listed last in the ordering study rules.

results in a final order of ultraviolet, purple, x-ray.

There’s some discussion at Rule ordering declarations explained, perhaps about rules ordering, but it doesn’t touch on this aspect (i.e. equivalency or non-equivalency of last-type declarations) directly. Thanks to the check for similar topics while posting, I see that the issue is brought up directly at First rule... is different from ...rule is listed first..., but there’s not a definitive answer about whether this is working as designed.

Is this behavior expected (i.e. documented somewhere)? If not, should it be considered a bug, and does it still occur in 10.1? (EDIT: Yes, this still occurs in 10.1.)

2 Likes

Edit: deleted my misreading of the Inform7 source