     ] when
     [
         over dup def>> "unannotated-def" set-word-prop
-        >r dup def>> r> call define
+        [ dup def>> ] dip call define
     ] with-compilation-unit ; inline
 
 : word-inputs ( word -- seq )
     stack-effect [
-        >r datastack r> in>> length tail*
+        [ datastack ] dip in>> length tail*
     ] [
         datastack
     ] if* ;

    [ add-breakpoint ] annotate-methods ;

: breakpoint-if ( word quot -- )
    [ [ [ break ] when ] rot 3append ] curry annotate-methods ;

    word-inputs stack.
    "\\--" print flush ;

: word-outputs ( word -- seq )
    stack-effect [
        [ datastack ] dip out>> length tail*
    ] [
        datastack
    ] if* ;

: leaving ( str -- )
    "/-- Leaving: " write dup .
    word-outputs stack.
     "\\--" print flush ;

: (watch) ( word def -- def )
    over '[ _ entering @ _ leaving ] ;

: watch ( word -- )
    dup [ (watch) ] annotate ;

: (watch-vars) ( word vars quot -- newquot )
   '[
        "--- Entering: " write _ .
        "--- Variable values:" print _ [ dup get ] H{ } map>assoc describe
        @
    ] ;

: watch-vars ( word vars -- )
    dupd '[ [ _ _ ] dip (watch-vars) ] annotate ;

GENERIC# annotate-methods 1 ( word quot -- )

M: generic annotate-methods
    [ "methods" word-prop values ] dip [ annotate ] curry each ;

M: word annotate-methods
    annotate ;
