continuations: rename catchstack* to (get-catchstack) for consistency.
parent
f88febc03e
commit
bee46baecb
|
@ -108,7 +108,7 @@ $nl
|
||||||
|
|
||||||
ABOUT: "continuations"
|
ABOUT: "continuations"
|
||||||
|
|
||||||
HELP: catchstack*
|
HELP: (get-catchstack)
|
||||||
{ $values { "catchstack" "a vector of continuations" } }
|
{ $values { "catchstack" "a vector of continuations" } }
|
||||||
{ $description "Outputs the current catchstack." } ;
|
{ $description "Outputs the current catchstack." } ;
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,14 @@ SYMBOL: restarts
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
: catchstack* ( -- catchstack )
|
: (get-catchstack) ( -- catchstack )
|
||||||
CONTEXT-OBJ-CATCHSTACK context-object { vector } declare ; inline
|
CONTEXT-OBJ-CATCHSTACK context-object { vector } declare ; inline
|
||||||
|
|
||||||
! We have to defeat some optimizations to make continuations work
|
! We have to defeat some optimizations to make continuations work
|
||||||
: dummy-1 ( -- obj ) f ;
|
: dummy-1 ( -- obj ) f ;
|
||||||
: dummy-2 ( obj -- obj ) ;
|
: dummy-2 ( obj -- obj ) ;
|
||||||
|
|
||||||
: get-catchstack ( -- catchstack ) catchstack* clone ; inline
|
: get-catchstack ( -- catchstack ) (get-catchstack) clone ; inline
|
||||||
|
|
||||||
: (set-catchstack) ( catchstack -- )
|
: (set-catchstack) ( catchstack -- )
|
||||||
CONTEXT-OBJ-CATCHSTACK set-context-object ; inline
|
CONTEXT-OBJ-CATCHSTACK set-context-object ; inline
|
||||||
|
@ -132,7 +132,7 @@ callback-error-hook [ [ die ] ] initialize
|
||||||
|
|
||||||
: rethrow ( error -- * )
|
: rethrow ( error -- * )
|
||||||
dup save-error
|
dup save-error
|
||||||
catchstack* [
|
(get-catchstack) [
|
||||||
in-callback?
|
in-callback?
|
||||||
[ callback-error-hook get-global call( error -- * ) ]
|
[ callback-error-hook get-global call( error -- * ) ]
|
||||||
[ OBJ-CURRENT-THREAD special-object error-in-thread ]
|
[ OBJ-CURRENT-THREAD special-object error-in-thread ]
|
||||||
|
@ -142,9 +142,9 @@ callback-error-hook [ [ die ] ] initialize
|
||||||
: recover ( ..a try: ( ..a -- ..b ) recovery: ( ..a error -- ..b ) -- ..b )
|
: recover ( ..a try: ( ..a -- ..b ) recovery: ( ..a error -- ..b ) -- ..b )
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
[ catchstack* push ] dip
|
[ (get-catchstack) push ] dip
|
||||||
call
|
call
|
||||||
catchstack* pop*
|
(get-catchstack) pop*
|
||||||
] curry
|
] curry
|
||||||
] dip ifcc ; inline
|
] dip ifcc ; inline
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue