Yaron Minsky committed da7f04f

small tweaks

Comments (0)

Files changed (6)

-Hello World for Core
+Core and Async Hello World
 A simple hello-world project for Core.  The intent is to show you how
 to get started building OCaml projects using OPAM, Core and
-OCamlbuild.  To use this, first get OPAM, and install the "core"
-package.  Also, it's probably doing this:
-    $ opam switch ocaml-4.00.1+short-types
+Before getting started with this code, you should follow the
+instructions in the PREREQUISITES.
-to get better error messages from the compiler when using Core.  (As
-of 4.01, this compiler variant should be obsolete.)
-You can build all the pieces of this project by running:
+Once that's done, you can build all the pieces of this project by
     $ ./
 Hello World
+This is a very simple exercise that shows you how to make a basic
+command-line application using Core's `Command` module.
 This executable is `hello_world.native` (or `hello_world.byte`), and
 here's an example of it in action.

 let shutdown_rpc = Rpc.Rpc.create
 (* First, we build the implementations *)
 let publish_impl (dir,_) msg =
+  Log.Global.sexp ~level:`Debug msg
+    (Message.sexp_of_t);
   return (Directory.publish dir msg)
 let subscribe_impl (dir,_) topic ~aborted =
 eval `opam config -env`
-for TARGET in $*
-  ocamlbuild -use-ocamlfind $TARGET -cflags "-w @A-4-33-23" -cflags -short-paths
+ocamlbuild -j 4 -use-ocamlfind -cflags "-w @A-4-33-23" -cflags -short-paths $*
 let start_server ~env ?(stop=Deferred.never ()) ~implementations ~port () =
- "starting server on %d" port;
+ "Starting server on %d" port;
   let implementations =
     Rpc.Implementations.create_exn ~implementations
       ~on_unknown_rpc:(`Call (fun ~rpc_tag ~version -> "Unexpected RPC, tag %s, version %d" rpc_tag version))
- "About to start TCP server";
     ~on_handler_error:(`Call (fun _ exn -> Log.Global.sexp exn Exn.sexp_of_t))
     (Tcp.on_port port)
   >>= fun server ->
- "TCP server started, waiting for close";
+ "Server started, waiting for close";
     [ (stop >>= fun () -> Tcp.Server.close server)
     ; Tcp.Server.close_finished server ]
    query whose implementation blocks.
 let hello_impl () hello =
+ "received hello query (%s)" hello;
   Clock.after (sec 0.1)
   >>= fun () -> return (hello ^ " World!")