{- Mobile/relocatable computation -} agent client = ( {- A polymorphic function 'dispatch' -} def dispatch (#X recipient:Agent remote:Site c:^X msg:X) : String = ( new reply : ^String val client_node = (this_site) agent messenger = ( migrate to remote iflocal c! msg then reply! "OK, delivered." else reply! "No recipient." ) (read reply) ) typecase (subscribe "key" client) of [r:Agent n:Site c:^String] -> print!(dispatch r n c "Hello!") [r:Agent n:Site c:^Int] -> print!(dispatch r n c 15) else print! "Type mismatch" ) {- np 6-client.pi -trader localhost -tport 5001 -}