unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#48098: let/ec compilation bug
@ 2021-04-29 10:48 Stefan Israelsson Tampe
  2021-05-02 13:43 ` Andy Wingo
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Israelsson Tampe @ 2021-04-29 10:48 UTC (permalink / raw)
  To: 48098


[-- Attachment #1.1: Type: text/plain, Size: 355 bytes --]

Here is an interesting test case that shows that fi we define
(define-syntax-rule (letec-m f) (let/ec c (f c)))
(define                    (letec-f f) (let/ec c (f c)))

we can get two different behaviors with letec-m compiles wrongly.
Obviously a bug!

This is important in casy you would like to make a loop macro effectively
with a continue directive.

[-- Attachment #1.2: Type: text/html, Size: 464 bytes --]

[-- Attachment #2: a.scm --]
[-- Type: text/x-scheme, Size: 323 bytes --]

(use-modules (ice-9 control))

(define-syntax-rule (letec-m f)
  (let/ec c (f c)))

(define (letec-f f)
  (let/ec c (f c)))

(letec-m (lambda (break) (let lp ((i 0)) (when (< i 2) (pk 1 i) (lp (+ i 1))))))
(letec-f (lambda (break) (let lp ((i 0)) (when (< i 2) (pk 2 i) (lp (+ i 1))))))

#|
OUTPUT:

;;; (2 0)
;;; (2 1)
|#

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

end of thread, other threads:[~2021-05-02 13:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 10:48 bug#48098: let/ec compilation bug Stefan Israelsson Tampe
2021-05-02 13:43 ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).