** Programming error ** occurs with I7 wrapper around I6 rule but not with just the I6 rule

I once had a frustrating time figuring out exactly where an implicit take was coming from because the rules command doesn’t indicate the carrying requirements rule or anything else by name that directly translates to an Inform 6 rule. I figured a layer of indirection would make them evident, e.g.,

This is the can't reach inside closed containers rule: 
  abide by the real can't reach inside closed containers rule.

The real can't reach inside closed containers rule translates into I6 as
    "CANT_REACH_INSIDE_CLOSED_R" with
    "[The noun] [aren't] open." (A).

But this had a surprising side effect. With the Standard Rules and this source:

Lab is a room.
Angus is wearing a kilt.
Angus is in the lab.

we see

Lab
You can see Angus here.

>give kilt to angus
(first taking the kilt)
That seems to belong to Angus.

But with the I7 wrapper as given above and no other change, we get:

Lab
You can see Angus here.

>give kilt to angus

[** Programming error: tried to test "has" or "hasnt" of nothing **]

(first taking the kilt)

[** Programming error: tried to test "has" or "hasnt" of nothing **]

That seems to belong to Angus.

The same thing happens with follow instead of abide by. But it doesn’t occur if I compile for release and thus use ~S~D for I6. I can fix it by including a replacement for the CANT_REACH_INSIDE_CLOSED_R routine in Light.i6t, adding a parameter_value provides container test at the start.

That message text comes from the Inform 6 compiler… so how come the I7 wrapper makes the difference in whether or not we get it (in the not-for-release SD flags case)?

Are you sure about that minimal source? I tried to compile:

"I7 Wrapper"

This is the can't reach inside closed containers rule:
    abide by the real can't reach inside closed containers rule.

The real can't reach inside closed containers rule translates into I6 as
    "CANT_REACH_INSIDE_CLOSED_R" with
    "[The noun] [aren't] open." (A).

Lab is a room.
Angus is wearing a kilt.
Angus is in the lab.

in 6M62, but it’s halting at the I6 compiler level because of a routine name conflict: “Error: Expected routine name but found CANT_REACH_INSIDE_CLOSED_RM”. (Inspection of auto.inf shows that there are two definitions of the routine.)

Sorry, I was trying to not go overboard in making the post super-long with source… the rules stuff was really in an extension in a section replacing all of SR2/10. But the following will do as complete source demonstrating the Programming Error:

"I7 Wrapper"

This is the can't reach inside closed containers wrapper rule:
    abide by the can't reach inside closed containers rule.

The can't reach inside closed containers wrapper rule is listed instead of
the can't reach inside closed containers rule in the reaching inside rules.

Lab is a room.
Angus is wearing a kilt.
Angus is in the lab.

The problem is that you’re doing “abide by R” when you should be doing “abide by R for V”. Your rule drops the object being passed in.

However, I don’t think this fixable without some I6 fiddling. Inform’s type system doesn’t recognize “the can’t reach inside closed containers rule” as being an object-based rule, so you can’t say “abide by the can’t reach inside closed containers rule for V”.

This probably isn’t a good way to do tracing. I’m not sure what info you’re trying to get, but try:

First reaching inside rule for something (called O):
	say "### [O].";
1 Like

So a values-based rule can be in an object-based rulebook if the rule is in I6? Hunh. Thanks.

I was trying to label everything so rules really indicated every rule, not pursuing a specific problem.

As zarf suggests, some I6 hacking can work around the issue:

"I7 Wrapper"

Current parameter value is an object that varies. The current parameter value variable translates into I6 as "parameter_value".

To force abide by (R - rule) for (O - object):
    (- if (FollowRulebook({R}, {O})) rtrue; rfalse; -).

This is the can't reach inside closed containers wrapper rule:
    force abide by the can't reach inside closed containers rule for current parameter value.

The can't reach inside closed containers wrapper rule is listed instead of the can't reach inside closed containers rule in the reaching inside rules.

Lab is a room.
Angus is wearing a kilt.
Angus is in the lab.

I think this is retaining the normal functionality of the “can’t reach inside closed containers” rule – current parameter value is set to Angus for the command >GIVE KILT TO ANGUS. And the wrapper rule shows up in the rules listing:

>GIVE KILT TO ANGUS
[Rule "declare everything initially unmentioned rule" applies.]
[Rule "announce items from multiple object lists rule" applies.]
[Rule "set pronouns from items from multiple object lists rule" applies.]
[Rule "before stage rule" applies.]
[Rule "can't reach inside closed containers wrapper rule" applies.]  ! <---
(first taking the kilt)
...
1 Like