PerlPowerTools icon indicating copy to clipboard operation
PerlPowerTools copied to clipboard

bc statements have stopped working

Open briandfoy opened this issue 3 months ago • 1 comments

I didn't bisect to find the problem, but this started breaking with #517. I caught up the rest of the tests for that change, but these are breaking for other reasons. Maybe the print is broken:

$ bc -e 'for ( v=0; v<5; v++) { print v; if (v>2) break }; print "\n"'
0123

$ perl bin/bc
for ( v=0; v<5; v++) { print v; if (v>2) break }; print "\n"
0

@mknos can you look at this? I can make these tests TODO, but I'd rather fix them so we can make a release.

briandfoy avatar Mar 25 '24 17:03 briandfoy

Thanks for the notification. The commit added for =v instruction caused the loop to terminate because $return=1 breaks out of a group statement. Setting $return=3 as done in FOR-COND fixes this for a basic loop. However, the example loop with "break" incorrectly printed 01230 with older version of bc. The extra 0 was added by "break". Setting $return=1 as done in RETURN fixes this. I've added these changes as separate commits in PR523. It would be good to create some symbolic constants with helpful names for these $return values instead of 0, 1, 2, 3.

mknos avatar Mar 26 '24 02:03 mknos

Noting #523 for the cross-reference. (Type # followed by number to refer to another issue in the same repo)

briandfoy avatar Apr 11 '24 15:04 briandfoy

The t/bc/input.t is still failing for the while statement. @mknos, can you look at that test?

 % perl -Ilib t/bc/input.t

Also, it looks like I had made some modulo tests TODO, but I forget why.

At the moment, this is blocking the next release. If we can't figure this out, I might need to come up with a different plan that reverts bc for a bit.

briandfoy avatar Apr 11 '24 15:04 briandfoy