Low-level errors?

Inform just gave me this error message:

** Library error 2 (1145397,5) ** ** Property value not routine or string: "article" of "book" (1145397) ** *** Run-time problem P37: Low level error.

I assume this is the relevant code:

The indefinite article of the Tome of Incantations is "a".

The article changes during play (when the name of the book is revealed it changes to “the”), but at this point it hadn’t yet. Is this a bug or am I doing something wrong?

EDIT: After the error shows everything works correctly–if I look again it says “a book” just as it should, and if I examine it it becomes “the Tome of Incantations”.

I suspect this is the same underlying bug as inform7.com/mantis/view.php?id=1258 .

I’ve posted an experimental patch in that bug report. To use:

Include (-
Replace CIndefArt;
-) before "Printing.i6t".

Include (-
[ CPrintText text  length i;
    VM_PrintToBuffer (StorageForShortName, 160, TEXT_TY_Say, text);

    length = StorageForShortName-->0;

    StorageForShortName->WORDSIZE = VM_LowerToUpperCase(StorageForShortName->WORDSIZE);
    for (i=WORDSIZE: i<length+WORDSIZE: i++) print (char) StorageForShortName->i;
    if (i>WORDSIZE) say__p = 1;

    return;
];
[ CIndefArt obj i;
    if (obj == 0) { LIST_WRITER_INTERNAL_RM('X'); rtrue; }
    i = indef_mode; indef_mode = true;
    if (obj has proper) {
        indef_mode = NULL;
        caps_mode = true;
        print (PSN__) obj;
        indef_mode = i;
        caps_mode = false;
        return;
    }
    if ((obj provides article) && (TEXT_TY_Compare(obj.article, EMPTY_TEXT_VALUE) ~= 0)) {
        CPrintText(obj.article); print " ", (PSN__) obj; indef_mode = i;
        return;
    }
    PrefaceByArticle(obj, 2, 0, 1); indef_mode = i;
];
-) after "Printing.i6t".

A small question from someone not acquainted with the inner workings of Inform 7: How am I to apply this patch if I want to make this work? Should I copy-paste that code into every project for which it’s a problem; is there somewhere I can put it so it works in general; or…?

I guess you could copy-paste it into an extension, and then include that extension whenever you need it?

Oh, of course. I never thought of using extensions to implement patches! Nice catch.

I made a very simple extension containing the patch (along with eu’s patch for an unrelated indefinite article bug) if anyone wants it.
Article Bug Fix.i7x