Errata

ClojureScript: Up and Running

Errata for ClojureScript: Up and Running

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
unk
United States

In Chapter 2: Using lein-cljsbuild

lein trampoline cljsbuild repl-rhino

may fail on Windows 7 (with/maybe without cygwin)

A workaround: you're going to have to hack the "lein" bash file:

around line 44: LEIN_JAR="$LEIN_HOME\self-installs\leiningen-$LEIN_VERSION-standalone.jar"

towards the very end:

if [ -r "$TRAMPOLINE_FILE" ]; then
TRAMPOLINE=$(gawk '{ gsub(/\\"/,""); print }' $TRAMPOLINE_FILE)
if [ "$INPUT_CHECKSUM" = "" ]; then
rm $TRAMPOLINE_FILE
fi
exec sh -c "exec $TRAMPOLINE"
else
exit $EXIT_CODE
fi

Modify the very end of the lein script to remove the double double quotes. Possibly you may have to replace colons (:) with semi-colons (;) in CLASSPATHs.

Jay Glascoe  Nov 17, 2012 
??
United States

In Chapter 7, Section "Consuming Libraries", two references are made to "Google Clojure". Those should be "Google Closure".

Jay Glascoe  Nov 24, 2012 
2
United States

Chap 2. No page numbers online.

In the directory structure, resources/public is a subdir for a separate top level dir called "hello_world". Everything else is under "hello-world".

Sean Brunnock  Mar 19, 2013 
5
5

In Safari Books Online I don't see a way to read the page number....

Anyway, in Chapter 2 - Hello world, Paragraph "Using lein-cljsbuild" there is a minor technical mistake. You do not need to include clojurescript dependency is you add lein-cljsbuild to :pluings keyword in project.clj

Best regards

Mimmo Cosenza

Mimmo Cosenza  Nov 05, 2012 
PDF Page 8
Top code sample

This should probably be classes as a "version discrepancy" as I think that is what it is. But the book encourages you to get the latest versions of everything, and then presents a project.clj file which has this as the last line:

:cljsbuild {:builds []})

A :cljsbuild with an empty :builds entry will generate the following error under Clojure 1.5.1 or 1.6.0, using ClojureScript 2268 and lein-cljsbuild 1.0.3 (and probably many other version combos as well):

"java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Associative"

If you remove the line completely, you'll get a warning about this "format being deprecated", and you're probably best off using one of the example :cljsbuild entries from the lein-cljs git repository until you figure out what this parameter is for.

Blake Watson  Jul 24, 2014 
PDF Page 9
3rd paragraph

The term "separate" (and its related forms, e.g. "separately") seem to be consistently misspelled as "seperate" throughout the book --- the page 9 reference is just the first of several.

hhgreen  Oct 25, 2012 
PDF Page 10
Section: Writing a ClojureScript file.

Unable to compile the 2-line sample CLJS file:

Exception in thread "main" java.lang.RuntimeException: No such namespace: js, compiling:(hello_cljs/core.clj:6)

This does look like the use of a 'js' namespace without requiring it in the (.write js/document "xxxx....") call. Where does the 'js' namespace come from?

Note that the source file compiles if .write call is commented out. Also the write statement works as expected in Himera online CLJS REPL.

Tom Hicks  Sep 29, 2012 
PDF Page 10
directory structure

Assuming white space is meaningful for a listing of a directory tree:
the "- hello_world" directory immediately below "- cljs" should be indented a few more levels to the right, such that it becomes a sub-directory of "- cljs".
It follows that the "- resources" directory is not a sub-directory anymore of this "- hello_world" directory, but of the top-level "- hello-world" directory.

Roger Erens  Jul 26, 2013 
PDF Page 10
project configuration tree

More recent versions of cljsbuild use a changed format for the configuration:
the keyword :source-path is superseded by plural :source-paths, followed by a vector.

Roger Erens  Jul 26, 2013 
PDF Page 18
Sentence before HTML snippet, beginning with "Finally, create..."

The directories in the HTML file path are transposed. To be consistent with the rest of the example, it should be "resources/public/index.html".

greg spurrier  Nov 08, 2012 
PDF Page 18
Bottom of page

First, noting again error noted in Feb 02, 2013 comment from "prasad rao":

Page 18: "Finally, create an HTML file at public/resources/index.html:"
Page 18: {:output-to "resources/public/hello.js"

More important, following the steps in this section: The code is integrated into the final compiled/optimized Javascript but the browser shows an error ("cannot set property Mb of undefined"). I went back to the previous chapter code, since there didn't seem to be any difference, and tried the same steps there with no luck. (Sometimes I got the tightly compressed JS output, while others I just got three lines of "goog.addDependency", but I couldn't figure out what I was doing to cause that.)

This may be a version issue.

Blake Watson  Jul 25, 2014 
PDF Page 87
defn post

the google closure goog.net.XhrIo/send function doesn't specify a callback on it's own (it's very imperative):
http://closure-library.googlecode.com/svn/docs/class_goog_net_XhrIo.html

the receiver function seems to aimed to be used as just such a callback.

the solution is probably through some XhrManager or by updating the chapter to use clojure.browser.net-things.

Linus Ericsson  Feb 20, 2013 
PDF Page 87
defn post

bah. never mind. read wrong. there's a static send that does what you use in the example. i cannot get it working anyway, though. boring.

Linus Ericsson  Feb 20, 2013 
PDF Page 91
Sharing Code: 3rd bullet point

States that ClojureScript does not support "Refs and Vars". This should probably be "Refs and Agents", as Vars would be supported by clojure and clojurescript equally.

tom white  Sep 17, 2012 
PDF Page 92
1st paragraph, 1st sentence.

goog.events.EventType.LOAD has existed in Closure Library for some time. The mailing list item linked in this page's footer is not current.

Anonymous  Jun 19, 2014 
ePub Page 560 of 2546(Kindle)
United States

The index.html is directed to be created at public/resources/index.html. The output-to file in the compile command is given as resources/public/hello.js. Both the directories need to be the same.

prasad rao  Feb 02, 2013