Subject: Re: bug#72753: Different output between SBCL `loop` and Emacs `cl-loop`

From: Robert Pluim <[email-masked]>
Date: Fri, 23 Aug 2024 13:21:07 +0200

>>>>> On Thu, 22 Aug 2024 09:57:08 +0200, Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email-masked]> said:

    >> 
    >> I don't know what the standard behavior is, but I personally believe
    >> that the SBCL output makes more sense.

    Stephen> FWIW, GNU CLISP 2.49.93+ (built from the git repo) returns 4, not 3, for
    Stephen> the above Common Lisp loop sexp.

The CLHS section 6.1.7.2 says

"The finally construct causes the supplied compound-forms to be
evaluated in the loop epilogue *after* normal iteration terminates."
(emphasis mine).

To me that means all bets are off regarding the values of variables
created in the context of the loop iteration. But we should ask a
Common Lisp expert to be sure.

Robert
--