Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.

src/components/try-catch.x

Try, catch, and finally.

Design notes

A try lowers to the landing form (landing CODE ROWS) that the cleanup walk finishes: its frame, its finalizer as a region that leaves the frame on a transfer out of it, the exits that close its catch site, claim the finalizer, and leave the frame, then its body and each catch arm as regions that run those exits on every transfer out of them. The frame lands when something raises, and the catch site selects the arm. A clause’s facts are (HANDLE STATE (ARM...) PATTERN...): the handler the parser introduced, the catch site’s initial state, the arms’ tokens, and the patterns of the filtered arms, which precede the default arm.

Each definition precedes the definitions that call it: the compiler settles whether a linked copy reaches a compile-time operation when the copy binds.