Objects' privately-named property toggles during play

This is weird.

Lab is a room.
The bunsen burner is in the Lab.
Conservatory is east of Lab.
The telescope is in the Conservatory.

foo is a region.
Lab is in foo.
Conservatory is in foo.

Definition: an object (called O) is in-world if O is a thing or O is a room.

when play begins: name-check;

Every turn: say "Turn #[turn count].";
name-check;

Every turn when the turn count > 2:
    say "foo: ";
    list the contents of foo.

To name-check:
  repeat with obj running through in-world objects begin;
    say "[obj]: [if obj is privately-named]privately-named[else]publicly-named[end if].";
  end repeat.

Test me with "z / z / z".

produces:

yourself: privately-named.
Lab: publicly-named.
bunsen burner: publicly-named.
Conservatory: publicly-named.
telescope: publicly-named.

[banner elided]

Lab
You can see a bunsen burner here.

>test me
(Testing.)

>[1] z
Time passes.

Turn #1.
yourself: publicly-named.
Lab: publicly-named.
bunsen burner: privately-named.
Conservatory: publicly-named.
telescope: privately-named.

>[2] z
Time passes.

Turn #2.
yourself: publicly-named.
Lab: publicly-named.
bunsen burner: privately-named.
Conservatory: publicly-named.
telescope: privately-named.

>[3] z
Time passes.

foo: nothing
Turn #3.
yourself: privately-named.
Lab: privately-named.
bunsen burner: privately-named.
Conservatory: privately-named.
telescope: privately-named.

When play begins, yourself is privately-named and everything else is publicly-named as expected. After the first command all of the rooms are still publicly-named, but all of the things have flip-flopped: yourself is publicly-named and all other things are privately-named. After the next, no change. But then, after I list the contents of a region, everything is privately-named.

It owes to this bit in ListWriter.i6t:

[ WriteListFrom first style depth noactivity iter a ol;
        @push c_iterator; @push c_style; @push c_depth; @push c_margin;
    if (iter) c_iterator = iter; else c_iterator = ObjectTreeIterator;
    c_style = style; c_depth = depth;
        c_margin = 0; if (style & EXTRAINDENT_BIT) c_margin = 1;

        objectloop (a ofclass Object) {
                give a list_filter_permits;
                if ((list_filter_routine) && (list_filter_routine(a) == false))
                        give a ~list_filter_permits;
        }

in combination with Constant list_filter_permits = privately_named in Definitions.i6t. I don’t understand what the intent here is; I just know where it’s happening, not why it’s happening.

So far as I know, this flag has zero relevance after things are created so there’s not much reason to care about this (…unless you spot it while you’re doing some funky things and are trying to figure out why your own code is having this weird side-effect, that is); I just wanted to share an oddity.

2 Likes

The I7 library saves an attribute slot by re-using this one in this way. As you say, the privately_named attribute has no relevance after compile time, so it’s free to do that.

5 Likes