Broker
- turns any SML application into a distributed service without any extra code on the server or the client side,
- connections, remote function calls, argument passing and error returns are made transparent,
- any error on the server side is captured and reported to the client as if it happened locally in its own process,
- interprets a dialog in SML, in XML-RPC and in serialized PHP,
- the broker radically extends the possibilities of implementations by offering to share roles without any constraint.
;; in an SML process, define a function in a normal way
? (defun calc:add (x y) (+ x y))
;; export it and register on the bus
? (load "smlb") ;load broker
? (smlb:export 'calc:add) ;function is now public
? (smlb:start "Calculator") ;register on the bus
;; now in another SML process
? (load "smlb") ;load broker
;; import function and simply run it
? (smlb:import "Calculator" 'calc:add)
? (calc:add 1 2) ;remote call with automatic connection
= 3
? (calc:add 1) ;errors are returned as if local
Error: Bad number of arguments: 1