[I6] ASK HER causes programming error

Here’s an apparent error in the Inform 6 library that is causing me some grief. Can anyone explain it and whether there’s a workaround?

Download, compile and run the following small test program. ASK WITCH ABOUT HERBS and she answers you as expected. Once you’ve established that the character is female, ASK HER ABOUT HERBS and you get a strange [** Programming error: tried to test “in” or “notin” of <routine 7539> **]

In the program I’m writing where I first noticed this, the error was [** Programming error: tried to test “in” or “notin” of <illegal object number 219361> **] and it occurred twice in succession. In both cases, the parenthesised “(the witch about that)” occurred after the error.

Note that this doesn’t happen when you have a male character and you ASK HIM ABOUT something.

Here’s the test program:

Constant DEBUG;

Constant Story "Ask Witch About Herbs";
Constant Headline "^An interactive bug hunt^^";

Include "parser";
Include "verblib";

[ Initialise;
  location = room01;
  "Try ASK WITCH ABOUT HERBS, then try ASK HER ABOUT HERBS.";
];

Object room01 "Witch's Hut"
with
  description "This is the witch's hut.",
has light;

Object "witch" room01
with
  name 'witch',
  description "She's a withered old crone.",
  life
  [;
    Ask:
      if (second == 'herbs')
        "I use them to make magic potions.";
  ],
has female animate;

Include "grammar";

End;

And here’s a sample transcript:

>ask witch about herbs
I use them to make magic potions.

>ask her about herbs

[** Programming error: tried to test "in" or "notin" of <routine 7539> **]
(the witch about that)
I use them to make magic potions.

Oh, I should have mentioned that I’m using Library v6.12.3pre.

I don’t know if this will help any, but the code compiles and works as expected when compiled as an Inform 6 project from the I7 IDE, which uses “I6/v6.34 lib 6/12N.” So whatever code is causing your error is probably something that’s different between the two libraries. Have you tried it with parser tracing on to see which routine is giving the error (“trace 5” at the command prompt)?

Good idea. Here’s the output:

>ask witch about herbs
[ "ask" ask / "witch" witch / "about" about / "herbs" herbs ]
[Parsing for the verb 'ask' (4 lines)]

[line 0 * creature 'about' topic -> Ask]
 [line 0 token 1 word 2 : creature]
  [Object list from word 2]
  [Calling NounDomain on location and actor]
   [NounDomain called at word 2]
   seeking definite object
    Trying yourself (21) at word 2
    Trying the witch (27) at word 2
    Matched (1)
   [NounDomain made 1 matches]
  [NounDomain returned the witch]
  [token resulted in success]
 [line 0 token 2 word 3 : 'about']
  [token resulted in success]
 [line 0 token 3 word 4 : topic]
  [token resulted in success]
 [line 0 token 4 word 5 : END]
