<< Back to previous view

[CLJS-808] Warning from `find-classpath-lib` mistakenly included in generated source Created: 02/Jun/14  Updated: 27/Mar/15  Resolved: 27/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3115
Fix Version/s: Next

Type: Defect Priority: Major
Reporter: Joshua Ballanco Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None
Environment:

clojurescript 0.0-r2227
target: node


Attachments: Text File warn-with-out-str-fix.patch    
Patch: Code

 Description   

When compiling for node.js, `find-classpath-lib` generates a warning because `cljs/nodejs.js` doesn't contain a `goog.provide` declaration. However, this warning ends up being emitted into the JS files being generated (caused by a call to `with-out-str`), later causing a critical failure in the Closure compiler.

To reproduce:

  • `lein new cljs-node buggy`
  • Update clojurescript to r2227, lein-cljsbuild to 1.0.3
  • `lein cljsbuild once`

Result:

  • Multiple warnings
  • Generated "buggy.js" file contains only node.js shebang

Fix:

  • The simplest patch (attached) is to rebind `out` to `err` when emitting a warning
  • A better fix would be to write a function for error printing that wraps this idiom
  • Ideally, cljs/nodejs.js should have a `goog.provides` line added to prevent the warning in the first place


 Comments   
Comment by David Nolen [ 02/Jun/14 7:45 AM ]

A patch that adds a goog.provide to the file is preferred, thanks!

Comment by David Nolen [ 27/Mar/15 7:42 AM ]

fixed https://github.com/clojure/clojurescript/commit/9cddd7581c5cdacfe4f4f20274aed61cd3cfc7cb





[CLJS-1144] Expose MultiFn assessors Created: 18/Mar/15  Updated: 27/Mar/15  Resolved: 27/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3123
Fix Version/s: Next

Type: Enhancement Priority: Major
Reporter: Joel Holdbrooks Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File 1144.patch    

 Description   

The MultiFn fields default-dispatch-val and dispatch-fn are useful in some cases. It would be nice to have accessors for these fields instead of having to use property access directly.



 Comments   
Comment by Joel Holdbrooks [ 18/Mar/15 12:31 PM ]

Added patch

Comment by David Nolen [ 27/Mar/15 7:35 AM ]

fixed https://github.com/clojure/clojurescript/commit/4eebd45bd82f40c8e656d97ee996ed91c48a3ec5





[CLJS-1172] Determine if practical to supply main entry points for all standard REPLs Created: 26/Mar/15  Updated: 27/Mar/15  Resolved: 27/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3126
Fix Version/s: Next

Type: Task Priority: Major
Reporter: David Nolen Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None


 Comments   
Comment by David Nolen [ 27/Mar/15 5:21 AM ]

fixed https://github.com/clojure/clojurescript/commit/9d7ee61070ba50dce283dea2b4c5caceaf8002cc





[CLJS-1171] map clojure.repl/doc, clojure.repl/source, clojure.repl/dir Created: 26/Mar/15  Updated: 27/Mar/15  Resolved: 27/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3126
Fix Version/s: Next

Type: Defect Priority: Major
Reporter: David Nolen Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None


 Comments   
Comment by David Nolen [ 27/Mar/15 5:02 AM ]

fixed https://github.com/clojure/clojurescript/commit/a8809d7030a82943d40094aeffa84c0f573630e9





[CLJS-1170] expose macroexpand & macroexpand-1 at the REPL Created: 26/Mar/15  Updated: 27/Mar/15  Resolved: 27/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3126
Fix Version/s: Next

Type: Defect Priority: Major
Reporter: David Nolen Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None


 Comments   
Comment by David Nolen [ 27/Mar/15 4:58 AM ]

fixed https://github.com/clojure/clojurescript/commit/f58861149dac8a8e61e34414903ed43c01acbe91





[CLJS-1169] cannot use REPL load-file on files that declare single segment namespaces Created: 26/Mar/15  Updated: 26/Mar/15  Resolved: 26/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3126
Fix Version/s: Next

Type: Defect Priority: Major
Reporter: David Nolen Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None


 Description   

While not encouraged for projects, being able to do this when trying thing out is convenient.



 Comments   
Comment by David Nolen [ 26/Mar/15 9:19 PM ]

fixed by b17edea679fab22bafb949f0cffb01c1c55d33c9





[CLJS-288] Compilation of unordered collections Created: 31/May/12  Updated: 25/Mar/15  Resolved: 25/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Trivial
Reporter: Brandon Bloom Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None


 Description   

Given:

(defn f [x] (println x) x)

{(f 5) (f 10), (f :x) (f :y)}

