From a1f2a48599a55d30909ddd817b5ae9ef88129e3b Mon Sep 17 00:00:00 2001 From: Dave Clayton Date: Fri, 8 Jan 2016 09:04:32 +0100 Subject: [PATCH] Fixed some typos and cleaned up documentation a little bit. --- docs/ffi.md | 4 ++-- docs/intro.md | 30 +++++++++++++++--------------- docs/start.md | 12 ++++++------ 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/ffi.md b/docs/ffi.md index 9a0150bd34..2dc2b87fbd 100644 --- a/docs/ffi.md +++ b/docs/ffi.md @@ -1,7 +1,7 @@ # Interaction with Javascript/Typescript Note this section is still in design space, it's subject to change in -the future, we need further document how it works in general. +the future, we need to further document how it works in general. ## Call OCaml functions from Javascript/Typescript @@ -48,7 +48,7 @@ For example, if we want to provide bindings to the external describe : string -> (unit -> unit) -> unit = "" [@@js.call "describe"] external it : string -> (unit -> unit) -> unit = "" [@@js.call "it"] ``` -Since, `mochajs` is a test framework, we also need some assertion +Since `mochajs` is a test framework, we also need some assertion test, we can also describe the bindings to `assert.deepEqual` from nodejs `assert` library: diff --git a/docs/intro.md b/docs/intro.md index 9571a594aa..5a744d401e 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -1,45 +1,45 @@ -# Why JavaScript Platform +# Why the JavaScript Platform -Javascript is not just the *only* langauge in the browser, but also -the *only* cross platform langauge in town, it is truly +Javascript is not just the *only* langauge in the browser, it is also +the *only* cross platform langauge in town. It is truly everywhere: users don't even need install any binaries to access your software, just a simple link. -Another important factor is that the Javascript VM is quite fast and -will become enven faster, so that it is possible to deliver quite -large applications purly in Javascript platform. +Another important factor is that modern Javascript VM's are quite fast and +will become enven faster, so it is possible to deliver large applications +purely running on the Javascript platform. # Why OCamlScript OCamlScript is mainly designed to solve the problem of large scale Javascript programming: -1. Industrial strength type system while not verbose typing required +1. Industrial strength type system, while not verbose typing required (thanks to OCaml's strong type system). -2. Dead code eliminatoin in different levels (inside functons, outside +2. Dead code elimination in different levels (inside functions, outside functions and across modules). 3. Offline optimizations. Javascript is a dynamic language, it takes - time to optimize it during runtime, it's better to optimize it at + time to optimize it during runtime, so it's better to optimize it at compile time if we can. -At the same time we try to avoid the cost of compiling a langague to +At the same time we try to avoid the cost of compiling a language to Javascript as much as we can: 1. Very fast compilation, OCaml bytecode compilation is - famous for fast compilation, in general one or two order faster - than other similar langauges: [Scala](http://www.scala-lang.org/) + famous for fast compilation, in general one or two orders faster + than other similiar languages: [Scala](http://www.scala-lang.org/) or [Haskell](https://www.haskell.org/), our compiler shares the same property with OCaml's bytecode compiler 2. Easy interaction, no name mangling. -3. Separate compilatio. We map one OCaml module into one JS module +3. Separate compilation. We map one OCaml module into one JS module # Resources for Learning OCaml -The offical [ocaml](https://ocaml.org/) website has a comprehensive -list of tutorials about +The official [OCaml](https://ocaml.org/) website has a comprehensive +list of tutorials. diff --git a/docs/start.md b/docs/start.md index 93fa001497..3f9e6892a3 100644 --- a/docs/start.md +++ b/docs/start.md @@ -2,7 +2,7 @@ ## Hello world -Currently, `ocamlscript` shares the same command line options as `ocamlc` +Currently, `ocamlscript` shares the same command line options as the `ocamlc` bytecode compiler. Create a file called `hello.ml` as below @@ -21,13 +21,13 @@ If everything goes well, you should have console.log('hello world') ``` -## Compilaton model +## Compilation model -However, the compilation/link model is like ocaml native compiler -instead of bytecode compiler, suppose you -have module `A`, `B`, `C`, module `C` depends on module `B`, +However, the compilation/link model is like the OCaml native compiler +instead of bytecode compiler, suppose you have modules `A`, `B`, `C`, +module `C` depends on module `B`. -Then you need compile `B` first before compiling `C` +Then you need to compile `B` first before compiling `C` ```sh OCAML_RAW_JS=1 ocamlscript -c a.ml b.ml