Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001854I6 LibraryGeneralpublic2016-01-21 20:582016-02-02 20:05
ReporterDavidG 
Assigned ToDavidG 
PrioritynormalSeverityseriousReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version6/12 
Target Version6/12Fixed in Version6/12 
Summary0001854: Multiple groups in item listings
DescriptionMore from vlaviano:

I've continued working through DM4, and I've encountered an issue related to the exercises in ยง27 (Listing and grouping objects).

I have a group of Scrabble letters with a list_together routine (DM exercise 67) and a group of identical featureless cubes. The library's item listing code produces a number of errors when these two groups of items coexist either in the same room or in the player's inventory. If they are separated (one group in the room and the other group in the player's inventory) or if only one group is implemented (comment out either of the chunks of code between dashed lines in the test program below), item listing behaves as expected.

Adding a regular item (e.g., Object -> rock "rock" with name 'rock';) doesn't appear to have an impact either way. When the letters and cubes are together, the issue manifests.
Minimal Source Text To Reproduce
Constant Story "MULTIPLE GROUPS IN ITEM LISTINGS";
Constant Headline "^An Interactive Bug Reproduction^";

Include "Parser";
Include "VerbLib";

Object Start_Room "Somewhere"
  with description "You're not sure where you are.",
  has light;

! DM4 Exercise 67
Class Letter
  with name 'letter' 'scrabble' 'piece' 'letters//p' 'pieces//p',
!----------------------
       list_together [;
           if (inventory_stage == 1) {
               print "the letters ";
               c_style = c_style | (ENGLISH_BIT + NOARTICLE_BIT);
               c_style = c_style & ~(NEWLINE_BIT + INDENT_BIT);
           } else {
               print " from a Scrabble set";
           }
       ],
!----------------------
       short_name [;
           if (listing_together ofclass Letter) rfalse;
           print "letter ", (object) self, " from a Scrabble set";
           rtrue;
       ],
       article "the";

Letter -> "X" with name 'x//';
Letter -> "Y" with name 'y//';
Letter -> "Z" with name 'z//';

! Created to test Exercise 66.
Class Cube
  with name 'cube' 'cubes//p' 'featureless' 'white',
       short_name "featureless white cube",
       plural "featureless white cubes"; 

!----------------------
Cube ->;
Cube ->;
Cube ->;
Cube ->;
!----------------------

[ Initialise;
  location = Start_Room;
];

Include "Grammar";
Additional Information
MULTIPLE GROUPS IN ITEM LISTINGS
An Interactive Bug Reproduction
Release 1 / Serial number 160118 / Inform v6.33 Library 6/12-beta1 S

Somewhere
You're not sure where you are.

You can see the letters X, Y and Z from a Scrabble set, four featureless white
cubes,
[** Programming error: tried to find the "sibling" of nothing **]

[** Programming error: tried to find the "sibling" of nothing **]

[** Programming error: tried to find the "sibling" of nothing **]

[Lots of msgs removed for brevity. The upshot being that the library is trying
to operate on nothing while printing the room description.]

>take all letters
letter X from a Scrabble set: Taken.
letter Y from a Scrabble set: Taken.
letter Z from a Scrabble set: Taken.

>i
You're carrying:
the letters Z, Y and X from a Scrabble set

>l

Somewhere
You're not sure where you are.

You can see four featureless white cubes here.

>drop all letters
letter Z from a Scrabble set: Dropped.
letter Y from a Scrabble set: Dropped.
letter X from a Scrabble set: Dropped.

>take all cubes
featureless white cube: Taken.
featureless white cube: Taken.
featureless white cube: Taken.
featureless white cube: Taken.

>i
You're carrying:
four featureless white cubes

>l

Somewhere
You're not sure where you are.

You can see the letters X, Y and Z from a Scrabble set here.

>take all letters
letter X from a Scrabble set: Taken.
letter Y from a Scrabble set: Taken.
letter Z from a Scrabble set: Taken.

>i
You're carrying:
the letters Z, Y and X from a Scrabble set
four featureless white cubes

[** Programming error: tried to find the "sibling" of nothing **]

[** Programming error: tried to find the "sibling" of nothing **]

[** Programming error: tried to find the "sibling" of nothing **]

[Another slew of error messages omitted.]

>l

Somewhere
You're not sure where you are.

>script off

End of transcript.


When the test program is compiled without strict mode (-~S), we get the following more readable summary of errors:

MULTIPLE GROUPS IN ITEM LISTINGS
An Interactive Bug Reproduction
Release 1 / Serial number 160118 / Inform v6.33 Library 6/12-beta1

Somewhere
You're not sure where you are.

You can see the letters X, Y and Z from a Scrabble set, four featureless white
cubes, Warning: @get_sibling called with object 0 (PC = 9c3f) (will ignore
further occurrences)
Warning: @get_prop called with object 0 (PC = a055) (will ignore further
occurrences)
zero Warning: @get_prop_addr called with object 0 (PC = d070) (will ignore
further occurrences)
** Library error 2 (0, 23) **
Warning: @test_attr called with object 0 (PC = a559) (will ignore further
occurrences)
Warning: @get_child called with object 0 (PC = a69e) (will ignore further
occurrences)
and zero ** Library error 2 (0, 23) **
here.

>take all
letter X from a Scrabble set: Taken.
letter Y from a Scrabble set: Taken.
letter Z from a Scrabble set: Taken.
featureless white cube: Taken.
featureless white cube: Taken.
featureless white cube: Taken.
featureless white cube: Taken.

>i
You're carrying:
four featureless white cubes
the letters Z, Y and X from a Scrabble set
two hundred and fifty-five ** Library error 2 (0, 23) **
Warning: @set_attr called with object 0 (PC = a270) (will ignore further
occurrences)

Warning: @clear_attr called with object 0 (PC = a27a) (will ignore further
occurrences)
two hundred and fifty-five ** Library error 2 (0, 23) **


>
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0004323)
DavidG (developer)
2016-01-21 20:58

https://github.com/DavidGriffith/inform6lib/issues/25 [^]
(0004326)
DavidG (developer)
2016-01-22 19:42

Problems began with https://github.com/DavidGriffith/inform6lib/commit/cbb8983fca27e313023198e2b60c99afec9f498a [^]
(0004351)
DavidG (developer)
2016-02-02 20:05

This was quite a subtle bug. Back in the 2006 effort to create Inform 6.40, we were changing calls to ZRegion() to metaclass(). Both functions did the same thing, but the return values were different. ZRegion() returns 0, 1, 2, or 3 depending on if the parameter is nothing, object/class, routine, or string. metaclass() directly returns nothing, Object, Class, Routine, or String. So, there this line:

if (j.list_together ~= 0 or lt_value && ZRegion(j.list_together) == Routine or String &&



That was the problem. We were comparing apples and oranges, so to speak.

- Issue History
Date Modified Username Field Change
2016-01-21 20:58 DavidG New Issue
2016-01-21 20:58 DavidG Status new => assigned
2016-01-21 20:58 DavidG Assigned To => DavidG
2016-01-21 20:58 DavidG Note Added: 0004323
2016-01-22 19:42 DavidG Note Added: 0004326
2016-02-02 20:05 DavidG Note Added: 0004351
2016-02-02 20:05 DavidG Status assigned => resolved
2016-02-02 20:05 DavidG Fixed in Version => 6/12
2016-02-02 20:05 DavidG Resolution open => fixed


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker