Menu

#1750 INTERPRET .context~digits different from digits()

5.0.0
closed
Erich
None
none
1
2023-01-01
2021-03-08
jfaucher
No

When some numeric settings are set inside an INTERPRET, and queried from the same INTERPRET with RexxContext ~digits or ~fuzz or ~form then the results are different from digits() or fuzz() or form().

The attached file displays 3 lines. The second line shows the problem.
The last number is the RexxContext~identityHash

15 14 ENGINEERING 15 14 ENGINEERING -4406334017
15 14 ENGINEERING 9 0 SCIENTIFIC -4406334017
15 14 ENGINEERING 15 14 ENGINEERING -4406334017

This problem occurs with ooRexx 4.2 and 5.0.
A possible fix is described in the attached file.

1 Attachments

Discussion

  • jfaucher

    jfaucher - 2021-03-09

    The proposed fix is not working when passing the current context to a routine or method.
    Attached file updated with this new test case (v1).

    Output (without proposed fix) is ok:
    Caller context: 15 14 ENGINEERING -4528229313
    Current context: 100 0 SCIENTIFIC -4528283569
    Caller context: 15 14 ENGINEERING -4528229313

    If the proposed fix is applied, the output is KO:
    Caller context: 9 0 SCIENTIFIC 567214664
    Current context: 100 0 SCIENTIFIC 567220084
    Caller context: 100 0 SCIENTIFIC 567214664

    Maybe the instruction numeric digits should update both the current RexxActivation and its parent RexxActivation when isInterpret() == true ?

     
  • jfaucher

    jfaucher - 2021-03-09

    After testing the 2nd proposed fix, it appears that it should be like that to support nested INTERPRET:
    recursively updating the setting while isInterpret() == true
    This is the same logic as parent->rexxVariable(name) in RexxActivation::rexxVariable.

    void RexxActivation::setDigits(wholenumber_t digitsVal)
    {
    settings.packageSettings.setDigits(digitsVal);
    if (isInterpret()) parent->setDigits(digitsVal);
    }

    Attached file updated with a new test case for nested INTERPRET (v2).

     
  • Erich

    Erich - 2021-03-10
    • status: open --> pending
    • assigned_to: Erich
     
  • Erich

    Erich - 2021-03-10

    Fixed code and added test with revision [r12187]

     

    Related

    Commit: [r12187]

  • Rony G. Flatscher

    • Status: pending --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB