Skip to content

Commit

Permalink
Add compiler and interpreter explanation to FAQ
Browse files Browse the repository at this point in the history
  • Loading branch information
r0man committed Jan 29, 2018
1 parent 8e5f165 commit 9e99074
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
provide the dependencies yourself like this:

#+BEGIN_SRC clojure :exports code :results silent
[cljsjs/react "15.4.2-2"]
[cljsjs/react-dom "15.4.2-2"]
[cljsjs/react "16.2.0-3"]
[cljsjs/react-dom "16.2.0-3"]
#+END_SRC

If you want to do server rendering and use the =render= or
=render-static= functions from the =sablono.server= namespace you
need to add the following dependency as well:

#+BEGIN_SRC clojure :exports code :results silent
[cljsjs/react-dom-server "15.4.2-2"]
[cljsjs/react-dom-server "16.2.0-3"]
#+END_SRC

** Usage
Expand Down Expand Up @@ -131,6 +131,20 @@
lein doo phantom none auto
#+END_SRC

*** Why is there a compiler and an interpreter?

The interpreter is executed at *run time*, and it's job is to
evaluate Hiccup forms and produce React elements. The compiler on
the other hand, is executed at *compile time* and can optimize
certain Hiccup forms. It's job is to evaluate Hiccup forms and
produce executable code.

An introduction to this topic can be found in Peter Seibel's
[[http://www.gigamonkeys.com/book/practical-an-html-generation-library-the-compiler.html][Practical Common Lisp]]:

- [[http://www.gigamonkeys.com/book/practical-an-html-generation-library-the-interpreter.html][An HTML Generation Library, the Interpreter]]
- [[http://www.gigamonkeys.com/book/practical-an-html-generation-library-the-compiler.html][An HTML Generation Library, the Compiler]]

** Thanks

This library is based on James Reeves excellent [[https://github.com/weavejester/hiccup][Hiccup]] library.
Expand Down

0 comments on commit 9e99074

Please sign in to comment.