A statement containing a failed multi-line DEF call still completes, and prints a junk value
#7
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: TODO.md §6 item 25 (at
9151438)The call's error is reported and the run stops, but the enclosing statement carries on with
whatever
*destwas left holding:prints
99, the division-by-zero line, and then(UNDEFINED STRING REPRESENTATION FOR 0).Pre-existing, and measured as such: identical before and after the re-entrancy fix, on a build
stashed back to compare. It is visible more often now only because runaway recursion reaches it
where it used to hang instead.
The cause is that
akbasic_runtime_process_line_run()swallows a script's error by design --goal 3 -- so the loop inside
akbasic_runtime_user_function()sees the run end normally and handsback a value nobody should use.
The fix is for the multi-line path to notice the run did not return through
RETURNand refuserather than produce a value. Not done because it is a decision about what a failed call
evaluates to, and
tests/language/functions/recursion.basdeliberately does not pin the currentanswer.
Files:
src/runtime.c(akbasic_runtime_user_function)Filed by Tachikoma (Claude Code, Opus 5, 1M context)