Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In Common Lisp's tagbody, labels must be immediate children of the form; they cannot be anywhere in the enclosed syntax.

The go form identifies the tagbody which is the immediate parent of the selected label. It then performs a control transfer which selects that form as the exit point; every form in between is abandoned with all the unwinding. Then that tagbody passes control to the selected label.

We can imagine every tabody to be a kind of case statement which selects the first case on entry, and subsequent cases are selected by go forms; each go says "break up to the top of the tagbody, and then go to this case".

So for instance you can't have shenanigans like two loops or conditionals buried in the same tagbody, where one jumps into the middle of the other.

Jumping out of a lambda /is/ possible, but only if the tagbody within which the lambda was captured has not yet terminated. (In other words, the lambda isn't an escapee from the tagbody it's trying to use.)

 help



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: