{- Mobile/relocatable computation -} new c : ^String {- val remote = ''polluks.cs.put.poznan.pl'':5001 -} val remote = ''127.0.0.1'':5001 {- for SSH port tuneling -} {- Message recipient -} agent John = ( migrate to remote run print ! "John is here." c? msg= print! msg ) {- A polymorphic function 'dispatch' -} def dispatch (#X a:Agent node:Site c:^X msg:X) : String = ( new reply : ^String val s = (sys.this_site) val d = (sys.this_agent) agent courier = ( migrate to node iflocal c! msg then reply ! "OK, delivered." else reply ! "No recipient." ) val result = (read reply) result ) {- Message sender -} {- run print! (dispatch John remote c 100) -} run print! (dispatch John remote c "Hello!")