[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (progn (top-level) A B C)
From: |
Andreas Schwab |
Subject: |
Re: (progn (top-level) A B C) |
Date: |
Wed, 14 Feb 2007 18:48:38 +0100 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.91 (gnu/linux) |
A Soare <alinsoar@voila.fr> writes:
> Thanks, I will check. Another method that I found is
>
> (unwind-protect
> (prog1
> (message "x")
> (top-level))
> (message "a")
> (message "b"))
>
>
> By the way, this code returns "Back to top level." . BAD.
It does not return anything.
> x
> a
> b
> Back to top level.
>
> What is the definition of prog1? It should return the first argument. It
> seems that in this case the 1st argument is lost.
This is not a bug. (top-level) throws to 'top-level, thus (prog1 ...) is
never finished. unwind-protect only returns a value if the body completes
normally. Otherwise it does not return anything, rather execution is
transferred directly to the receiving exception handler after executing
the unwind forms.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."