all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#72753: Different output between SBCL `loop` and Emacs `cl-loop`
@ 2024-08-22  1:55 Okamsn via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-08-22  7:57 ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 3+ messages in thread
From: Okamsn via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-08-22  1:55 UTC (permalink / raw)
  To: 72753

Hello,

The following in SBCL 2.1.11 produces 3, which I expected.

     (loop for i in '(1 2 3)
           for j from 1
           finally (return j))

The following in Emacs 29 produces 4, which I did not expect.

     (cl-loop for i in '(1 2 3)
              for j from 1
              finally (cl-return j))

This is a simplified example that only shows the difference.

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

Thank you.






^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#72753: Different output between SBCL `loop` and Emacs `cl-loop`
  2024-08-22  1:55 bug#72753: Different output between SBCL `loop` and Emacs `cl-loop` Okamsn via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-08-22  7:57 ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-08-23 11:21   ` Robert Pluim
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-08-22  7:57 UTC (permalink / raw)
  To: 72753; +Cc: okamsn

On Thu, 22 Aug 2024 01:55:07 +0000 Okamsn via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> wrote:

> Hello,
>
> The following in SBCL 2.1.11 produces 3, which I expected.
>
>      (loop for i in '(1 2 3)
>            for j from 1
>            finally (return j))

I get the same result with SBCL 2.4.5.

> The following in Emacs 29 produces 4, which I did not expect.
>
>      (cl-loop for i in '(1 2 3)
>               for j from 1
>               finally (cl-return j))

I also get 4 with Emacs built from master.

> This is a simplified example that only shows the difference.
>
> I don't know what the standard behavior is, but I personally believe
> that the SBCL output makes more sense.

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

Steve Berman





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#72753: Different output between SBCL `loop` and Emacs `cl-loop`
  2024-08-22  7:57 ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-08-23 11:21   ` Robert Pluim
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Pluim @ 2024-08-23 11:21 UTC (permalink / raw)
  To: 72753; +Cc: okamsn, stephen.berman

>>>>> On Thu, 22 Aug 2024 09:57:08 +0200, Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> 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
-- 





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-23 11:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22  1:55 bug#72753: Different output between SBCL `loop` and Emacs `cl-loop` Okamsn via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-22  7:57 ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-23 11:21   ` Robert Pluim

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.