contains: golang, rpc, and yes, hypertext as the engine of application state
to cut a long story short, i've written a lot of rpc systems, experimenting with different styles
of api design, with several examples in python. i'm looking at doing very similar things in golang.
in python, i can write api clients like this (with remote objects):
import client
api = client.Open(url)
job = api.Job.create(1,2,3)
while job.Active():
job.process([1,2,3])
instead of api clients like this (with remote calls):
import myservice.client
session = client.Open(url)
job = client.Job.create(session, [1,2,3])
output = client.Job.process(session, job, args)
it's just a lot nicer to write code when you don't have to thread the state of client requests from one to the next, and i've been wondering how to do the same in go, without creating a bunch of client objects for each api.
my best answer? i've opted for using a method chain / query builder style interface to the client:
client = Dial(....)
if client.Err != nil { .... }
job := client.Invoke("Job.create", [1,2,3])
if job.Err != nil { .... }
var output bool
result := job.Invoke("process",&Request[1,2,3]).Scan(&output)
if result.Err != nil { ... }
return &output
the client object stores the state of the last request, along with the error, which lets me do things like this:
result := client.Fetch("Job.Create").Call(&Request[1,2,3]).Invoke("process", ...)
if result.Err != nil { .... }
which turns out to be a natural fit for stuff like hateoas. heh heh heh

