id: 'idea--http-repl'
content: |
  It might be overkill, but it also might make sense to implement a rich
  REPL as a hypermedia API. This would mean that a language could expose
  an interactive server on HTTP somewhere.

  You could start by requesting the root, which will give you various
  options for how to proceed.

      GET / HTTP/1.1
      HOST: localhost:9999
      Accept: application/ld+json

  You will then get back a JSON object that describes the current state
  of the interpreter and (more importantly) set of links that describe
  how to proceed.

      HTTP/1.1 200 OK
      Content-Type: application/ld+json
      Content-Length: ....
      Link: </>; rel=index

      { "@context": "http://api.example.com/repl"
      , "history" : []
      , "bindings": []
      , "operation":
        [ { "@type": "CreateResourceOperation"
          , "title": "Evalute an expression"
          , "method": "POST"
          , "expects": "http://api.example.com/expression"
          , "returns": "http://api.example.com/value"
          }
        ]
      }

  This gives us a set of options. We can then `POST` a new command to
  interpret.
related: []