I'm trying to get some Clojure code to compile to javascript.
So I've got a clojurescript repl up and running, and I was hoping it would
be a straightforward iterative process of:
Compile code.
Test code.
Get detailed bug (or at least a line number) if I used a feature not
available in clojurescri
clojurescript is still pretty young. Error reporting is not where I expect
most people would like to see it. This is a problem for all languages
complied to js at the moment.
That said - you can get used to the situation pretty quickly, with a little
patience and the occasional challenge.
If y
Additionally, if you are using the repl to experiment, you may benefit from
defining and testing each bit as you go.
On Thursday, 19 April 2012 21:59:03 UTC+10, Dave Sann wrote:
>
> clojurescript is still pretty young. Error reporting is not where I expect
> most people would like to see it. Thi
On Thu, Apr 19, 2012 at 4:59 AM, Dave Sann wrote:
> If I have errors, I use the stacktrace which you can access easily in
> chrome for example to get my bearing and figure out what is going on.
>
Can you elaborate on this? Right now, I'm using a rhino repl as per the
getting started instruction
If you are running in a browser - the console log will show a stacktrace
that you can use.
As you are using Rhino, sorry I don't use this. Others may be able to help.
(I think that *e and .printStackTrace are clojure repl and jvm interop
respectively - not available in cljs)
If you are porting
On Thu, Apr 19, 2012 at 10:01 AM, Dave Sann wrote:
> The error that you showed originally does not look like a compile error -
> but an execution error. I may be wrong.
>
Agreed. The error happens only when I execute the code, not when I compile
it. Since the code works fine in Clojure, my bes
How are you compiling the code?
David
On Thu, Apr 19, 2012 at 5:55 AM, Mark Engelberg wrote:
> I'm trying to get some Clojure code to compile to javascript.
>
> So I've got a clojurescript repl up and running, and I was hoping it would
> be a straightforward iterative process of:
> Compile code.
On Thu, Apr 19, 2012 at 10:56 AM, David Nolen wrote:
> How are you compiling the code?
>
> David
>
>
In the REPL, using (ns test (:require [namespace-of-file-I-want-to-compile
:as s]))
and then invoking the functions using (s/function item).
--
You received this message because you are subscribe
How are you starting the REPL? What version of ClojureScript? Are you using
lein-cljsbuild?
On Thu, Apr 19, 2012 at 2:09 PM, Mark Engelberg wrote:
> On Thu, Apr 19, 2012 at 10:56 AM, David Nolen wrote:
>
>> How are you compiling the code?
>>
>> David
>>
>>
> In the REPL, using (ns test (:require
lein-cljsbuild's trampoline tasks for starting REPLs are not working for me
(I reported this in another thread). Seems to be a problem with lein's
batch file for Windows not properly handling spaces in directories that
relate to plugins.
So I do lein repl (I've configured the project file with ad
Then you need construct your REPL with:
(repl/repl env :warn-on-undeclared true)
David
On Thu, Apr 19, 2012 at 2:27 PM, Mark Engelberg wrote:
> lein-cljsbuild's trampoline tasks for starting REPLs are not working for
> me (I reported this in another thread). Seems to be a problem with lein's
>
OK, this was very helpful advice. Using these warnings I was able to
identify several problems:
Clojurescript didn't like my use of defstruct
Clojurescript didn't like my throwing of a RuntimeException
Clojurescript doesn't understand the format function (is there a
substitute in Clojurescript-la
yes.
because this would be interpreted as a function/var that was expected to be
defined in the current namespace - you will see this in generated code.
my.namespace.function_I_thought_was_in_core
David's :warn-on-undefined should pick this up for code compiled via the
repl.
--
You received
I've found that by completely exiting and restarting the REPL, it is
working now. Woo hoo!
Way, way, way slower though. 16 seconds to produce an answer that takes 6
milliseconds in Java.
I have a suspicion that part of the time difference may have something to
do with Clojurescript's treatment
Is the 16 seconds figure from running your code in Rhino? From what I've
heard, the V8 engine is much, much faster (like, order(s) of magnitude)
than Rhino.
I'm not really sure what the best way to interactively run code on V8 is.
You could compile with node.js as the platform, and I think Da
Mark,
There's a format-like function in the Closure library.
Add to your namespace
(:require [goog.string :as gstring]
[goog.string.format :as gformat])
and call it like
(gstring/format "%02.0f" (inc 8)) ;;or whatever.
On Apr 19, 4:46 pm, Evan Mezeske wrote:
> Is the 16 seconds fi
On Thu, Apr 19, 2012 at 4:46 PM, Evan Mezeske wrote:
> Is the 16 seconds figure from running your code in Rhino?
>
Yes, Rhino. I'm also not doing any optimizations, although my
understanding is that advanced optimizations is more about pruning code and
reducing file size than reducing execution
Rhino is slow. If you want to see performance anywhere near the JVM you to
have to use a modern JavaScript engine - JavaScriptCore, SpiderMonkey, or
Google V8.
David
On Thu, Apr 19, 2012 at 7:31 PM, Mark Engelberg wrote:
> I've found that by completely exiting and restarting the REPL, it is
> wo
On Thu, Apr 19, 2012 at 8:43 PM, Mark Engelberg wrote:
> On Thu, Apr 19, 2012 at 4:46 PM, Evan Mezeske wrote:
>
>> Is the 16 seconds figure from running your code in Rhino?
>>
>
> Yes, Rhino. I'm also not doing any optimizations, although my
> understanding is that advanced optimizations is more
OK, I ran the same test directly in the browser with optimizations. I
wasn't doing it in a REPL, so I couldn't use the time function, but Firefox
appeared to take about 2 seconds, and Chrome was definitely under a
second. So yes, there does seem to be a world of difference from Rhino.
I'm still
(binding [*print-fn* #(.log js/console)] (time ...))
works in the browser
On Friday, 20 April 2012 11:25:31 UTC+10, puzzler wrote:
>
> OK, I ran the same test directly in the browser with optimizations. I
> wasn't doing it in a REPL, so I couldn't use the time function, but Firefox
> appeared
On Thu, Apr 19, 2012 at 9:25 PM, Mark Engelberg wrote:
> OK, I ran the same test directly in the browser with optimizations. I
> wasn't doing it in a REPL, so I couldn't use the time function, but Firefox
> appeared to take about 2 seconds, and Chrome was definitely under a
> second. So yes, the
22 matches
Mail list logo