Go to the first, previous, next, last section, table of contents.


assembleCatch

Function: assembleCatch { label asm -> }
file: job.t
package: muf
status: alpha

The assembleCatch prim supports implementation of catch/throw functionality: catch/throw is similar to the non-local goto, but additionally supports passing a block of values from the throw to the catch.

Here's a hand-assembly of

: test  'aaa catch{ [ "Whee!" | 'aaa ]throw } ;

as an example:

makeAssembler --> *asm*
stack:
*asm* reset
stack:
'aaa *asm* assembleConstant
stack:
*asm* assembleLabelGet --> *label*
stack:
*label* *asm* assembleCatch
stack:
#'startBlock *asm* assembleCall
stack:
"Whee!" *asm* assembleConstant
stack:
#'endBlock *asm* assembleCall
stack:
'aaa *asm* assembleConstant
stack:
#']throw *asm* assembleCall
stack:
*label* *asm* assembleLabel
stack:
nil -1 makeFunction *asm* finishAssembly --> #'test ( Compile fn 'test' )
stack:
test ( Invoke function )
stack: [ "Whee!" | t


Go to the first, previous, next, last section, table of contents.