On Monday, June 25, 2012 6:31:42 AM UTC+2, Christian Mueller wrote:
>
> I have developed a tiny web app in Clojure/ClojureScript and have written 
> an overview here <http://notehub.org/2012/6/16/how-notehub-is-built>. In 
> general, it was an exciting experience, but I also faced several problems 
> with ClojureScript. For example, if you compile your code to JS, then the 
> output file (in contrast to CoffeeScript) will contain other code (~18kb or 
> so): this code contains the Google Closure libraries, which do a lot of 
> stuff, like accessing the DOM elements. However, I found it *much* easier 
> to use jQuery (through the jayq library written in ClojureScript). Hence, 
> in my case, a lot of this additional code will be loaded for nothing. And 
> the first-time load times are not negligible!
>
> Furthermore, I did experience some performance problems with 
> ClojureScript, which I didn't investigate further, so I'm not sure, that 
> these problems hold in general. I did some per-character computations on a 
> very large text and it took just too long for such a primitive operation. 
> Since my code was quite high-level I assumed, that the GC of JS engine was 
> choked.
>
> Now to your questions
>
> 1. I suppose you can't call any Java library from ClojureScript if you 
>> want it to compile to JS. Can you call any Clojure library and have it 
>> translated?
>>
>
> This is right, what is supported in ClojureScript is _almost_ everything 
> what is supported in _native_ Clojure only, so don't expect things like 
> Integer/parseInt or all String methods to work in JS!
>  
>
>> 2. If I'd create a DSL with Clojure, could it be deployed to JS through 
>> ClojureScript also?
>>
>
> If you manage to keep it platform-independent, then of course. However, 
> even if you'll need some platform-specific calls, you can abstract them: I 
> had a similar problem with my web app (the problem is described in my 
> overview <http://notehub.org/2012/6/16/how-notehub-is-built>) when I 
> needed a simple hash function, which would work on the client and on the 
> server. The problem is that you run into the platform much faster, than you 
> assume: JS (and therefore ClojureScript) has no chars, it doesn't produce 
> overflows, the entire String API is different and so on. What I did, I just 
> implemented my code with dependency injections in form of higher order 
> functions injected as arguments. Such code can be run on the client and on 
> the server with different platform-specific parameter. This was fun.
>  
>
>> 3. One of my main concerns ...
>>
>
> I can't give more insightful answers as already given.
>
> I know the tooling is raw at the moment and that it'll get better 
>> overtime, so I'm asking more about the fundamental problems that are hardly 
>> going to be solved in the near time.
>>
>
> I think the only problem (if it is a problem at all), which won't be 
> solved soon is ClojureScript's performance resulting from creating a lot of 
> implicit objects in very high level computations. Something like (filter 
> (map (reduce ... ... (map ...)))) can't be as fast and as memory-efficient 
> for loops and in-place array operations of JS. In theory, the same holds 
> for Clojure and Java as well, however, in contrast to ClojureScript, I 
> never faced this problem on JVM yet.
>

Thanks a lot Christian for passing by to comment your experience, it's of 
great help. I'm going to read the complete overview just now. Thank you for 
taking the time to write about this.

And also thanks to David Nolen for clarifying all the other things.

Cheers! 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to