Clojure produces:

5
10
:x
:y

{5 10, :x :y}

ClojureScript produces:

5
:x
10
:y

{5 10, :x :y}

 Comments   
Comment by Brandon Bloom [ 16/Aug/12 9:28 PM ]

See also: CLJ-1043

I realized that this problem is actually only partially solvable as is. We could assign the interleaved keys and values to locals before constructing the map. Unfortunately, that doesn't solve a bigger underlying problem: The reader returns unordered sets and maps.

Comment by David Nolen [ 31/Aug/12 9:23 AM ]

Is this actually a problem?

Comment by Brandon Bloom [ 23/Sep/12 7:40 PM ]

See discussion at http://dev.clojure.org/jira/browse/CLJ-1043?focusedCommentId=29526#comment-29526

Comment by Brandon Bloom [ 25/Mar/15 8:08 PM ]

See discussion at CLJ-1043





[CLJS-1163] Using (require 'namespace.core :reload) causes "too much recursion" Created: 23/Mar/15  Updated: 23/Mar/15  Resolved: 23/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3126
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: J David Eisenberg Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: None
Environment:

Linux (Fedora 21)


Attachments: File m060.tgz    

 Description   

lein new mies m060 (using latest version of mies from github)
Uncomment repl/connect in core.cljs, add function (defn doubled[x] (* 2 x))
In one terminal window: scripts/watch (wait for it to build)
In another terminal window: scripts/brepl
In browser: go to http://localhost:9000 and open web console.
In REPL: (require 'm060.core), then (in-ns 'm060.core)
In editor, add this to core.cljs: (defn tripled[x] (* 3 x)) ;; the "watch" window will recompile it
In REPL: (require 'm060.core :reload)
After a long pause, web console displays "too much recursion" message twice.
Despite the error message, in REPL: (tripled 10) works properly.



 Comments   
Comment by David Nolen [ 23/Mar/15 11:07 PM ]

We don't support multiple processes compiling to the same output directory.

Comment by J David Eisenberg [ 23/Mar/15 11:08 PM ]

Spurious issue; can't run both brepl and watch at the same time.





[CLJS-1019] REPL source map caching support Created: 07/Feb/15  Updated: 23/Mar/15  Resolved: 23/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3126
Fix Version/s: Next

Type: Defect Priority: Major
Reporter: David Nolen Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None


 Description   

Need smarter caching for better performance. Probably something based on last modified times.



 Comments   
Comment by David Nolen [ 23/Mar/15 9:57 PM ]

fixed https://github.com/clojure/clojurescript/commit/fc8dfa4cd2010cda5079d5f7967b3ef5b93dcb0a





[CLJS-1162] Failure to printStackTrace when REPL initialized Created: 23/Mar/15  Updated: 23/Mar/15  Resolved: 23/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: Next
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Mike Fikes Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File CLJS-1162.patch    

 Description   

I got the (spurious) exception included below once when starting the Ambly REPL with 0.0-3148.

For quick reference, relevant code is
https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/repl.clj#L687

FWIW, I found that I can reproduce it in a Clojure REPL with:

(binding [*err* 1]
      (.printStackTrace (clojure.lang.ExceptionInfo. "hi" {} (Throwable.)) *err*))

where *err* is bound to anything of a type that is not an instance of PrintStream, which is perhaps at the root of the problem.

Exception in thread "main" java.lang.IllegalArgumentException: No matching method found: printStackTrace for class clojure.lang.ExceptionInfo, compiling:(/private/var/folders/nm/97bx7f_n31z2t2g_gf2bn90w0h013l/T/form-init733659167150723581.clj:1:141)
	at clojure.lang.Compiler.load(Compiler.java:7142)
	at clojure.lang.Compiler.loadFile(Compiler.java:7086)
	at clojure.main$load_script.invoke(main.clj:274)
	at clojure.main$init_opt.invoke(main.clj:279)
	at clojure.main$initialize.invoke(main.clj:307)
	at clojure.main$null_opt.invoke(main.clj:342)
	at clojure.main$main.doInvoke(main.clj:420)
	at clojure.lang.RestFn.invoke(RestFn.java:421)
	at clojure.lang.Var.invoke(Var.java:383)
	at clojure.lang.AFn.applyToHelper(AFn.java:156)
	at clojure.lang.Var.applyTo(Var.java:700)
	at clojure.main.main(main.java:37)
Caused by: java.lang.IllegalArgumentException: No matching method found: printStackTrace for class clojure.lang.ExceptionInfo
	at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:80)
	at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
	at cljs.repl$repl_caught.invoke(repl.clj:687)
	at cljs.repl$repl_STAR_$fn__4102$fn__4103.invoke(repl.clj:790)
	at cljs.repl$repl_STAR_$fn__4102.invoke(repl.clj:785)
	at cljs.compiler$with_core_cljs.invoke(compiler.clj:951)
	at cljs.repl$repl_STAR_.invoke(repl.clj:782)
	at user$eval4325.invoke(form-init733659167150723581.clj:3)
	at clojure.lang.Compiler.eval(Compiler.java:6703)
	at clojure.lang.Compiler.eval(Compiler.java:6666)
	at clojure.core$eval.invoke(core.clj:2927)
	at clojure.main$eval_opt.invoke(main.clj:288)
	at clojure.main$initialize.invoke(main.clj:307)
	at clojure.main$null_opt.invoke(main.clj:342)
	at clojure.main$main.doInvoke(main.clj:420)
	at clojure.lang.RestFn.invoke(RestFn.java:421)
	at clojure.lang.Var.invoke(Var.java:383)
	at clojure.lang.AFn.applyToHelper(AFn.java:156)
	at clojure.lang.Var.applyTo(Var.java:700)
	at clojure.main.main(main.java:37)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
	at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:207)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
	at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:207)
	at user$eval5.invoke(form-init733659167150723581.clj:1)
	at clojure.lang.Compiler.eval(Compiler.java:6703)
	at clojure.lang.Compiler.eval(Compiler.java:6693)
	at clojure.lang.Compiler.load(Compiler.java:7130)
	... 11 more


 Comments   
