(TADS3) proper way to do dobjFor(SetTo) remapTo(SetTo ...

Thanks for reading my post. I have really struggled to figure this out and would appreciate some help.

I have an object (thing1) that has a settable switch (thing2) as a component object. I want to be able to handle both “set thing1 to [1-4]” and “set thing2 to [1-4]”, by actually setting thing2.

Here is my (simplified) code:

thing1: Thing
    name = 'thing1'
    vocabWords = 'thing1'
    desc = "This is a thing with a switch that can be set from 1 to 4.  It is currently set to <<thing2.curSetting>>.  "
 
    dobjFor(SetTo) remapTo(SetTo, thing2, IndirectObject)
;

+thing2: Settable, Component 'sliding switch/slider' 'thing2'
    "The switch moves along a track with four positions, 1 to 4.  "
    curSetting = '3'
    isValidSetting(val)
    {
        return (val >= '1') && (val <= '4');
    } 
    setToInvalidMsg = 'You can\'t set the switch to that.  ' 
;

This works fine for “set thing2 to 4”. But “set thing1 to 4” gives a runtime error of “invalid comparison” in isValidSetting() because val is of type literalPhrase(miscList).

I can fix this with:

    isValidSetting(val)
    {
        if(val.propDefined(&misc_))
        {
           return (val.misc_.txt_ >= '1') && (val.misc_.txt_ <= '4');
        }
        else
        {
            return (val >= '1') && (val <= '4');
        }
    } 

but that just doesn’t seem right. What is the proper way to handle this?

This question goes beyond my level of competence, but since none of the experts has jumped in … it occurs to me that thing1 is of the Thing class and thing2 of the Settable class. I know remapTo() ought to just pass the command on to the other object, but possibly the library code for a LiteralTAction is getting confused and passing on the literal stored in IndirectObject in a way that isValidSetting(val) can’t handle correctly. Could be a library bug, in other words.