Distributed programming: Difference between revisions
m
→{{header|Wren}}: Minor tidy
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: future-proof for 5.36) |
m (→{{header|Wren}}: Minor tidy) |
||
Line 1,931:
<br>
We need two Wren scripts one for each VM:
<syntaxhighlight lang="
class Rpc {
Line 1,952:
HTTP.serve(listener)</syntaxhighlight>
<br>
<syntaxhighlight lang="
class TaxComputer {
Line 1,962:
<br>
We now embed these scripts in the following Go program and run it on one terminal.
<syntaxhighlight lang="go">/* go run
package main
Line 1,980:
var vm2 *wren.VM
var fileName = "
var fileName2 = "
func (taxRate TaxComputer) Tax(x float64, r *float64) error {
Line 2,051:
<br>
Just one Wren script needed here:
<syntaxhighlight lang="
import "./fmt" for Fmt
Line 2,069:
<br>
which we embed in the following Go program and run it on a different terminal.
<syntaxhighlight lang="go">/* go run
package main
Line 2,117:
cfg.LoadModuleFn = moduleFn
vm := cfg.NewVM()
fileName := "
clientMethodMap := wren.MethodMap { "call(_,_)": call }
classMap := wren.ClassMap { "Client": wren.NewClass(dialHTTP, nil, clientMethodMap) }
|