#944 Incorrect result with exposed variables.

v4.0
closed
nobody
5
2012-08-14
2010-09-30
No

On Fedore 13,

This is a paraphrase of one of Mike's original test cases in rexdiag exec. If it is any consolation, another of the tests breaks on current CMS.

Maybe rexdiag should be rolled into the regression test?

The following program says 1, but the correct answer is 6. Looks like the assignment of the default value does not make it to the exposed stem or whichever way round this is handled.

x.=1
call x1
say x.1
exit

x1:
procedure expose x.1
x.=5
x.1=x.1+1
return

Discussion

  • Rick McGuire

    Rick McGuire - 2010-09-30

    This is one fundamental difference between classic Rexx and Object Rexx. In Object Rexx, a compound variable assignment of a default value creates a totally new stem object that is assigned to the stem variable in the local context. This can sever the connection between the variable in the subroutine context and the calling context.

     
  • John P. Hartmann

    User error. See Rick's comment.

     


Anonymous

Cancel  Add attachments