! Words
: word-sub-primitive ( word -- obj )
- global [ target-word ] bind sub-primitives get at ;
+ [ target-word ] with-global sub-primitives get at ;
: emit-word ( word -- )
[
] if ;
: default-cli-args ( -- )
- global [
+ [
"e" off
"user-init" on
main-vocab "run" set
- ] bind ;
+ ] with-global ;
[ default-cli-args ] "command-line" add-startup-hook
} 1|| not ;
: compiler-message ( string -- )
- "trace-compilation" get [ global [ print flush ] bind ] [ drop ] if ;
+ "trace-compilation" get [ [ print flush ] with-global ] [ drop ] if ;
: start ( word -- )
dup name>> compiler-message
init kernel.private io.encodings accessors math.order
destructors source-files parser classes.tuple.parser
effects.parser lexer generic.parser strings.parser vocabs.loader
-vocabs.parser source-files.errors ;
+vocabs.parser source-files.errors namespaces ;
IN: debugger
GENERIC: error-help ( error -- topic )
: print-error ( error -- )
[ error. flush ] curry
- [ global [ "Error in print-error!" print drop ] bind ]
+ [ [ "Error in print-error!" print drop ] with-global ]
recover ;
: :error ( -- )
! ( error thread -- )
[
dup initial-thread get-global eq? [ die ] [
- global [
+ [
error-in-thread. nl
print-error nl
:c
flush
- ] bind
+ ] with-global
stop
] if
] thread-error-hook set-global
] [ [ \ do-request log-error ] [ <500> ] bi ] recover ;
: ?refresh-all ( -- )
- development? get-global [ global [ refresh-all ] bind ] when ;
+ development? get-global [ [ refresh-all ] with-global ] when ;
LOG: httpd-benchmark DEBUG
"220 OK\r\n" write flush t
]
}
- { [ data-mode get ] [ dup global [ print ] bind t ] }
+ { [ data-mode get ] [ dup [ print ] with-global t ] }
[ "500 ERROR\r\n" write flush t ]
} cond nip [ process ] when ;
1 minutes timeouts
"220 hello\r\n" write flush
process
- global [ flush ] bind
+ [ flush ] with-global
] with-stream
] with-disposal
] with-test-context
} 0&& nip ;
: update-click# ( button -- )
- global [
+ [
dup multi-click? [
hand-click# inc
] [
] if
hand-last-button set
nano-count hand-last-time set
- ] bind ;
+ ] with-global ;
: update-clicked ( -- )
hand-gadget get-global hand-clicked set-global
: set ( value variable -- ) namespace set-at ;
: on ( variable -- ) t swap set ; inline
: off ( variable -- ) f swap set ; inline
-: get-global ( variable -- value ) global at ;
-: set-global ( value variable -- ) global set-at ;
+: get-global ( variable -- value ) global at ; inline
+: set-global ( value variable -- ) global set-at ; inline
: change ( variable quot -- ) [ [ get ] keep ] dip dip set ; inline
: change-global ( variable quot -- ) [ global ] dip change-at ; inline
-: +@ ( n variable -- ) [ 0 or + ] change ;
+: +@ ( n variable -- ) [ 0 or + ] change ; inline
: inc ( variable -- ) 1 swap +@ ; inline
: dec ( variable -- ) -1 swap +@ ; inline
: bind ( ns quot -- ) swap >n call ndrop ; inline
: make-assoc ( quot exemplar -- hash ) 20 swap new-assoc [ swap bind ] keep ; inline
: with-scope ( quot -- ) 5 <hashtable> swap bind ; inline
: with-variable ( value key quot -- ) [ associate ] dip bind ; inline
+: with-global ( quot -- ) global swap bind ; inline
: initialize ( variable quot -- ) [ unless* ] curry change-global ; inline
] with-curses ;
: test-listener ( -- )
- global [ run-listener ] bind ;
+ [ run-listener ] with-global ;
MAIN: run-listener
1 minutes timeouts
"+OK POP3 server ready\r\n" write flush
process
- global [ flush ] bind
+ [ flush ] with-global
] with-stream
] with-disposal
] with-test-context