[ansi-test-devel] [PATCH] test TAGBODY/GO inside recursive call

Tobias C. Rittweiler tcr at freebits.de
Fri Sep 18 22:03:05 UTC 2009


The comment explains it:

  ;;; The next two cases test for a wonderfully twisted issue. GO tags
  ;;; are lexical this means that even within a recursive call,
  ;;; i.e. within a different extent of the _same_ TAGBODY form, GO must
  ;;; transfer control to the original (outermost) TAGBODY form, and not
  ;;; the immediately enclosing one. 

I.e. the following must return :GOOD

  (labels ((frob (continuation)
             (tagbody
                (if (not continuation)
                    (frob #'(lambda () (go :foo)))
                    (funcall continuation))
                ;; We should never return here.
                (return-from frob :bad)
              :foo 
                (return-from frob :good))))
    (frob nil))

Idea and implementation mostly due to Erik Huelsmann.

First test for the interpreter; second for the compiler.

SBCL, CCL, and CLISP get both cases right.

ABCL returns :BAR for the first one. Gets second correct.

ECL gets first correct, but errors out on the second one.

  -T.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tagbody-21-and-22.diff
Type: text/x-diff
Size: 1534 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/ansi-test-devel/attachments/20090919/e1df0b4c/attachment.diff>


More information about the ansi-test-devel mailing list