[Line successfully parsed]
I use them to make magic potions.
[Considering each_turn for the Witch's Hut]
[Considering each_turn for yourself]
[Considering each_turn for the witch]

>ask her about herbs
[ "ask" ask / "her" her / "about" about / "herbs" herbs ]
[Parsing for the verb 'ask' (4 lines)]

[line 0 * creature 'about' topic -> Ask]
 [line 0 token 1 word 2 : creature]
  [Object list from word 2]
  [Calling NounDomain on location and actor]
   [NounDomain called at word 3]
   seeking indefinite object: owner:witch
   number wanted: 0
   most likely GNAs of names: 4095
    Trying yourself (21) at word 3
    Matched (0)
    Trying the witch (27) at word 3
    Matched (0)
   [NounDomain made 2 matches]

[** Programming error: tried to test "in" or "notin" of <routine 7539> **]
  [NounDomain returned <routine 7539>]
  [Calling NounDomain on location and actor]
   [NounDomain called at word 2]
   seeking definite object
    Trying yourself (21) at word 2
    Trying the witch (27) at word 2
    Matched (1)
   [NounDomain made 1 matches]
  [NounDomain returned the witch]
  [token resulted in success]
 [line 0 token 2 word 3 : 'about']
  [token resulted in success]
 [line 0 token 3 word 4 : topic]
  [token resulted in success]
 [line 0 token 4 word 5 : END]
[Line successfully parsed]
(the witch about that)
I use them to make magic potions.
[Considering each_turn for the Witch's Hut]
[Considering each_turn for yourself]
[Considering each_turn for the witch]

It’s all Greek to me, but we can at least see where the error occurs.

Same problem with library version 6.12.1, but works okay (no error) with version 6.11.

Oh, my god, that is messy code. There’s a chunk of code that has been added to parser.h that wasn’t there in version 6.11. It looks like this:

        if (l ~= nothing && l ~= 1 && l notin actor && token == MULTIHELD_TOKEN or MULTIEXCEPT_TOKEN) {
      if (ImplicitTake(l)) {
    etype = NOTHELD_PE;
    jump FailToken;
      }
  }

I have no idea what that code does, but if I comment it out, I still get the parenthesised “(the witch about that)”, but I don’t get the error. It looks like “l notin actor” is causing the problem. Are there any experts out there that understand all the gobbledegook in the library?

As I’ve said, I’m not up on the 6/12 library. (And I haven’t spent a lot of time in 6/11 either, not in the past few years.) Obviously this is new code dealing with implicit Take actions.

l is returned by a NounDomain() call. The docs imply that this is 0, 1, REPARSE_CODE, or an object number. On the face of it, the given test is written correctly – it only checks l notin actor when l really is an object. However, a library bug could result in l being some other value. You’d want to check that possibility, and then trace back to see how it got that way.

Are you using the latest from the Git repository? I can’t get this bug to manifest. This exact problem was brought up last May in Inform 6.12 lib - Fatal Error and written up in https://gitlab.com/DavidGriffith/inform6lib/-/issues/65.

I suppose this is a hint that I should prepare a new release.

1 Like

Thanks for looking into this. I had searched the forum, but didn’t find that other thread.

I thought I was using the latest version of the library. The other thread said the bug was fixed in June 2019. My library was dated July 2019. I downloaded a new version just in case. This was dated August 2019. The readme says its version 6.12.2, but the compiled file (in both versions) says 6.12.3pre, so you can’t distinguish between the two in a compiled game. This is annoying. You need a build number.

The good news is that the newer version does not give the programming error in the sample game, but it still gives the annoying “(the witch about that)” when you ASK HER ABOUT HERBS.

If I change the witch to male, I don’t get the parenthesised junk. So there’s still a bug. Why are male and female being treated differently in this instance?

The reason for the parentheses is because of a hangup between HER as an object pronoun versus HER as a possessive pronoun. I hadn’t been able to completely eliminate this problem from that fix. The male being works correctly because the object pronoun and possessive pronoun words are different: HIM versus HIS.

For the build number, the Library has a serial number that I haven’t been very good about updating. To remedy this, I broke off version constants into their own file, version.h. You can see this by typing VERSION.

I’ll work on this, https://gitlab.com/DavidGriffith/inform6lib/-/issues/85, and https://gitlab.com/DavidGriffith/inform6lib/-/issues/93. When those are complete, I’ll tag and release 6.12.3.

3 Likes

Thanks David. Much appreciated.

Incidentally, what’s the relationship between the Inform 6 library and the Inform 7 library. In my ignorance, I used to think they were the same (I don’t use Inform 7), but a recent comment re version 6.12N made me think that they may be different.

The I7 parser is a separate branch of evolution. It started out as the I6 6/11 parser, modified to make use of I7 rulebooks and activities. Plenty of the original I6 parser code is still down there, but it has evolved as I7 has.

It’s labelled “6.12N” because Graham once planned to keep the I6 parser library in sync with I7. That never happened. The modern I6 6/12 library is a separate package; it also started from 6/11 but it has evolved along its own path. (Obvious example from this thread: the way it handles implicit actions is completely different from I7’s model.)

2 Likes

So is it feasible to use Inform 7’s 6.12N library with Inform 6 or are they too different?

1 Like

It’s not feasible. You’d have to include the whole mechanism of rulebooks and activities, plus a bunch of other stuff that the I7 compiler is meant to generate.

2 Likes

Fair enough. I had a feeling that might be the case.

I wrote this bug up in https://gitlab.com/DavidGriffith/inform6lib/-/issues/94. I’m not sure if it’s at all related to https://gitlab.com/DavidGriffith/inform6lib/-/issues/65.

Earlier on in the discussion, @BadParser suggested that the bug did not occur with Inform 7’s version 6.12N library. If this is true, it might be worth comparing the two to see how they differ when identifying the type of pronoun.

When / at what point did the 6.12N library diverge from the regular Inform 6 library? I’d like to figure out what changed when so I can put it back right.

1 Like

It diverged when Graham started writing Inform 7.

You should probably compare with the 6/11 library.

I’ve managed to narrow things down to a specific commit in the abortive 2006 effort to produce 6/12. Unfortunately several fixes and enhancements were rolled into one commit, so I’m having a jolly time picking out what changes are for what fix.

For the curious, see https://gitlab.com/DavidGriffith/inform6lib/-/commit/f677e0fdfcda5c7b9c632f49b62f886d476685fc. This was copied verbatim from the old CVS repository.