1 USING: accessors compiler.units combinators fry generalizations io
2 io.encodings.binary io.sockets kernel
3 parser sequences serialize vocabs vocabs.parser words ;
8 : with-in-vocab ( vocab quot -- vocab ) over
9 [ '[ _ set-current-vocab @ ] current-vocab name>> swap dip set-current-vocab ] dip vocab ; inline
11 : remote-quot ( addrspec vocabspec effect str -- quot )
12 '[ _ 5000 <inet> binary
14 _ serialize _ in>> length narray serialize _ serialize flush deserialize dup length firstn
18 : define-remote ( addrspec vocabspec effect str -- ) [
19 [ remote-quot ] 2keep create-in -rot define-declared word make-inline
20 ] with-compilation-unit ;
22 : remote-vocab ( addrspec vocabspec -- vocab )
23 dup "-remote" append [
24 [ (( -- words )) [ "get-words" remote-quot ] keep call-effect ] 2keep
25 [ rot first2 swap define-remote ] 2curry each