ulisp-esp icon indicating copy to clipboard operation
ulisp-esp copied to clipboard

Value from return is evaluated an extra time

Open technoblogy opened this issue 9 months ago • 2 comments

The value returned by return is incorrectly evaluated an extra time if the return clause is not the last expression within a progn and is within a loop, dotimes, or dolist block.

Expected:

21808> (let ((a 7)) (loop (progn (return 'a))))
a

Observed:

21808> (let ((a 7)) (loop (progn (return 'a) nil)))
7

Will be fixed next release.

technoblogy avatar Oct 08 '23 08:10 technoblogy

What exactly is the "fix" you have? I don't see this problem in my fork (as of f5dc52a47161a4ab3370d53b589a02280315c063). I get the expected output:

{GC#1:50,8977/9044}[Ready.]
(let ((a 7)) (loop (progn (return 'a))))
a

dragoncoder047 avatar Dec 03 '23 01:12 dragoncoder047

My issue report is badly worded. the test to try is:

(let ((a 7)) (loop (progn (return 'a) nil)))

Correct answer 'a', wrong answer '7'.

technoblogy avatar Dec 03 '23 07:12 technoblogy