Comment by Mike Fikes [ 23/Mar/15 1:07 PM ]

Minor correction to description: PrintStream or PrintWriter.

Comment by Mike Fikes [ 23/Mar/15 1:30 PM ]

I am able to reproduce this by adding

(throw (clojure.lang.ExceptionInfo. "hi" {} (Throwable.)))

to Ambly's startup impl.

With this, I added a (prn *err*) right before the line in repl.clj and get this:

#<OutputStreamWriter java.io.OutputStreamWriter@1fe05fff>

This class is neither PrintStream or PrintWriter, so this is the penultimate cause.

Comment by Mike Fikes [ 23/Mar/15 1:37 PM ]

A minimal repro with Node.js REPL:

Add the throw mentioned above to the Node REPL impl, as the first thing inside setup:

--- a/src/clj/cljs/repl/node.clj
+++ b/src/clj/cljs/repl/node.clj
@@ -102,6 +102,7 @@
           root (.substring path 0 (+ (.indexOf path fc) (count fc)))
           root-path (vec (cons root cs))
           rewrite-path (conj root-path "goog")]
+      (throw (clojure.lang.ExceptionInfo. "hi" {} (Throwable.)))
       (reset! (:proc repl-env) proc)
       (loop [r nil]
         (when-not (= r "ready")

Then (with (prn *err*) still in place):

Mike-Fikess-MacBook-Pro:clojurescript mfikes$ script/noderepljs 
#<OutputStreamWriter java.io.OutputStreamWriter@41f686af>
Exception in thread "main" java.lang.IllegalArgumentException: No matching method found: printStackTrace for class clojure.lang.ExceptionInfo
	at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:80)
	at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
	at cljs.repl$repl_caught.invoke(repl.clj:688)
	at cljs.repl$repl_STAR_$fn__4074.invoke(repl.clj:756)
	at cljs.compiler$with_core_cljs.invoke(compiler.clj:951)
	at cljs.repl$repl_STAR_.invoke(repl.clj:749)
	at cljs.repl$repl.doInvoke(repl.clj:900)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at user$eval4248.invoke(NO_SOURCE_FILE:3)
	at clojure.lang.Compiler.eval(Compiler.java:6703)
	at clojure.lang.Compiler.eval(Compiler.java:6666)
	at clojure.core$eval.invoke(core.clj:2927)
	at clojure.main$eval_opt.invoke(main.clj:288)
	at clojure.main$initialize.invoke(main.clj:307)
	at clojure.main$null_opt.invoke(main.clj:342)
	at clojure.main$main.doInvoke(main.clj:420)
	at clojure.lang.RestFn.invoke(RestFn.java:421)
	at clojure.lang.Var.invoke(Var.java:383)
	at clojure.lang.AFn.applyToHelper(AFn.java:156)
	at clojure.lang.Var.applyTo(Var.java:700)
	at clojure.main.main(main.java:37)
ClojureScript Node.js REPL server listening on 57399
Mike-Fikess-MacBook-Pro:clojurescript mfikes$
Comment by Mike Fikes [ 23/Mar/15 2:07 PM ]

Attached patch resolves issue. See CLJ-286 for interesting discussion surrounding root cause.

Comment by Mike Fikes [ 23/Mar/15 3:43 PM ]

I suppose an alternate patch could first check if *out* is a PrintWriter and conditionally do the wrapping. I'd be happy to put that together if warranted.

Comment by David Nolen [ 23/Mar/15 4:04 PM ]

fixed https://github.com/clojure/clojurescript/commit/b9d6a75a2693037f95abd4c211d9df0aa3e99251

Comment by Mike Fikes [ 23/Mar/15 4:27 PM ]

Confirmed fixed in master.





[CLJS-1161] Use higher-level binding of *cljs-ns*, REPL stack traces not printing to *err* Created: 23/Mar/15  Updated: 23/Mar/15  Resolved: 23/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3126
Fix Version/s: Next

Type: Enhancement Priority: Blocker
Reporter: Chas Emerick Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File CLJS-1161.patch    
Patch: Code

 Comments   
Comment by Chas Emerick [ 23/Mar/15 12:18 PM ]

Patch attached. Not printing to *err* was probably just an oversight; being able to rebind *cljs-ns* at a higher level enables user-facing REPL utilities other than cljs.repl/repl.

Comment by David Nolen [ 23/Mar/15 12:21 PM ]

fixed https://github.com/clojure/clojurescript/commit/4a3737bbe8de30081c9aef1ec15f8aae9065a1b6





[CLJS-841] cljs.closure/build file locks Created: 13/Aug/14  Updated: 22/Mar/15  Resolved: 22/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3126
Fix Version/s: Next

Type: Defect Priority: Major
Reporter: joerupen Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None
Environment:

Windows 7, 8, sublime text 3, lein-cljsbuild 1.0.3



 Description   

I suspect that the following issue of the lein-cljsbuild (https://github.com/emezeske/lein-cljsbuild/issues/322) is caused by clojurescript itself and not the plugin. In short: Is it possible that the cljs.closure/build function keeps file locks on the source files? This would explain why running `lein cljsbuild auto` prevents editors like sublime to save (overwrite) the files.



 Comments   
Comment by Thomas Heller [ 14/Aug/14 4:01 AM ]

cljs.closure/build does no file locking. The file is opened, read completely and then closed.

https://github.com/clojure/clojurescript/blob/95122e1206d4a64f392cff03bfd73712ab7f3a33/src/clj/cljs/closure.clj#L256

Comment by joerupen [ 18/Aug/14 6:11 AM ]

Okay, but how is possible that when I comment out the call to the build function, then lein-cljsbuild maintains no locks on the source files? Without the call, lein-cljsbuild picks up any modifications that I do to my source files and invokes the build (which in that case just does nothing, see https://github.com/emezeske/lein-cljsbuild/issues/322).

I opened this issue because it's really disturbing the development workflow when you cannot use `lein cljsbuild auto`. If it's not due to ClojureScript you can close this issue.

Comment by David Nolen [ 18/Aug/14 9:41 AM ]

Never heard this before, sounds possibly like a host issue that we might not be aware of?

Comment by joerupen [ 18/Aug/14 4:18 PM ]

It happens on win7/8 with jdk 7. This problem seems related to sublime 3, as with e.g. lighttable I have no problem. You can see that java.exe holds open file handles on the source files (sysinternals process explorer). Closing the handles manually works but is just a workaround. The reason is that sublime is actually doing a file 'move' operation. When you run `lein cljsbuild auto` and try to overwrite a source file from windows explorer you get the same problem, however you can still open & modify the file in various editors. So it's not a real file lock, but a file lock that prevents a file-move operation. I really don't know if it's ClojureScript or the plugin itself.

Comment by Thomas Heller [ 19/Aug/14 6:21 AM ]

Not sure how lein-cljsbuild handles the file watching, maybe that keeps files open?

Try replacing your (spit ...) test with (Thread/sleep 5000) or something that takes time, since spit is probably "too fast". Is it happening then?

Comment by joerupen [ 19/Aug/14 9:47 AM ]

I just tried to intercept the arguments in the call to cljs.closure/build and then invoked the build function in a repl using the same args. There was no lock this time, but also the generated js files were wrong. There might be some thread bindings in lein-cljsbuild that I am missing, but it looks like the build function by itself does not lock. I also replaced the code with Thread/sleep but the effect is the same. Only when I comment out the build function I can save my file. I also tried to run the build function in an agent, but without success, locks keep existing. I'll keep exploring some other potential causes in lein-cljsbuild and let you know if I find something useful.

Comment by joerupen [ 20/Aug/14 4:45 AM ]

By introducing a (Thread/sleep 5000) right after the build function I give the JVM some time to relax right after compiling. The locks seem to disappear (or become very rare). Doesn't that should like a finalizer waiting to be called by the garbage collector? If the polling starts immediatly, the locks occur almost instantly. I know that functions like slurp are pretty safe, so maybe this whole issue is caused by some internals of the JVM itself. Since I don't know all the internals of cljs.closure/build I can't possibly exclude it.

@Thomas: I had a look at the lein-cljsbuild source and from what I understood was that every 100ms,

My conclusion is that lein-cljsbuild does not open any file for reading (at least not in my simple project, no macros, no crossovers, just a simple hello world if you will). It only does directory listings and queries for modified timestamps. Under the hood, querying a file's attributes might very well translate into a call for opening & reading the file and this is done very often. If you have some ideas how I could attempt to locate the root cause, a hint would be appreciated As a workaround I can only recommend to switch to lighttable.

Comment by Thomas Heller [ 20/Aug/14 4:02 PM ]

100ms seems a little overkill to me since no human will make meaningful changes in that time, but that should not matter. A pending finalizer should not be the cause since cljs.closure/build uses with-open which closes the reader when done.

But I use neither Windows, Sublime Text or lein-cljsbuild so I'm just guessing anyways.

If you are feeling adventurous you could try https://github.com/thheller/shadow-build (shameless-plug) but I never tried it on Windows so it might actually blow up or something.

Comment by joerupen [ 22/Aug/14 7:28 AM ]

On https://github.com/emezeske/lein-cljsbuild/issues/322 I have posted a workaround. I basically copy the source cljs files to a temp folder and run `cljs.closure/build` from that folder. Interestingly I can always delete that folder after invoking build. This indicates that this issue only occurs in combination with the lein-cljsbuild plugin (due to the watch behavior). As far as the build function is concerned I'd recommend to close this issue in jira.

Comment by David Nolen [ 02/Dec/14 5:14 AM ]

Not a ClojureScript thing specifically.

Comment by David Nolen [ 19/Mar/15 6:38 AM ]

This is a legitimate platform issue: http://stackoverflow.com/questions/2537306/java-opening-and-reading-from-a-file-without-locking-it

Comment by David Nolen [ 21/Mar/15 8:56 PM ]

Unfortunately I don't see a good way to solve this. Someone who is more familiar with Java on Windows will have to contribute an answer for closing the reader under error conditions.

Comment by David Nolen [ 22/Mar/15 2:44 PM ]

fixed https://github.com/clojure/clojurescript/commit/f2897beccd8ad32c93658047b9439de2841533a9





[CLJS-1156] load-file fails with :make-reader issue Created: 20/Mar/15  Updated: 22/Mar/15  Resolved: 21/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3126
Fix Version/s: Next

Type: Defect Priority: Blocker
Reporter: Mike Fikes Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None
Environment:

Quick Start, browser REPL (with :watch eliminated from repl.clj), OS X, Chrome,



 Description   

If I try (load-file ...) in the Browser REPL (Quick Start) for a file I've added it fails.

Here is a sample transcript illustrating the issue, followed by successfully using (require ...).

orion:hello_world mfikes$ rlwrap java -cp cljs.jar:src clojure.main repl.clj
Compiling client js ...
Waiting for browser to connect ...
To quit, type: :cljs/quit
ClojureScript:cljs.user> (doc load-file)
-------------------------
load-file
REPL Special Function
  Sequentially read and evaluate the set of forms contained in the file.
nil
ClojureScript:cljs.user> (load-file "src/foo/bar.cljs")
java.lang.IllegalArgumentException: No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil
	at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:544)
	at clojure.java.io$fn__8628$G__8610__8635.invoke(io.clj:69)
	at clojure.java.io$reader.doInvoke(io.clj:102)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at cljs.analyzer$forms_seq.invoke(analyzer.clj:1957)
	at cljs.analyzer$parse_ns$fn__1485.invoke(analyzer.clj:2011)
	at cljs.analyzer$parse_ns.invoke(analyzer.clj:1998)
	at cljs.analyzer$parse_ns.invoke(analyzer.clj:1989)
	at cljs.closure$src_file__GT_target_file.invoke(closure.clj:1580)
	at cljs.closure$src_file__GT_target_file.invoke(closure.clj:1575)
	at cljs.repl$load_file.invoke(repl.clj:467)
	at cljs.repl$fn__3938$self__3940.invoke(repl.clj:540)
	at cljs.repl$repl_STAR_$read_eval_print__4004.invoke(repl.clj:745)
	at cljs.repl$repl_STAR_$fn__4010$fn__4017.invoke(repl.clj:785)
	at cljs.repl$repl_STAR_$fn__4010.invoke(repl.clj:784)
	at cljs.compiler$with_core_cljs.invoke(compiler.clj:950)
	at cljs.repl$repl_STAR_.invoke(repl.clj:749)
	at cljs.repl$repl.doInvoke(repl.clj:866)
	at clojure.lang.RestFn.invoke(RestFn.java:439)
	at user$eval30.invoke(repl.clj:10)
	at clojure.lang.Compiler.eval(Compiler.java:6703)
	at clojure.lang.Compiler.load(Compiler.java:7130)
	at clojure.lang.Compiler.loadFile(Compiler.java:7086)
	at clojure.main$load_script.invoke(main.clj:274)
	at clojure.main$script_opt.invoke(main.clj:336)
	at clojure.main$main.doInvoke(main.clj:420)
	at clojure.lang.RestFn.invoke(RestFn.java:408)
	at clojure.lang.Var.invoke(Var.java:379)
	at clojure.lang.AFn.applyToHelper(AFn.java:154)
	at clojure.lang.Var.applyTo(Var.java:700)
	at clojure.main.main(main.java:37)
ClojureScript:cljs.user> (load-file "/Users/mfikes/Desktop/hello_world/src/foo/bar.cljs")
java.lang.IllegalArgumentException: No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil
	at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:544)
	at clojure.java.io$fn__8628$G__8610__8635.invoke(io.clj:69)
	at clojure.java.io$reader.doInvoke(io.clj:102)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at cljs.analyzer$forms_seq.invoke(analyzer.clj:1957)
	at cljs.analyzer$parse_ns$fn__1485.invoke(analyzer.clj:2011)
	at cljs.analyzer$parse_ns.invoke(analyzer.clj:1998)
	at cljs.analyzer$parse_ns.invoke(analyzer.clj:1989)
	at cljs.closure$src_file__GT_target_file.invoke(closure.clj:1580)
	at cljs.closure$src_file__GT_target_file.invoke(closure.clj:1575)
	at cljs.repl$load_file.invoke(repl.clj:467)
	at cljs.repl$fn__3938$self__3940.invoke(repl.clj:540)
	at cljs.repl$repl_STAR_$read_eval_print__4004.invoke(repl.clj:745)
	at cljs.repl$repl_STAR_$fn__4010$fn__4017.invoke(repl.clj:785)
	at cljs.repl$repl_STAR_$fn__4010.invoke(repl.clj:784)
	at cljs.compiler$with_core_cljs.invoke(compiler.clj:950)
	at cljs.repl$repl_STAR_.invoke(repl.clj:749)
	at cljs.repl$repl.doInvoke(repl.clj:866)
	at clojure.lang.RestFn.invoke(RestFn.java:439)
	at user$eval30.invoke(repl.clj:10)
	at clojure.lang.Compiler.eval(Compiler.java:6703)
	at clojure.lang.Compiler.load(Compiler.java:7130)
	at clojure.lang.Compiler.loadFile(Compiler.java:7086)
	at clojure.main$load_script.invoke(main.clj:274)
	at clojure.main$script_opt.invoke(main.clj:336)
	at clojure.main$main.doInvoke(main.clj:420)
	at clojure.lang.RestFn.invoke(RestFn.java:408)
	at clojure.lang.Var.invoke(Var.java:379)
	at clojure.lang.AFn.applyToHelper(AFn.java:154)
	at clojure.lang.Var.applyTo(Var.java:700)
	at clojure.main.main(main.java:37)
ClojureScript:cljs.user> (require 'foo.bar)
nil
ClojureScript:cljs.user> (ns-interns 'foo.bar)
{six #'foo.bar/six, two! #'foo.bar/two!, one #'foo.bar/one, eight #'foo.bar/eight, five' #'foo.bar/five', four #'foo.bar/four, nine #'foo.bar/nine, seven #'foo.bar/seven, three* #'foo.bar/three*}


 Comments   
Comment by Mike Fikes [ 20/Mar/15 9:37 PM ]

I'm not familiar with the way load-file is supposed work. I used the fully-qualified path, because that's what I saw Cursive do. I tried a path relative to the source directory, and this does't balk, but doesn't work either:

ClojureScript:cljs.user> (load-file "foo/bar.cljs")
nil
ClojureScript:cljs.user> (ns-interns 'foo.bar)
{}
Comment by Mike Fikes [ 20/Mar/15 9:40 PM ]

(I apologize for the ticket noise.)

The relative path does work in that the symbols are loaded into the browser JavaScript engine, while ns-interns is not updated:

orion:hello_world mfikes$ rlwrap java -cp cljs.jar:src clojure.main repl.clj
Compiling client js ...
Waiting for browser to connect ...
To quit, type: :cljs/quit
ClojureScript:cljs.user> (foo.bar/nine)
WARNING: Use of undeclared Var foo.bar/nine at line 1 <cljs repl>
ReferenceError: foo is not defined
ReferenceError: foo is not defined
    at eval (eval at <anonymous> (http://localhost:9000/out/clojure/browser/repl.js:42:272), <anonymous>:1:89)
    at eval (eval at <anonymous> (http://localhost:9000/out/clojure/browser/repl.js:42:272), <anonymous>:9:3)
    at eval (eval at <anonymous> (http://localhost:9000/out/clojure/browser/repl.js:42:272), <anonymous>:14:4)
    at http://localhost:9000/out/clojure/browser/repl.js:42:267
    at clojure$browser$repl$evaluate_javascript (http://localhost:9000/out/clojure/browser/repl.js:45:4)
    at Object.callback (http://localhost:9000/out/clojure/browser/repl.js:242:169)
    at goog.messaging.AbstractChannel.deliver (http://localhost:9000/out/goog/messaging/abstractchannel.js:142:13)
    at goog.net.xpc.CrossPageChannel.xpcDeliver (http://localhost:9000/out/goog/net/xpc/crosspagechannel.js:733:12)
    at Function.goog.net.xpc.NativeMessagingTransport.messageReceived_ (http://localhost:9000/out/goog/net/xpc/nativemessagingtransport.js:321:13)
    at Object.goog.events.fireListener (http://localhost:9000/out/goog/events/events.js:741:21)
ClojureScript:cljs.user> (load-file "foo/bar.cljs")
nil
ClojureScript:cljs.user> (foo.bar/nine)
WARNING: Use of undeclared Var foo.bar/nine at line 1 <cljs repl>
Error: 1 is not ISeqable
	 cljs$core$seq (out/cljs/core.cljs:951:13)
	 cljs$core$first (out/cljs/core.cljs:960:7)
	 cljs$core$ffirst (out/cljs/core.cljs:1393:3)
	 foo$bar$one (out/foo/bar.cljs:7:14)
	 foo$bar$two_BANG_ (out/foo/bar.cljs:9:15)
	 foo$bar$three_STAR_ (out/foo/bar.cljs:11:17)
	 foo$bar$four (out/foo/bar.cljs:13:15)
	 foo$bar$five_SINGLEQUOTE_ (out/foo/bar.cljs:16:16)
	 foo$bar$six (out/foo/bar.cljs:20:2)
ClojureScript:cljs.user> (ns-interns 'foo.bar)
{}

(The exception thrown from foo.bar/nine is expected... I was testing stacktraces with this namespace earlier.)

Comment by David Nolen [ 21/Mar/15 8:46 PM ]

fixed https://github.com/clojure/clojurescript/commit/eb9478cab0f08cd752c1bb7894c2b4375346600a

Comment by Mike Fikes [ 22/Mar/15 9:05 AM ]

Confirmed fixed in master.





[CLJS-1152] (require 'some.ns :reload) causes printing to stop working in browser REPL Created: 19/Mar/15  Updated: 21/Mar/15  Resolved: 21/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3126
Fix Version/s: Next

Type: Defect Priority: Blocker
Reporter: David Nolen Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None


 Comments   
Comment by David Nolen [ 20/Mar/15 9:06 AM ]

This root cause is that the compiled browser repl JavaScript also gets reloaded. This occurs because we do not have real require and instead use the ns form to simulate it. What happens is that we emit a new ns form with whatever requires were previously present, the new ones, and add :reload or :reload-all. However this will affect all the namespaces instead of only the ones specified by require. Because of auto-building changing the semantics is likely to be surprising for compilation, however aligning the semantics when at the REPL should be fine.

In order to avoid churn on master while we wait for an enhanced Piggieback release we should try to implement the solution in the least invasive as possible way.

Comment by David Nolen [ 21/Mar/15 10:14 AM ]

Reloading is a transient thing so doing this via metadata is probably not a good idea. Probably the simplest thing to do is to always have REPL require reshape the specs into vectors and add metadata to the vector so that analyzer parse 'ns can extract and leverage this information without polluting the persistent compiler environment.

Comment by David Nolen [ 21/Mar/15 8:09 PM ]

fixed https://github.com/clojure/clojurescript/commit/bd392de1842949ad07076f9484c069a1b5ebb294





[CLJS-1157] Stacktrace unmunging will blindly use local symbols Created: 21/Mar/15  Updated: 21/Mar/15  Resolved: 21/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: Next
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Mike Fikes Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File CLJS-1157-2.patch     Text File CLJS-1157.patch    

 Description   

With CLJS-1154, the symbol used to call a function is extracted from source maps to use in lieu of a munged name. This leads to undesirable results if the symbol is simply a local.

For example, notice the use of f in call-me:

(ns foo.bar)

(defn this-throws []
  (ffirst 1))

(defn call-me [f]
  (f))

(defn tricky []
  (call-me this-throws))

Where previously we would get:

ClojureScript:cljs.user> (foo.bar/tricky)
Error: 1 is not ISeqable
	 cljs$core$seq (.../cljs/core.cljs:951:13)
	 cljs$core$first (.../cljs/core.cljs:960:7)
	 cljs$core$ffirst (.../cljs/core.cljs:1393:3)
	 foo$bar$this_throws (.../foo/bar.cljs:4:3)
	 foo$bar$call_me (.../foo/bar.cljs:7:3)
	 foo$bar$tricky (.../foo/bar.cljs:10:3)
	 (NO_SOURCE_FILE)

we now get:

ClojureScript:cljs.user> (foo.bar/tricky)
Error: 1 is not ISeqable
	 cljs.core/seq (.../cljs/core.cljs:951:20)
	 cljs.core/first (.../cljs/core.cljs:960:16)
	 cljs.core/ffirst (.../cljs/core.cljs:1393:11)
	 f (.../foo/bar.cljs:4:4)
	 foo.bar/call-me (.../foo/bar.cljs:7:4)
	 foo$bar$tricky (.../foo/bar.cljs:10:4)
	 (NO_SOURCE_FILE)


 Comments   
Comment by Mike Fikes [ 21/Mar/15 10:36 AM ]

The attached patch takes a strategy of only replacing munged names if we can munge back to them.

It is a little more complicated in trying to deal with the possibility that, instead of a clean name like call-me, we had call-me$', in which case the unmanaged name would be used.

Below is what the patch would produce with the additional change call-me -> call-me$'. It successfully prevents replacing foo$bar$this_throws with the local symbol f.

ClojureScript:cljs.user> (foo.bar/tricky)
Error: 1 is not ISeqable
	 cljs.core/seq (.../cljs/core.cljs:951:20)
	 cljs.core/first (.../cljs/core.cljs:960:16)
	 cljs.core/ffirst (.../cljs/core.cljs:1393:11)
	 foo$bar$this_throws (.../foo/bar.cljs:4:4)
	 foo.bar/call-me$' (.../foo/bar.cljs:7:4)
	 foo$bar$tricky (.../foo/bar.cljs:10:4)
	 (NO_SOURCE_FILE)
Comment by Mike Fikes [ 21/Mar/15 1:23 PM ]

Attaching a simpler patch that doesn't try to look for $ in unmunaged name. It does't appear to be necessary and, makes things more complex, and would cause a local symbol with a name like f$ to appear in the trace.

Comment by David Nolen [ 21/Mar/15 2:03 PM ]

fixed https://github.com/clojure/clojurescript/commit/ddede7552814b09e0ca8c74943cd1ec9d2b54940





[CLJS-1154] When source-mapping stacktraces, obtain unmunged function names from source map Created: 20/Mar/15  Updated: 21/Mar/15  Resolved: 21/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3126
Fix Version/s: Next

Type: Enhancement Priority: Blocker
Reporter: Mike Fikes Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None
Environment:

All except for, say Node.js, where source mapping is done by the engine


Attachments: Text File CLJS-1154.patch    

 Description   

With CLJS-937 function symbols in stacktraces ended up being munged (for example cljs.core/first appears as cljs$core$first).

The symbol used when making calls is available in source maps (it is the :name element when read in), and it is possible to use this info to improve the stacktraces by using that symbol where possible (which appears to always be possible except for the top-most element in the trace, where the call site info is not there).



 Comments   
Comment by David Nolen [ 21/Mar/15 7:54 AM ]

fixed https://github.com/clojure/clojurescript/commit/e3169592656343cdb77db572a6bee0af2af903a5





Generated at Sat Mar 28 04:29:50 CDT 2015 using JIRA 4.4#649-r158309.