Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
optimized clojurescript->js file throws exception but debug version does not?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Andrew  
View profile  
 More options Oct 4 2012, 12:40 pm
From: Andrew <ache...@gmail.com>
Date: Thu, 4 Oct 2012 09:40:05 -0700 (PDT)
Local: Thurs, Oct 4 2012 12:40 pm
Subject: optimized clojurescript->js file throws exception but debug version does not?

Please see https://github.com/achengs/subpar/issues/1 which links to two
demo pages. One page uses the debug (non-optimized non-munged) js version
and seems to work fine. The other uses the optimized version and throws an
exception. Details are in the github issues page and on the demo pages
themselves. I'm wondering why they behave differently. Thanks in advance
for any help!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Nolen  
View profile  
 More options Oct 4 2012, 1:02 pm
From: David Nolen <dnolen.li...@gmail.com>
Date: Thu, 4 Oct 2012 13:01:32 -0400
Local: Thurs, Oct 4 2012 1:01 pm
Subject: Re: optimized clojurescript->js file throws exception but debug version does not?

On Thu, Oct 4, 2012 at 12:40 PM, Andrew <ache...@gmail.com> wrote:
> Please see https://github.com/achengs/subpar/issues/1 which links to two
> demo pages. One page uses the debug (non-optimized non-munged) js version
> and seems to work fine. The other uses the optimized version and throws an
> exception. Details are in the github issues page and on the demo pages
> themselves. I'm wondering why they behave differently. Thanks in advance
> for any help!

There is too much context here. Can you isolate the problem and create a
minimal case? If you can it would be extremely helpful if you could create
an issue in JIRA w/ this information.

Thanks!

David


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew  
View profile  
 More options Oct 5 2012, 2:37 am
From: Andrew <ache...@gmail.com>
Date: Thu, 4 Oct 2012 23:37:50 -0700 (PDT)
Local: Fri, Oct 5 2012 2:37 am
Subject: Re: optimized clojurescript->js file throws exception but debug version does not?

Ok, I've made *some* progress in ripping out code unrelated to this issue.
So far it seems if I remove any more the issue disappears. See
https://github.com/achengs/subparissue1

It's a mystery to me why ...

   - removing any of the three arguments to the loop/recur in the parse
   function in
   https://github.com/achengs/subparissue1/blob/master/src-cljs/subpar/c... prevents
   the exception from being thrown (the issue goes away and both output js
   files behave the same)
   - the so-called parse function interprets the first character from
   codemirror differently the second time you hit Alt-S on the demo page that
   reproduces the exception... but this difference in parsing doesn't show up
   on the page that demos normal behavior
   - removing the for loop in
   https://github.com/achengs/subparissue1/blob/master/resources/public/... for
   reindenting lines also makes the issue go away


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew  
View profile  
 More options Oct 5 2012, 8:16 am
From: Andrew <ache...@gmail.com>
Date: Fri, 5 Oct 2012 05:16:03 -0700 (PDT)
Local: Fri, Oct 5 2012 8:16 am
Subject: Re: optimized clojurescript->js file throws exception but debug version does not?

Oh. I'm pretty sure it's because in the broken case I use two blobs of js
which were minified at *separate* times thus allowing for name conflicts.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Nolen  
View profile  
 More options Oct 5 2012, 8:21 am
From: David Nolen <dnolen.li...@gmail.com>
Date: Fri, 5 Oct 2012 08:20:36 -0400
Local: Fri, Oct 5 2012 8:20 am
Subject: Re: optimized clojurescript->js file throws exception but debug version does not?

On Fri, Oct 5, 2012 at 8:16 AM, Andrew <ache...@gmail.com> wrote:
> Oh. I'm pretty sure it's because in the broken case I use two blobs of js
> which were minified at *separate* times thus allowing for name conflicts.

Yes Closure assumes whole program optimization. You can't use two
separately advanced compiled pieces of JS code together.

So is this the actual issue?

David


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew  
View profile  
 More options Oct 5 2012, 8:38 am
From: Andrew <ache...@gmail.com>
Date: Fri, 5 Oct 2012 05:38:40 -0700 (PDT)
Local: Fri, Oct 5 2012 8:38 am
Subject: Re: optimized clojurescript->js file throws exception but debug version does not?

