On Saturday, 17 November 2012 19:52:39 UTC-5, David Nolen wrote:
>
> What is the error under simple optimizations? Errors under advanced
> optimizations are not particularly informative :)
Good point, sorry.
Every minor change, is leading to significant differences, so I'm trying to
strip it right back at the moment. Ideally I want to compile using
Leiningen, but that's not consistent with the command line (I learned
tonight that there is a difference in versions there, but that Leiningen
should work).
Looking in some of the Clojurescript code I saw the comment that the call
to cljs.core/*main-cli-fn* always happens for node.js, so I've gone back to
using it. Now my file looks like:
(ns cljshello.core)
(defn -main [& argv]
(println "Hello, World!\n"))
(set! *main-cli-fn* -main)
I'm using a project of:
(defproject cljshello "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.0-alpha7"]
[org.clojure/clojurescript "0.0-1535"]]
:plugins [[lein-cljsbuild "0.2.9"]]
:hooks [leiningen.cljsbuild]
:cljsbuild {
:builds [{
:source-path "src"
:compiler { :output-to "pp.js"
:target :nodejs
:pretty-print true }}]})
Using "lein compile" on this I get a stack trace starting with:
Reloading Clojure file "/cljshello/core.clj" failed.
clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Unable
to resolve symbol: *main-cli-fn* in this context,
compiling:(cljshello/core.clj:7:1)
..... though, in the process of writing this email I tried changing the
:source-path to the specific file I am compiling and the compile finished
without warning. Am I correct in guessing that I'm supposed to describe a
build for each file?
All the same, whether I get a warning or not I still get a pp.js file.
Running this file under either conditions (error in compilation or not)
gives me:
/Users/pag/src/test/clj/cljshello/pp.js:493
goog.string.Unicode = {NBSP:"\u00a0"};
^
TypeError: Cannot set property 'Unicode' of undefined
at Object.<anonymous> (/Users/pag/src/test/clj/cljshello/pp.js:493:21)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
However, the same file is now compiling with the cli compiler, so I'll try
to work with it for the moment.
Paul
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en