How do I tell Closure to include Codemirror.js and other js files when it
optimizes?

My project.clj file has this:

  :cljsbuild {

              :builds {
                       :prod
                       {:source-path "src-cljs"
                        :compiler {:output-to
"resources/public/js/subpar.core.js"
                                   :optimizations :advanced
                                   :pretty-print false}}}


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Nolen  
View profile  
 More options Oct 5 2012, 8:52 am
From: David Nolen <dnolen.li...@gmail.com>
Date: Fri, 5 Oct 2012 08:51:24 -0400
Local: Fri, Oct 5 2012 8:51 am
Subject: Re: optimized clojurescript->js file throws exception but debug version does not?

You might find this helpful:
http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescri...

I believe you can use the same options you give to ClojureScript compiler
so you should be good.

David


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew  
View profile  
 More options Oct 5 2012, 2:37 pm
From: Andrew <ache...@gmail.com>
Date: Fri, 5 Oct 2012 11:37:21 -0700 (PDT)
Local: Fri, Oct 5 2012 2:37 pm
Subject: Re: optimized clojurescript->js file throws exception but debug version does not?

After I read the link you provided and another page<http://code.google.com/p/closure-compiler/wiki/FAQ#When_using_Advance...>,
I discovered that wrapping my compiled stuff in an anonymous function keeps
Google Closure's output symbols from colliding with other existing stuff
such as CodeMirror's minified variables.

That link points out that it's best to have the compiler do the wrapping
for you with  --output_wrapper. Is there a way to specify this for
cljsbuild? lein-cljsbuild issue #117<https://github.com/emezeske/lein-cljsbuild/issues/117>says cljsbuild is just a wrapper for the ClojureScript compiler and if we
want it we should open a ticket for ClojureScript. I looked and did not
immediately see a ticket or the wrapper option. So maybe I'll open that
ticket?

By the way, I'm not sure compiling CodeMirror and my stuff in one go is the
right approach, because I don't know whether CodeMirror is compatible with
Google Closure's advanced compilation. (I see that CodeMirror 1's
compression page had Google Closure advanced optimization as an option but
it disappeared for CodeMirror 2.) I think doing so would require me to
hand-edit CodeMirror to add a goog.provide call.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Nolen  
View profile  
 More options Oct 5 2012, 2:39 pm
From: David Nolen <dnolen.li...@gmail.com>
Date: Fri, 5 Oct 2012 14:38:54 -0400
Local: Fri, Oct 5 2012 2:38 pm
Subject: Re: optimized clojurescript->js file throws exception but debug version does not?

You don't need to do that. That's what the :foreign-libs option is for
which is described at the end of blog post.

David


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew  
View profile  
 More options Oct 6 2012, 11:14 pm
From: Andrew <ache...@gmail.com>
Date: Sat, 6 Oct 2012 20:14:54 -0700 (PDT)
Local: Sat, Oct 6 2012 11:14 pm
Subject: Re: optimized clojurescript->js file throws exception but debug version does not?

What about the --output_wrapper part?

My clojurescript js never calls the minified foreign library directly: What
I have is [1] some plain non-optimized javascript that calls [2] CodeMirror
for the code and position, then calls [3] my clojurescript js to find out
how to do the requested paredit thing, and then calls [2] CodeMirror again
to do it.

So [3] never calls [2]

[2] and [3] export stuff so that [1] can call them.

And my problem is that [2] isn't wrapped in an anonymous function. How do I
get cljsbuild to tell Closure to use --output_wrapper? (Also, I guess
there's a good reason why it doesn't always wrap its output?)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Nolen  
View profile  
 More options Oct 7 2012, 6:55 pm
From: David Nolen <dnolen.li...@gmail.com>
Date: Sun, 7 Oct 2012 18:55:32 -0400
Local: Sun, Oct 7 2012 6:55 pm
Subject: Re: optimized clojurescript->js file throws exception but debug version does not?

Seems like a simple useful option we should expose.

http://dev.clojure.org/jira/browse/CLJS-388

David


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »