<< Back to previous view

[CLJS-1286] REPL environment should be able to provide advice if source mapping fails Created: 23/May/15  Updated: 23/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

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


 Description   

For example browser REPL will often need users to supply :host-port, :host, and :asset-path in order to correctly parse files from stacktraces.






[CLJS-1285] load-file regression Created: 23/May/15  Updated: 23/May/15  Resolved: 23/May/15

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

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


 Description   

We need to make load-file more robust. Currently we don't properly check goog.dependencies.written_ for the sourcePath, we always delete the basePath + source path.



 Comments   
Comment by David Nolen [ 23/May/15 5:12 PM ]

fixed https://github.com/clojure/clojurescript/commit/22ba5a6d0b780183d21bd69a64492e2216a7b379





[CLJS-1284] IndexedSeq -seq implementation incorrect for i >= alength internal array Created: 23/May/15  Updated: 23/May/15  Resolved: 23/May/15

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

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

ClojureScript 0.0-3291



 Description   
(defn foo-ok
  ([x0 & xs] [x0 xs]))

(defn foo-fail
  ([] nil)
  ([x0 & xs] [x0 xs]))


(foo-ok 0) => [0 nil]     ;; OK
(foo-ok 0 1) => [0 (1)]   ;; OK

(foo-fail) => nil         ;; OK
(foo-fail 0) => [0 (nil)] ;; INCORRECT
(foo-fail 0 1) => [0 (1)] ;; OK


 Comments   
Comment by David Nolen [ 23/May/15 1:53 PM ]

This is a bug with IndexedSeq, not fn arities.

Comment by David Nolen [ 23/May/15 2:10 PM ]

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

Comment by David Nolen [ 23/May/15 2:15 PM ]

I cut a 0.0-3297 interim release with this fix.

Comment by Daniel Skarda [ 23/May/15 5:33 PM ]

David, thank you for very fast analysis, fix and release!





[CLJS-1283] (long \7) produces different result on Clojure/ClojureScript Created: 22/May/15  Updated: 22/May/15

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

Type: Defect Priority: Minor
Reporter: Sean Corfield Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

In Clojure (long \7) produces 55 which is the ASCII code value for the character 7.

In ClojureScript, it seems this just converts the single character string "7" to a number and you get 7 as the answer. This might make writing portable string manipulation code rather hazardous?

(reported by irctc_ on IRC)



 Comments   
Comment by David Nolen [ 22/May/15 11:23 PM ]

Coercions like long only exist to simplify porting code. In general such things should be replaced.





[CLJS-1282] Add a :pprint option to the default reporter in cljs.test Created: 22/May/15  Updated: 22/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Sebastian Bensusan Assignee: Sebastian Bensusan
Resolution: Unresolved Votes: 0
Labels: test


 Description   

Now that cljs.pprint has landed, cljs.test could report failures and exceptions with it. The exact API is TBD.






[CLJS-1281] preserve test order Created: 21/May/15  Updated: 22/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

Type: Enhancement Priority: Minor
Reporter: David Nolen Assignee: Sebastian Bensusan
Resolution: Unresolved Votes: 0
Labels: newbie


 Description   

We can keep tests sorted by :line var meta information.






[CLJS-1280] double analysis warnings when using cljs.repl/load-file special fn Created: 21/May/15  Updated: 21/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

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





[CLJS-1279] Node.js REPL does not flush process out and err immediately Created: 20/May/15  Updated: 20/May/15  Resolved: 20/May/15

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

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


 Comments   
Comment by David Nolen [ 20/May/15 2:49 PM ]

fixed https://github.com/clojure/clojurescript/commit/03529c47f9c38f3923a827166699f511f5ec0356





[CLJS-1278] Asserts still fail while :require-ing .js file (either in :libs or in :source-paths) (same as CLJS-1196) Created: 20/May/15  Updated: 22/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Michal Till Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Text File cljs_1278.patch    

 Description   

Following on CLJS-1196, I can't get it to work.

In version 0.0-3264 lein-cljsbuild crashed on weird eception `Caused by: java.lang.IllegalArgumentException: No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil"` but the current version 0.0-3269 gives the same failed assertion as previously.

I've put up a sample project to illustrate the issue.

Steps to reproduce:

`git clone https://github.com/tillda/stackone`
`cd stackone`
`git checkout 537e5c69b844bc53c159e85cafc24310543cc918`
`lein clean && lein cljsbuild once temp`

Expected behaviour: cljs compiled successfully with src/vendor/client/closure.js and env/stackone/helpersjs.js being included.

Actual behaviour:

```
Compiling "resources/public/lein-cljsbuild-temp/dev-mode-deps.js" failed.
Exception in thread "main" java.lang.AssertionError: Assert failed: (or (file? x) (url? x) (string? x)), compiling/private/var/folders/ym/l2qxd7l97kzfzftrdpqsclm40000gn/T/form-init3642888309490821030.clj:1:125)
at clojure.lang.Compiler.load(Compiler.java:7249)
at clojure.lang.Compiler.loadFile(Compiler.java:7175)
at clojure.main$load_script.invoke(main.clj:275)
at clojure.main$init_opt.invoke(main.clj:280)
at clojure.main$initialize.invoke(main.clj:308)
at clojure.main$null_opt.invoke(main.clj:343)
at clojure.main$main.doInvoke(main.clj:421)
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.AssertionError: Assert failed: (or (file? x) (url? x) (string? x))
at cljs.util$ext.invoke(util.cljc:115)
at cljs.closure$source_on_disk.invoke(closure.clj:1206)
at cljs.closure$output_unoptimized$fn__3708.invoke(closure.clj:1235)
at clojure.core$map$fn__4551.invoke(core.clj:2622)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.RT.seq(RT.java:507)
at clojure.core$seq__4126.invoke(core.clj:135)
at clojure.core$filter$fn__4578.invoke(core.clj:2677)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.RT.seq(RT.java:507)
at clojure.core$seq__4126.invoke(core.clj:135)
at clojure.core$map$fn__4551.invoke(core.clj:2614)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.Cons.next(Cons.java:39)
at clojure.lang.RT.next(RT.java:674)
at clojure.core$next__4110.invoke(core.clj:64)
at clojure.core$str$fn__4186.invoke(core.clj:528)
at clojure.core$str.doInvoke(core.clj:526)
at clojure.lang.RestFn.applyTo(RestFn.java:139)
at clojure.core$apply.invoke(core.clj:628)
at cljs.closure$deps_file.invoke(closure.clj:1040)
at cljs.closure$output_deps_file.invoke(closure.clj:1060)
at cljs.closure$output_unoptimized.doInvoke(closure.clj:1243)
at clojure.lang.RestFn.applyTo(RestFn.java:139)
at clojure.core$apply.invoke(core.clj:630)
at cljs.closure$build.invoke(closure.clj:1514)
at cljs.closure$build.invoke(closure.clj:1426)
at cljsbuild.compiler$compile_cljs$fn__3884.invoke(compiler.clj:81)
at cljsbuild.compiler$compile_cljs.invoke(compiler.clj:80)
at cljsbuild.compiler$run_compiler.invoke(compiler.clj:187)
at user$eval4018$iter_40544058$fn4059$fn_4077.invoke(form-init3642888309490821030.clj:1)
at user$eval4018$iter_40544058$fn_4059.invoke(form-init3642888309490821030.clj:1)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.RT.seq(RT.java:507)
at clojure.core$seq__4126.invoke(core.clj:135)
at clojure.core$dorun.invoke(core.clj:3007)
at clojure.core$doall.invoke(core.clj:3023)
at user$eval4018.invoke(form-init3642888309490821030.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6792)
at clojure.lang.Compiler.eval(Compiler.java:6782)
at clojure.lang.Compiler.load(Compiler.java:7237)
... 11 more
Subprocess failed
```



 Comments   
Comment by David Nolen [ 20/May/15 10:21 AM ]

This issue is in danger of being closed. Please supply minimal steps to reproduce that do not involve anything other than the ClojureScript compiler. We no longer have time to wade through the indirection introduced by cljsbuild or any other downstream tooling. Thanks.

Comment by Michal Till [ 20/May/15 11:14 AM ]

@David Nolen: I have created a failing minimal testcase based on the Quick Start document. Here it is: https://github.com/tillda/cljs-testcase/

Comment by David Nolen [ 20/May/15 11:27 AM ]

Michal the failing example is not correct. You are not supplying any :libs option.

Comment by Michal Till [ 20/May/15 11:45 AM ]

Ah! Thank you very much! This additional issue was therefore my error. Now it seems to work even in my "big" example.

However it would be cool if there was a meaningful error message stating that a file path can't be resolved. If one is not an expert in the cljs compiler this is almost impossible to figure out. After all the error message in the CLJS-1196 issue and in this wrongfully reported one are exactly the same.

You may close this issue.

Comment by David Nolen [ 20/May/15 11:55 AM ]

We'll leave it open for the improving the error message.

Comment by Sebastian Bensusan [ 22/May/15 7:16 AM ]

Added the check in cljs.closure/source-on-disk where there is info for the error message.

For the supplied case, the error message is:

java.lang.IllegalArgumentException: The file file:/home/carlos/Playground/cljs-testcase/src/hello_world/closure.js 
lacks an associated source file. If it is a JavaScript library please add it to :libs}}

If a different wording or location of the check is needed, I'll submit a new patch with corrections.

Notes:

  • Changed:(:provides js) to (-provides js) in order to be consistent with IJavaScript.
  • cljs.clojure/source-on-disk takes a js argument that should satisfy with IJavaScript and ISourceMap if :source-map is enabled but the implementation is hardcoded to maps because :source-map and :source-url are used instead of ISourceMap methods -source-map and -source-url. I propose to extend PersistentMap and PersistentArrayMap to ISourceMap to make source-on-disk compliant with both protocols.




[CLJS-1277] relax requirement that files must declare a namespace, default to cljs.user Created: 19/May/15  Updated: 19/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

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


 Description   

This aligns better with Clojure itself supports.






[CLJS-1276] var equality differs from Clojure Created: 18/May/15  Updated: 18/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

Type: Defect Priority: Minor
Reporter: David Nolen Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

(= #'x #'x) and (identical? #'x #'x) both fail. One solution would be to implement IEquiv and add var-identical? a la keyword-identical?.






[CLJS-1275] lein test configuration is broken Created: 18/May/15  Updated: 18/May/15  Resolved: 18/May/15

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

Type: Defect Priority: Major
Reporter: Sebastian Bensusan Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File cljs_1275.patch    

 Description   

When running lein test on a fresh copy of master it fails to find the tests. The :test-paths in project.clj is pointing to an old location.



 Comments   
Comment by Sebastian Bensusan [ 18/May/15 7:35 AM ]

This patch redirects :test-paths to the current directory of the tests: src/test/clojure.

Comment by David Nolen [ 18/May/15 8:39 AM ]

fixed https://github.com/clojure/clojurescript/commit/08398b25400b363ca22db885b7ed2460c92bd5fa





[CLJS-1274] Allow assignment to namespace-qualified names in current namespace Created: 17/May/15  Updated: 17/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3211
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: lvh Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

In Clojure, you can def to a namespace-qualified name as long as it's in the current namespace. You can't do that in Clojurescript. This makes writing some macros that def to a local name a bit more annoying, since the syntax-quote will automatically namespace-qualify any symbols, so you have to write the somewhat unsightly and not super obvious ~'sym.






[CLJS-1273] clojure.lang.Symbol cannot be cast to clojure.lang.Namespace on macro expansion Created: 17/May/15  Updated: 17/May/15  Resolved: 17/May/15

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

Type: Defect Priority: Major
Reporter: lvh Assignee: Unassigned
Resolution: Not Reproducible Votes: 0
Labels: None


 Description   

Following macro & macro call:

{{
(defmacro defroutes
[routes]
(let [route-defs (for [{:keys [path view]} routes]
`(secretary/defroute ~path []
(session/put! :current-page ~view)))]
`(do (def ~'routes ~routes) ~@route-defs)))

(defroutes
[{:name "Home"
:path "/"
:view #'home-page}
{:name "Foo bar"
:path "/foo-bar"
:view #'foo-bar-page}
{:name "Baz quux"
:path "/baz-quux"
:view #'baz-quux-page}])
}}

... results in following compile-time exception:

{{
clojure.lang.ExceptionInfo : failed compiling file:src/cljs/shrieker/core.cljs
clojure.lang.ExceptionInfo : clojure.lang.Symbol cannot be cast to clojure.lang.Namespace
java.lang.ClassCastException : clojure.lang.Symbol cannot be cast to clojure.lang.Namespace
Error on file /Users/lvh/Projects/rackspace/shrieker/src/cljs/shrieker/core.cljs, line 106, column 60
}}

I believe this to be a bug, because replacing that macro call with its expansion works fine:

{{
(do
(def routes
[{:name "Home"
:path "/"
:view #'home-page}
{:name "Foo bar"
:path "/foo-bar"
:view #'foo-bar-page}
{:name "baz quux"
:path "/baz-quux"
:view #'baz-quux-page}])
(secretary/defroute "/" []
(session/put! :current-page #'home-page))
(secretary/defroute "/foo-bar" []
(session/put! :current-page #'foo-bar-page))
(secretary/defroute "/endpoint-quux" []
(session/put! :current-page #'baz-quux-page)))
}}

I was unable to repeat the experiment on more recent Clojurescripts, as some of my dependencies don't quite agree with it.



 Comments   
Comment by lvh [ 17/May/15 7:14 PM ]

JIRA doesn't appear to like my markup. Sorry about that

Comment by David Nolen [ 17/May/15 10:59 PM ]

You need to verify that this affects a released version of ClojureScript in a reproducible way (minimal case). Thanks.





[CLJS-1272] :include-macros description inaccurate in require Created: 17/May/15  Updated: 17/May/15  Resolved: 17/May/15

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

Type: Defect Priority: Minor
Reporter: Mike Fikes Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: docstring

Attachments: Text File CLJS-1272.patch    

 Description   

The description for :include-macros in the docstring for require indicates

:include-macros takes a list of macro symbols to refer from the namespace.

when really the spec only takes true as an argument, where the semantics are "causes macros to be required"



 Comments   
Comment by David Nolen [ 17/May/15 6:46 PM ]

fixed https://github.com/clojure/clojurescript/commit/721ba892892d7aa000460c45a6eb1afecd33eff5





[CLJS-1271] Defining a variable with the same name as an imported object compiles without errors Created: 17/May/15  Updated: 17/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Sebastian Bensusan Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Importing a Google Closure ns and defining a variable with the same name compiles without exception, while in Clojure it throws an Exception with "Expecting var, but #VarName is mapped to class some.java.class".

Minimal sample:

(ns import-names.core
  (:import [goog debug]))

(def debug goog.debug)





[CLJS-1270] Docstring for delay not printed by cljs.repl/doc Created: 16/May/15  Updated: 17/May/15  Resolved: 17/May/15

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

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

Attachments: Text File CLJS-1270.patch    

 Description   
cljs.user=> (doc delay)
-------------------------
cljs.core/delay
([& body])
Macro
  nil

nil
cljs.user=> (source delay)
(defmacro delay [& body]
  "Takes a body of expressions and yields a Delay object that will
  invoke the body only the first time it is forced (with force or deref/@), and
  will cache the result and return it on all subsequent force
  calls."
  `(new cljs.core/Delay (fn [] ~@body) nil))
nil


 Comments   
Comment by Mike Fikes [ 16/May/15 8:12 PM ]

Attached CLJS-1270.patch

Comment by David Nolen [ 17/May/15 10:28 AM ]

fixed https://github.com/clojure/clojurescript/commit/264eb2b5153d6d1c3b6fcf0a42aad31956297cc5





[CLJS-1269] realized? docstring refers to promise and future Created: 16/May/15  Updated: 17/May/15  Resolved: 17/May/15

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

Type: Defect Priority: Trivial
Reporter: Mike Fikes Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: docstring

Attachments: Text File CLJS-1269.patch    

 Description   

The docstring for realized? refers to nonexistent promise and future.

Likely copied over verbatim from Clojure:

cljs.user=> (doc realized?)
-------------------------
cljs.core/realized?
([d])
  Returns true if a value has been produced for a promise, delay, future or lazy sequence.

nil


 Comments   
Comment by Mike Fikes [ 16/May/15 7:57 PM ]

Added CLJS-1269.patch

Comment by David Nolen [ 17/May/15 10:27 AM ]

fixed https://github.com/clojure/clojurescript/commit/27ad78bb3f7fdfe64b4041bf60532489c2847105





[CLJS-1268] cljc support for cljs.closure/compile-file Created: 13/May/15  Updated: 14/May/15  Resolved: 14/May/15

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

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


 Description   

When calling cljs.closure/compile-file on a cljc file I get

ExceptionInfo Conditional read not allowed {:type :reader-exception, :line 5, :column 5, :file nil}
clojure.core/ex-info (core.clj:4591)
clojure.tools.reader/read* (reader.clj:896)
clojure.tools.reader/read-delimited (reader.clj:189)
clojure.tools.reader/read-list (reader.clj:202)
clojure.tools.reader/read* (reader.clj:878)
clojure.tools.reader/read (reader.clj:927)
cljs.analyzer/forms-seq*/forms-seq--124424/fn124425/fn-124426 (analyzer.cljc:24)
cljs.analyzer/forms-seq*/forms-seq--124424/fn-124425 (analyzer.cljc:18)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:49)
clojure.lang.Cons.next (Cons.java:39)
clojure.lang.RT.next (RT.java:674)
clojure.core/next--4109 (core.clj:64)
cljs.closure/compile-form-seq/fn-7854/fn-7855 (closure.clj:341)
cljs.closure/compile-form-seq/fn--7854 (closure.clj:340)
cljs.compiler/with-core-cljs (compiler.cljc:968)
cljs.closure/compile-form-seq (closure.clj:337)
cljs.closure/compile-file (closure.clj:376)

The issue is that forms-seq* is already called with a reader and the cljc check in there is not getting a file. Checking for ana/cljs-file is probably a solution.



 Comments   
Comment by David Nolen [ 14/May/15 9:36 PM ]

fixed https://github.com/clojure/clojurescript/commit/98ed0f4a08dfe757b7c647dbce22e235ef45b0a3





[CLJS-1267] New :end-run-tests event not present in all public cljs.test functions Created: 13/May/15  Updated: 17/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Sebastian Bensusan Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Text File cljs_1267.patch    

 Description   

After CLJS-1226, cljs.test API is inconsistent since only one of its public functions (run-tests) emits the new :end-run-tests event. The event should be added to test-all-vars, test-ns, test-var, and test-vars, making sure it is only fired once.



 Comments   
Comment by Leon Grapenthin [ 13/May/15 3:13 AM ]

To my knowledge all four are not reused within cljs.test, only the -block versions are, so there should be no worries about the event fired twice.

Comment by Sebastian Bensusan [ 17/May/15 12:37 PM ]

The patch includes the :end-run-tests event to test-ns, test-all-vars, test-vars, and test-var. I didn't add the event to the block functions since those can be reused and composed.

Notes:

  • If any of those functions are used sequentially in a script the event will be fired multiple times.
  • On each function the map passed to cljs.test/report contains different information besides {:type :end-run-tests}. test-var passes :var, test-vars passes :vars, test-ns and test-all-vars pass :ns.




[CLJS-1266] Node: Rename .cljs to .cljc -> old filenames in stacktrace Created: 12/May/15  Updated: 12/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Mike Fikes Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Using QuickStart, set up Node REPL.

Manually add a foo/bar.cljs to filesystem with

(ns foo.bar)

(defn throw-ex [] (ffirst 1))

(defn call-me [] (throw-ex))

Check that it works:

cljs.user=> (require 'foo.bar)
nil
cljs.user=> (foo.bar/call-me)
repl:13
throw e__4210__auto__;
      ^
Error: 1 is not ISeqable
    at Object.cljs$core$seq [as seq] (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:956:20)
    at Object.cljs$core$first [as first] (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:965:16)
    at cljs$core$ffirst (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:1398:11)
    at foo$bar$throw_ex (/Users/mfikes/Desktop/hello_world-node/out/foo/bar.cljs:3:20)
    at foo$bar$call_me (/Users/mfikes/Desktop/hello_world-node/out/foo/bar.cljs:5:19)
    at repl:1:105
    at repl:9:3
    at repl:14:4
    at Object.exports.runInThisContext (vm.js:74:17)
    at Domain.<anonymous> ([stdin]:41:34)

Then manually move bar.cljs to bar.cljc and add a new symbol so it looks like:

(ns foo.bar)

(defn throw-ex [] (ffirst 1))

(defn call-me [] (throw-ex))

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

Then reload the ns and use the new symbol:

cljs.user=> (require 'foo.bar :reload)
nil
cljs.user=> (foo.bar/call-again)
repl:13
throw e__4210__auto__;
      ^
Error: 1 is not ISeqable
    at Object.cljs$core$seq [as seq] (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:956:20)
    at Object.cljs$core$first [as first] (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:965:16)
    at cljs$core$ffirst (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:1398:11)
    at foo$bar$throw_ex (/Users/mfikes/Desktop/hello_world-node/out/foo/bar.cljs:3:20)
    at foo$bar$call_me (/Users/mfikes/Desktop/hello_world-node/out/foo/bar.cljs:5:19)
    at foo$bar$call_again (/Users/mfikes/Desktop/hello_world-node/out/foo/bar.cljs:5:19)
    at repl:1:108
    at repl:9:3
    at repl:14:4
    at Object.exports.runInThisContext (vm.js:74:17)

This illustrates the defect. call_again and the other symbols are shown as being in the old filename.

Stop the REPL and restart it to see correct behavior:

cljs.user=> :cljs/quit
orion:hello_world-node mfikes$ rlwrap java -cp cljs.jar:src clojure.main node_repl.clj
Reading analysis cache for jar:file:/Users/mfikes/Desktop/hello_world-node/cljs.jar!/cljs/core.cljs
Compiling src/foo/bar.cljc
ClojureScript Node.js REPL server listening on 49397
Watch compilation log available at: out/watch.log
To quit, type: :cljs/quit
cljs.user=> (require 'foo.bar)
nil
cljs.user=> (foo.bar/call-again)
repl:13
throw e__4210__auto__;
      ^
Error: 1 is not ISeqable
    at Object.cljs$core$seq [as seq] (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:956:20)
    at Object.cljs$core$first [as first] (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:965:16)
    at cljs$core$ffirst (/Users/mfikes/Desktop/hello_world-node/out/cljs/core.cljs:1398:11)
    at foo$bar$throw_ex (/Users/mfikes/Desktop/hello_world-node/out/foo/bar.cljc:3:20)
    at foo$bar$call_me (/Users/mfikes/Desktop/hello_world-node/out/foo/bar.cljc:5:19)
    at foo$bar$call_again (/Users/mfikes/Desktop/hello_world-node/out/foo/bar.cljc:7:22)
    at repl:1:108
    at repl:9:3
    at repl:14:4
    at Object.exports.runInThisContext (vm.js:74:17)


 Comments   
Comment by Mike Fikes [ 12/May/15 2:04 PM ]

FWIW as a comparison, the same use case works properly with Clojure 1.7.0-beta2.





[CLJS-1265] Rename from .cljs to .cljc results in :reload failing Created: 12/May/15  Updated: 12/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Mike Fikes Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Set up QuickStart browser REPL.

1. On disk, create a new file in src, say foo/bar.cljs and define a symbol in it.
2. In the REPL (require 'foo.bar) and then make use of the symbol.
3. On disk, rename the file to bar.cljc, and then edit the file to introduce a new symbol.
4. In the REPL (require 'foo.bar :reload) and then try to make use of the new symbol.

For a function defnition, at this point I get an error

TypeError: undefined is not an object (evaluating 'foo.bar.call_me.call')


 Comments   
Comment by Mike Fikes [ 12/May/15 2:05 PM ]

FWIW as a comparison, the same use case works properly with Clojure 1.7.0-beta2 (in regular lein repl).





[CLJS-1264] ClojureScript 0.0-3255 breaks compatibility with Clojure 1.6.0 Created: 11/May/15  Updated: 12/May/15  Resolved: 12/May/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3255, 0.0-3269
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Stephen Nelson Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: None


 Description   

ClojureScript 0.0-3255 renamed several core files from clj to cljc. This breaks compatibility with Clojure 1.6.0, which is significant because Clojure 1.7.0 hasn't been released yet. This change forces any projects that bundle ClojureScript to switch to an unreleased Clojure or fall behind ClojureScript.

Falling behind ClojureScript is a significant problem as most development tools and libraries follow CLJS head, so a project that uses an old CLJS must use old libraries and build tools too, or maintain forks for pulling in bug fixes.

It would be good if this change could be reverted until CLJ 1.7 lands. If this is not possible, please consider maintaining a CLJ 1.6 branch and back porting bug fixes.



 Comments   
Comment by David Nolen [ 12/May/15 3:08 PM ]

There are stable releases of ClojureScript that work with Clojure 1.6.0. Use them if you need to. We're not going to maintain a 1.6.0 branch.





[CLJS-1263] :libs regression, can no longer specify specific files Created: 11/May/15  Updated: 11/May/15  Resolved: 11/May/15

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

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


 Description   

:libs currently works great for directories but the support for individual files specified by the user is broken.



 Comments   
Comment by David Nolen [ 11/May/15 3:43 PM ]

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





[CLJS-1262] Write to compiler out before :merge-opts Created: 10/May/15  Updated: 19/May/15  Resolved: 19/May/15

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

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


 Description   

cljs.repl/repl* supports a :merge-opts, allowing derived REPLs, for example to specify :output-dir as a result of -setup.

A recent change in with_core_cljs appears to cause output to be (prematurely) written to the default :output-dir of "out": The call to -setup is wrapped with this macro.

This did not appear to occur with previous releases (I checked the last release of ClojureScript that was still on Clojure 1.6.0, but I haven't bisected to pinpoint the change.)

I haven't yet produced a minimal reproduction. (I will try to do so with QuickStart and add a comment).

I produced this with Ambly by manually creating an empty "out", and chmod a-w on it so that it can't be written in, and then when starting Ambly, I get a trace provoking the problem, showing where the write occurs:

$ script/repl
Exception in thread "main" java.io.FileNotFoundException: out/cljs/core.cljs.cache.edn (No such file or directory), compiling:(/private/var/folders/pd/w1724j050nd445hpm7mwlxs80000gn/T/form-init5299557692903408511.clj:1:125)
	at clojure.lang.Compiler.load(Compiler.java:7249)
	at clojure.lang.Compiler.loadFile(Compiler.java:7175)
	at clojure.main$load_script.invoke(main.clj:275)
	at clojure.main$init_opt.invoke(main.clj:280)
	at clojure.main$initialize.invoke(main.clj:308)
	at clojure.main$null_opt.invoke(main.clj:343)
	at clojure.main$main.doInvoke(main.clj:421)
	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.io.FileNotFoundException: out/cljs/core.cljs.cache.edn (No such file or directory)
	at java.io.FileOutputStream.open0(Native Method)
	at java.io.FileOutputStream.open(FileOutputStream.java:270)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
	at clojure.java.io$fn__9185.invoke(io.clj:230)
	at clojure.java.io$fn__9122$G__9091__9129.invoke(io.clj:69)
	at clojure.java.io$fn__9159.invoke(io.clj:166)
	at clojure.java.io$fn__9135$G__9087__9142.invoke(io.clj:69)
	at clojure.java.io$writer.doInvoke(io.clj:119)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at clojure.lang.AFn.applyToHelper(AFn.java:154)
	at clojure.lang.RestFn.applyTo(RestFn.java:132)
	at clojure.core$apply.invoke(core.clj:630)
	at clojure.core$spit.doInvoke(core.clj:6662)
	at clojure.lang.RestFn.invoke(RestFn.java:425)
	at cljs.analyzer$write_analysis_cache.invoke(analyzer.cljc:2186)
	at cljs.analyzer$analyze_file.invoke(analyzer.cljc:2237)
	at cljs.compiler$with_core_cljs.invoke(compiler.cljc:967)
	at cljs.repl$repl_STAR_.invoke(repl.cljc:779)
	at cljs.repl$repl.doInvoke(repl.cljc:929)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at user$eval4493.invoke(form-init5299557692903408511.clj:3)
	at clojure.lang.Compiler.eval(Compiler.java:6792)
	at clojure.lang.Compiler.eval(Compiler.java:6755)
	at clojure.core$eval.invoke(core.clj:3079)
	at clojure.main$eval_opt.invoke(main.clj:289)
	at clojure.main$initialize.invoke(main.clj:308)
	at clojure.main$null_opt.invoke(main.clj:343)
	at clojure.main$main.doInvoke(main.clj:421)
	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:497)
	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:497)
	at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
	at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:207)
	at user$eval5.invoke(form-init5299557692903408511.clj:1)
	at clojure.lang.Compiler.eval(Compiler.java:6792)
	at clojure.lang.Compiler.eval(Compiler.java:6782)
	at clojure.lang.Compiler.load(Compiler.java:7237)
	... 11 more


 Comments   
Comment by Mike Fikes [ 10/May/15 9:54 AM ]

Reproduction with lein:

project.clj:

(defproject foo "0.1.0"
  :dependencies [[org.clojure/clojure "1.7.0-beta2"]
                 [org.clojure/clojurescript "0.0-3255"]])

Make out not writable. (chmod a-w out). Or, alternatively, just look for the presence of out on filesystem alongside abc.

In any case, if you don't make out not writable, then this minimal repo will subsequently fail with an unrelated java.lang.IllegalArgumentException: No matching clause: as it is simply trying to exhibit the problem with out.

lein repl

Then execute these forms:

(require 'cljs.repl)

(defrecord FooEnv []
    cljs.repl/IJavaScriptEnv
  (-setup [repl-env opts]
    {:merge-opts {:output-dir "abc"}})
  (-evaluate [_ _ _ _])
  (-load [_ _ _])
  (-tear-down [_]))

(defn repl-env 
  [& {:as options}]
  (FooEnv.))

(cljs.repl/repl (repl-env))

With this older version, the out directory is not created:

(defproject foo "0.1.0"
  :dependencies [[org.clojure/clojure "1.7.0-beta1"]
                 [org.clojure/clojurescript "0.0-3196"]])
Comment by David Nolen [ 10/May/15 10:17 AM ]

Right the problem is that with-core-cljs calls analyze-file which will attempt to write the analysis cache. It's just a matter of considering the best way to avoid this.

Comment by Mike Fikes [ 18/May/15 9:27 PM ]

No longer occurs with 0.0-3269 and was fixed with this commit: https://github.com/clojure/clojurescript/commit/07bb585b181c02b3c33c7d88c46ddb888279b07f





[CLJS-1261] source fn fails for fns with conditional code Created: 09/May/15  Updated: 10/May/15  Resolved: 10/May/15

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

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

(Affects 0.0-3264)



 Description   

If you use the source ClojureScript REPL function on a function defined in a CLJC file, where the function itself contains some conditional code, then the operation will fail with "Conditional read not allowed".

To reproduce:
Set up the QuickStart Browser REPL example, but instead of core.cljs, set up a core.cljc file. In that file additionally include

(defn f 
  "Eff"
  [] 
  1)

(defn g 
  "Gee"
  []
  #?(:clj "clj" :cljs "cljs"))

Verify that you can call, get the doc for, and source for f.

But, on the other hand, while you can call and get the doc for g, you can't do (source hello-world.core/g).

This results in:

cljs.user=> (source hello-world.core/g)
clojure.lang.ExceptionInfo: Conditional read not allowed at line 1 <cljs repl> {:file "<cljs repl>", :line 1, :column 1, :tag :cljs/analysis-error}
	at clojure.core$ex_info.invoke(core.clj:4591)
	at cljs.analyzer$error.invoke(analyzer.cljc:384)
	at cljs.analyzer$macroexpand_1.invoke(analyzer.cljc:1853)
	at cljs.analyzer$analyze_seq.invoke(analyzer.cljc:1896)
	at cljs.analyzer$analyze$fn__1567.invoke(analyzer.cljc:1992)
	at cljs.analyzer$analyze.invoke(analyzer.cljc:1985)
	at cljs.repl$evaluate_form.invoke(repl.cljc:429)
	at cljs.repl$eval_cljs.invoke(repl.cljc:547)
	at cljs.repl$repl_STAR_$read_eval_print__4295.invoke(repl.cljc:814)
	at cljs.repl$repl_STAR_$fn__4301$fn__4308.invoke(repl.cljc:851)
	at cljs.repl$repl_STAR_$fn__4301.invoke(repl.cljc:850)
	at cljs.compiler$with_core_cljs.invoke(compiler.cljc:968)
	at cljs.repl$repl_STAR_.invoke(repl.cljc:816)
	at cljs.repl$repl.doInvoke(repl.cljc:932)
	at clojure.lang.RestFn.invoke(RestFn.java:439)
	at user$eval30.invoke(repl.clj:10)
	at clojure.lang.Compiler.eval(Compiler.java:6792)
	at clojure.lang.Compiler.load(Compiler.java:7237)
	at clojure.lang.Compiler.loadFile(Compiler.java:7175)
	at clojure.main$load_script.invoke(main.clj:275)
	at clojure.main$script_opt.invoke(main.clj:337)
	at clojure.main$main.doInvoke(main.clj:421)
	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)
Caused by: clojure.lang.ExceptionInfo: Conditional read not allowed {:type :reader-exception, :line 19, :column 5, :file nil}
	at clojure.core$ex_info.invoke(core.clj:4591)
	at clojure.tools.reader$read_STAR_.invoke(reader.clj:896)
	at clojure.tools.reader$read_delimited.invoke(reader.clj:189)
	at clojure.tools.reader$read_list.invoke(reader.clj:202)
	at clojure.tools.reader$read_STAR_$fn__767.invoke(reader.clj:878)
	at clojure.tools.reader.reader_types$log_source_STAR_$fn__501.invoke(reader_types.clj:240)
	at clojure.lang.AFn.applyToHelper(AFn.java:152)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invoke(core.clj:628)
	at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1866)
	at clojure.lang.RestFn.invoke(RestFn.java:425)
	at clojure.tools.reader.reader_types$log_source_STAR_.invoke(reader_types.clj:239)
	at clojure.tools.reader$read_STAR_.invoke(reader.clj:867)
	at clojure.tools.reader$read.invoke(reader.clj:928)
	at clojure.tools.reader$read.invoke(reader.clj:926)
	at cljs.repl$source_fn.invoke(repl.cljc:1133)
	at cljs.repl$source.invoke(repl.cljc:1153)
	at clojure.lang.AFn.applyToHelper(AFn.java:160)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.lang.AFunction$1.doInvoke(AFunction.java:29)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.core$apply.invoke(core.clj:632)
	at cljs.analyzer$macroexpand_1.invoke(analyzer.cljc:1859)
	... 24 more
Caused by: java.lang.RuntimeException: Conditional read not allowed
	at clojure.tools.reader$read_cond.invoke(reader.clj:490)
	at clojure.tools.reader$read_dispatch.invoke(reader.clj:66)
	at clojure.tools.reader$read_STAR_$fn__767.invoke(reader.clj:878)
	at clojure.tools.reader.reader_types$log_source_STAR_$fn__501.invoke(reader_types.clj:240)
	at clojure.lang.AFn.applyToHelper(AFn.java:152)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invoke(core.clj:628)
	at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1866)
	at clojure.lang.RestFn.invoke(RestFn.java:425)
	at clojure.tools.reader.reader_types$log_source_STAR_.invoke(reader_types.clj:239)
	at clojure.tools.reader$read_STAR_.invoke(reader.clj:867)
	... 45 more


 Comments   
Comment by David Nolen [ 10/May/15 2:21 PM ]

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

Comment by Mike Fikes [ 10/May/15 2:44 PM ]

Confirmed fixed.

Comment by Mike Fikes [ 10/May/15 2:53 PM ]

I created a similar ticket for Clojure: http://dev.clojure.org/jira/browse/CLJ-1728





[CLJS-1260] >= 0.0-3265 cannot compile Closure style libraries that conform to the classpath Created: 09/May/15  Updated: 09/May/15  Resolved: 09/May/15

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

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


 Comments   
Comment by David Nolen [ 09/May/15 3:48 PM ]

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





[CLJS-1259] Incorrect warnings on type hinted maths Created: 09/May/15  Updated: 09/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3255
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Erik Ouchterlony Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: bug, math, typehints


 Description   

Variables type hinted as int or double are not recognized as numbers, e.g.

(def ^int i 1)
(+ i i)
WARNING: cljs.core/+, all arguments must be numbers, got [int int] instead. at line 1 <cljs repl>
2





[CLJS-1258] stack trace mapping does not appear to work with :asset-path Created: 08/May/15  Updated: 09/May/15  Resolved: 09/May/15

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

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


 Description   

The path to JS files just seems wrong.



 Comments   
Comment by David Nolen [ 09/May/15 8:36 AM ]

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





[CLJS-1257] find-doc regression Created: 08/May/15  Updated: 08/May/15  Resolved: 08/May/15

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

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


 Description   

find-doc no longer works



 Comments   
Comment by David Nolen [ 08/May/15 6:44 PM ]

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





[CLJS-1256] cljs.core/UUID should cache hash value Created: 08/May/15  Updated: 12/May/15  Resolved: 12/May/15

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

Type: Enhancement Priority: Major
Reporter: Nikita Prokopov Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File cljs-1256-cache-uuid-hash-3.patch    

 Description   

cljs.core/UUID calculates hash each time hash is called on it. This patch adds caching of the calculated hash value. It also avoids going through pr-str for hash calculation which involves string concatenation and couple of object allocations.

Updated patch also introduces public constructor cljs.core/uuid for creating UUID objects. All places where UUID. ctor was used will now generate a warning.



 Comments   
Comment by David Nolen [ 10/May/15 2:42 PM ]

The patch needs work. Declare __hash as a ^:mutable field on UUID. Thanks.

Comment by Nikita Prokopov [ 10/May/15 2:53 PM ]

This was the first thing I tried. Unfortunately new field breaks all the places where UUID is constructed, including user code. Suggestions how to avoid that?

Comment by David Nolen [ 10/May/15 5:18 PM ]

Raw constructors are generally considered implementation details but sadly we never provided a public fn ctor in this case. There's not much to do other than supply a uuid fn. Any users directly using the deftype ctor will get warnings about invalid arity and they will have to fix their code and rely on the new uuid ctor fn.

Comment by Nikita Prokopov [ 11/May/15 5:00 AM ]

Attaching fixed path

Comment by David Nolen [ 12/May/15 3:07 PM ]

The patch does not apply cleanly on master. Can we get a rebased patch? Thanks!

Comment by Nikita Prokopov [ 12/May/15 3:35 PM ]

Rebased onto 31736450c6ca951c63bb685d744c11074fbfe323

Comment by David Nolen [ 12/May/15 4:27 PM ]

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





[CLJS-1255] cljs.test file-and-line detection is not useful in browser testing Created: 07/May/15  Updated: 07/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3211
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Stephen Nelson Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Chrome



 Description   

cljs.test reports using do-report, which adds file and line information computed from javascript stack traces. In chrome at least, these stack traces are not useful:

"Error
    at http://localhost:3449/js/cljs/test.js:261:69
    at cljs$test$do_report (http://localhost:3449/js/cljs/test.js:268:3)
    at http://localhost:3449/js/test/test_tests.js:491:21
    at test.test_tests.test_has_fails.cljs$lang$test (http://localhost:3449/js/test/test_tests.js:502:4)
    at http://localhost:3449/js/cljs/test.js:384:42
    at http://localhost:3449/js/cljs/test.js:387:4
    at cljs$test$run_block (http://localhost:3449/js/cljs/test.js:320:13)
    ..."

The `file-and-line` stack trace parser doesn't parse this correctly, resulting in a message like this:

FAIL in (test-function) (at http:384:42)

Note the lack of a useful file/namespace reference, and that the line number refers to the compiled javascript rather than the source clojurescript.



 Comments   
Comment by Stephen Nelson [ 07/May/15 9:15 PM ]

Prior to the release of cljs.test my company maintained an internal port of clojure.test that did better reporting than cljs.test's by adding source metadata from &form to the do-report calls generated by assert-expr. This approach was great for internal use but might not be suitable for cljs.test as it could reduce portability of assert-expr between clojure and clojurescript. Another approach could be dynamically bind source metadata in the body generated by try-expr. I'd be willing to implement and contribute code if you can provide some indication of your preferred approach.

Our version of assert-expr also injected a 'reporter function', {{(function(a,b,c){a.apply(b.c)})}}, which we would invoke from report, e.g. (reporter (.-debug js/console) js/console args). This causes the clickable link on the right hand side of chrome's console output to link to the source map location of the test expression, rather than the report function.





[CLJS-1254] Update REPL browser agent detection Created: 07/May/15  Updated: 08/May/15  Resolved: 08/May/15

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

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


 Description   

See CLJS-1252 & CLJS-1253, the current agent detection used Closure labs features which have now been moved into the standard library.



 Comments   
Comment by David Nolen [ 08/May/15 6:54 AM ]

fixed https://github.com/clojure/clojurescript/commit/77d9434d2bfb78c233911c624d544265bb7666d5





[CLJS-1253] Create new Closure Library Release Created: 07/May/15  Updated: 08/May/15  Resolved: 08/May/15

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

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


 Comments   
Comment by David Nolen [ 08/May/15 6:54 AM ]

fixed https://github.com/clojure/clojurescript/commit/77d9434d2bfb78c233911c624d544265bb7666d5





[CLJS-1252] Update Closure Compiler Dependency to v20150505 Created: 07/May/15  Updated: 07/May/15  Resolved: 07/May/15

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

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


 Comments   
Comment by David Nolen [ 07/May/15 4:12 PM ]

fixed https://github.com/clojure/clojurescript/commit/46ea0b9c2871532334c1007546191e1b4e60dc9f





[CLJS-1251] Missing semicolons when emitting deftype and defrecord Created: 07/May/15  Updated: 07/May/15

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

Type: Defect Priority: Trivial
Reporter: Antonin Hildebrand Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Text File cljs_1251.patch    

 Description   

Emitted code for deftype and defrecord has to separate the var assignment from body content by a semicolon (do not rely on automatic javascript semicolon insertion).

The bad case:
If body has the first statement wrapped in (...), javascript will treat it as a function call on the constructor definition.






[CLJS-1250] uberjar script broken wrt cljc Created: 06/May/15  Updated: 07/May/15  Resolved: 07/May/15

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

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

Attachments: Text File CLJS-1250.patch     Text File CLJS-1250_v2.patch    

 Description   
$ script/uberjar
++ git --no-replace-objects describe --match v0.0
+ REVISION=v0.0-3242-gab68ddc
+ REVISION=3242-gab68ddc
+ REVISION=3242
++ mktemp /tmp/compiler.clj.XXXXXXXXXXX
+ COMP_FILE=/tmp/compiler.clj.S998xXGTrCX
+ sed -e 's/^.def ^:dynamic \*clojurescript-version\*.*$/(def ^:dynamic *clojurescript-version* {:major 0, :minor 0, :qualifier 3242})/' src/clj/cljs/util.clj
sed: src/clj/cljs/util.clj: No such file or directory


 Comments   
Comment by Mike Fikes [ 06/May/15 9:40 PM ]

Oops, didn't mean to mess with whitespace outside of the intended change. Attaching a revision that doesn't do that.

Comment by David Nolen [ 07/May/15 7:53 AM ]

fixed https://github.com/clojure/clojurescript/commit/74c7eb24c99955203eec61d8d065087292c3f201





[CLJS-1249] cljs$lang$type gets removed during :advanced optimization, externs is not a solution Created: 06/May/15  Updated: 14/May/15  Resolved: 07/May/15

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

Type: Defect Priority: Minor
Reporter: Antonin Hildebrand Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: None

Attachments: Text File cljs_1249.patch    

 Description   

This is a follow up to https://github.com/swannodette/mori/issues/144.

The problem:
In advanced mode, Closure Compiler removes most (or all) cljs$lang$type properties from generated constructor prototypes. It probably thinks that they are not referenced anywhere so it is safe to remove them.

There are two functions in cljs.core which depend on cljs$lang$type test and are definitely broken in advanced mode compilation:
1. pr-writer-impl method does the check to write user-friendly constructor name
2. missing-protocol method does the check as well (used in very rare scenario)

This is a test to reproduce the problem with bare clojurescript checkout:
https://gist.github.com/darwin/a83ea91f2e365946f076

I spent a good chunk of my day trying to find externs declaration which is IMO not possible.

None of these worked:

var cljs$lang$type;
Object.prototype.cljs$lang$type;

Note: This problem is not only affecting cljs$lang$type, it affects all properties set on type prototypes via (set! ...). It does not affect code which directly calls getBasis or reads a property on a specific type (Closure compiler sees that and prevents removal). It affects all code accessing those properties via "unknown" object when Closure compiler has no information about the object and it could be of any type so it does not connect the dots.

A proposal for a possible solution:

1. find a way how to instruct closure compiler to not remove cljs$lang$type and friend under without changing cljs.core implementation (I failed)
2. or use aset instead of set! to prevent closure compiler to reason about those things and leave them alone
3. or some better solution?



 Comments   
Comment by David Nolen [ 06/May/15 7:09 AM ]

Your externs should look like the following:

Object.cljs$lang$type;
Comment by Antonin Hildebrand [ 07/May/15 12:22 AM ]

Negative. Object.cljs$lang$type; does not work.

I'm pretty sure I'm including those externs correctly (debugged it to the point where externs are passed to the .compile call).

I will try to prepare a patch with aset.

Comment by Antonin Hildebrand [ 07/May/15 1:42 AM ]

the patch is based on top of http://dev.clojure.org/jira/browse/CLJS-1251

Comment by Thomas Heller [ 07/May/15 3:49 AM ]

I don't quite understand your motivation for this? As far as I understand the mori issue you are trying to create an add-on for mori which is based on top of a advanced compiled mori output?

Google Closure "advanced" mode is intended to optimize the whole program not just parts of it. AFAICT you intent to optimize mori and mori.devtools separately and then combine them later. That is not a good idea as both parts would include their own version of cljs.core (and others). Using aset basically bypasses the good parts of the Closure compiler which I'd be very careful with. Closure has facilities to export certain properties/functions but I'm not totally sure this should be done at all. Basically it looks like your are trying to get into the "guts" of an advanced compiled blob without the blob being prepared for it. Which will likely cause problems in many areas.

devtools also sounds like something that I want to use in :none and removed in :advanced. Why should my users carry the extra "weight" of a debug feature they are never going to see?

Comment by Antonin Hildebrand [ 07/May/15 4:18 AM ]

I agree with your points when cljs-devtools is used by a developer in a clojurescript project. Dev mode with :none works well and the developer has full control over removing cljs-devtools in :advanced mode.

Unfortunately with mori.js the story is different. Developers consuming the library typically use precompiled .js files from :advanced mode compilation. Javascript developers are unlikely to install clojure(script) tools and compile mori in dev mode with :none (they will use 'npm install mori').

That is why I forked mori.js and added mori.devtools.js as a new module. This enables mori users to optionally include this file in the same fashion as they could or could not include other optional mori parts (mori.mutable.js, mori.extras.js). Using modules properly should not affect mori.js size. As long as the developer uses the same version of precomiled mori.js and mori.devtools.js they should be good.

But mori is not the only case for this. I can imagine some clojurescript project would like to use modules to build devtools support module as a part of their release process and use it in special cases for debugging release builds. There should be no problem to use devtools in :advanced build if someone really wants to (for whatever reason).

While jumping through the hooks of advanced compilation, I discovered bugs which are real and should be fixed on clojurescript side. The problem of missing cljs$lang$type is not huge but exists and affects existing cljs.core code.

Comment by David Nolen [ 07/May/15 7:44 AM ]

I just confirmed that externs work fine for Object.cljs$type$lang.

Comment by Antonin Hildebrand [ 13/May/15 8:49 AM ]

Can you be more specific where did you put Object.cljs$type$lang to make it work?

I tried:
1. adding it into cljs-devtools, under resources/closure-js/externs/devtools.externs.js (to use Leiningen magic to include library externs) - and it really includes it
2. adding it into clojurescript compiler itself by adding it into src/main/cljs/cljs/externs.js (no effect)
3. adding it into mori.js as an extern file (I don't want to do that in mori)

None of those worked for me.

I'm ok with declining my proposed change. But you could copy and paste my test cases and investigate them. There is a real problem and they expose it.

(pr-str SampleType) should return user-friendly type name, not function string dump

Comment by David Nolen [ 14/May/15 11:41 AM ]

Antonin I don't have time to look into this for you. But believe me externs always work, the entire ClojureScript ecosystem depends on it.

Comment by Antonin Hildebrand [ 14/May/15 11:46 AM ]

Thanks for your reply. No worries. I understand. Thank you for all your work on ClojureScript.





[CLJS-1248] alter-meta! does not work on vars Created: 05/May/15  Updated: 05/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3211
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Leon Grapenthin Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: bug


 Description   

(alter-meta! (var +) assoc :foo 42)
;-> {:foo 42} ;; wrong

(:foo (meta (var +)) :incorrect)
;-> :incorrect






[CLJS-1247] Add *out* and *err* Created: 04/May/15  Updated: 10/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

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


 Comments   
Comment by David Nolen [ 06/May/15 9:02 AM ]

See CLJS-710





[CLJS-1246] Add cljs.core/record? predicate Created: 03/May/15  Updated: 04/May/15  Resolved: 04/May/15

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

Type: Defect Priority: Major
Reporter: Brandon Bloom Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: patch

Attachments: Text File CLJS-1246_v01.patch    
Patch: Code and Test

 Description   

CLJ-394 added one for Clojure.

As is the case with all my recent predicate tickets, this is in the name of better cross-platform code.



 Comments   
Comment by David Nolen [ 04/May/15 6:51 AM ]

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





[CLJS-1245] Implement bound-fn Created: 03/May/15  Updated: 05/May/15

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

Type: Enhancement Priority: Minor
Reporter: Brandon Bloom Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

See discussion on http://dev.clojure.org/jira/browse/CLJS-210






[CLJS-1244] tagged-literal precondition check missing wrapping vector Created: 03/May/15  Updated: 03/May/15  Resolved: 03/May/15

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

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

Attachments: Text File CLJS-1244_v01.patch    

 Description   
(tagged-literal "z" "y")

should trigger precondition check on first argument being a symbol.



 Comments   
Comment by David Nolen [ 03/May/15 7:28 PM ]

fixed https://github.com/clojure/clojurescript/commit/5f1bf1e777ccca0110ead9df7bff257b1bbcee33

Comment by Brandon Bloom [ 03/May/15 7:36 PM ]

Ha! D'oh. I always make that mistake, which is why I made this patch:
http://dev.clojure.org/jira/browse/CLJ-1473

I guess I'll make a cljs version of that patch...

Thanks for the save, Mike.





[CLJS-1243] Add cljs.core.TaggedLiteral type & related fns Created: 03/May/15  Updated: 03/May/15  Resolved: 03/May/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3211, 0.0-3117
Fix Version/s: 0.0-3255

Type: Defect Priority: Major
Reporter: Brandon Bloom Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: patch

Attachments: Text File CLJS-1243_v01.patch    
Patch: Code and Test

 Description   

These are new in Clojure 1.7:

clojure.lang.TaggedLiteral
clojure.core/tagged-literal?
clojure.core/tagged-literal

This type (and it's record-like implementation) are super useful for generic handling of Edn, like I do in Fipp.



 Comments   
Comment by David Nolen [ 03/May/15 3:08 PM ]

fixed https://github.com/clojure/clojurescript/commit/99f4463354dbd9d73073865a999b0225823c41ec





[CLJS-1242] Add cljs.core/pattern? predicate Created: 03/May/15  Updated: 10/May/15

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

Type: Enhancement Priority: Minor
Reporter: Brandon Bloom Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: patch

Attachments: Text File CLJS-1242_v01.patch    
Patch: Code and Test

 Description   

Just like http://dev.clojure.org/jira/browse/CLJS-1241 , this helps with clj/cljs cross-platform development.



 Comments   
Comment by Brandon Bloom [ 03/May/15 2:38 PM ]

See also http://dev.clojure.org/jira/browse/CLJ-1720

Comment by Brandon Bloom [ 10/May/15 11:36 PM ]

Note that there already is a cljs.core/regexp?, since it's used in a few places by core.





[CLJS-1241] Add cljs.core/boolean? predicate Created: 03/May/15  Updated: 05/May/15

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

Type: Enhancement Priority: Minor
Reporter: Brandon Bloom Assignee: Unassigned
Resolution: Unresolved Votes: 2
Labels: patch

Attachments: Text File CLJS-1241_v01.patch    
Patch: Code and Test

 Description   

I'm constantly re-implementing this predicate...

It's also important for clj/cljs compatibility.



 Comments   
Comment by Brandon Bloom [ 03/May/15 2:32 PM ]

See also: http://dev.clojure.org/jira/browse/CLJ-1719

Comment by Mike Fikes [ 03/May/15 2:52 PM ]

I tried this patch and it works correctly for me.

The docstring uses "typeof". Perhaps "type of" was intended?

cljs.user=> (doc boolean?)
-------------------------
cljs.core/boolean?
([x])
  Returns true if the typeof x is boolean, false otherwise.

nil
Comment by Brandon Bloom [ 03/May/15 7:41 PM ]

I did mean "typeof", which is a javascript-ism. A better doc string may be less javascript-specific...





[CLJS-1240] Add var? predicate Created: 03/May/15  Updated: 03/May/15  Resolved: 03/May/15

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

Type: Defect Priority: Major
Reporter: Brandon Bloom Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: patch

Attachments: Text File CLJS-1240_v01.patch    
Patch: Code and Test

 Description   

Now that ClojureScript has (static) vars, we need a var? predicate.



 Comments   
Comment by David Nolen [ 03/May/15 3:05 PM ]

fixed https://github.com/clojure/clojurescript/commit/795f08ea23eb740af04013162374e4d169654e27





[CLJS-1239] cljs.core/eduction is not variadic Created: 03/May/15  Updated: 03/May/15  Resolved: 03/May/15

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

Type: Defect Priority: Major
Reporter: Brandon Bloom Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: patch

Attachments: Text File CLJS-1239_v01.patch    
Patch: Code and Test

 Description   

But clojure.core/eduction is variadic.



 Comments   
Comment by David Nolen [ 03/May/15 7:30 PM ]

fixed https://github.com/clojure/clojurescript/commit/703561bff0f06636e1f604c74494c2b5b502f420





[CLJS-1238] Setting *main-cli-fn* when using :target :nodejs shouldn't be manditory Created: 01/May/15  Updated: 10/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

Type: Enhancement Priority: Minor
Reporter: Jeremy Shoemaker Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: None

Attachments: Text File nodejs-main-cli-fn.patch    
Patch: Code

 Description   

Currently, when you use :target :nodejs in the build options for ClojureScript, the resulting code requires you to set *main-cli-fn* to a function.

This prevents someone from writing a library that can be used by JavaScript developers because it forces code execution on require. It also makes writing a CLI tool that can be distributed using NPM less straightforward. I ran into this issue trying to create a Leiningen template for writing CLI tools that could be installed using npm install or npm link. I had a wrapper script to take care of the CLI use-case, and intended to write the ClojureScript module in a more library oriented way, but ran into issues. I could work around this by not using the wrapper script, but it got me thinking about the more general library issue.

I don't see any reason why you should be forced to set *main-cli-fn* and so I'm suggesting making it optional.

Attached is a patch that makes it optional but retains the check for whether the value it is set to is a function in the case where it is set.

This is my first time submitting a change to a project using a git patch and not a pull request, so let me know if I've made the patch wrong.



 Comments   
Comment by Jeremy Shoemaker [ 01/May/15 7:27 PM ]

I just noticed the priority defaulted to "Major". I don't know if I'd say it's major, so feel free to bump it down if that doesn't seem appropriate.





[CLJS-1237] ns-unmap doesn't work on refers from cljs.core Created: 01/May/15  Updated: 10/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

Type: Defect Priority: Major
Reporter: Chouser Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: ns-unmap

Attachments: Text File 0001-CLJS-1237-ns-unmap-adds-to-namespace-s-excludes.patch     Text File 0002-CLJS-1237-ns-unmap-adds-to-namespace-s-excludes.patch    
Patch: Code

 Description   

In ClojureScript, using ns-unmap on a symbol from cljs.core doesn't exclude it from the current namespace. Note that both a function and a macro still exist, even after unmapping:

To quit, type: :cljs/quit  
cljs.user=> (ns-unmap 'cljs.user 'when) ;; macro
true  
cljs.user=> (ns-unmap 'cljs.user 'not)  ;; function
true  
cljs.user=> (when 1 2)  
2  
cljs.user=> (not false)  
true  

This differs from the behavior of Clojure's ns-unmap. Note the appropriate errors when attempting to use unmapped symbols:

Clojure 1.7.0-beta1
user=> (ns-unmap 'user 'when) ;; macro
nil
user=> (ns-unmap 'user 'not)  ;; function
nil
user=> (when 1 2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: when in this context, compiling:(NO_SOURCE_PATH:11:1) 
user=> (not false)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: not in this context, compiling:(NO_SOURCE_PATH:12:1) 

Somehow ClojureScript's ns-unmap needs to add the symbol to the current namespace's :excludes set. Note that the def special form does this already (after it displays a warning).

We have two solutions. 0001 extends the ns form's :merge behavior to support :excludes, and then uses this in ns-unmap. If the enhancement to ns isn't wanted, patch 0002 changes ns-unmap to update :excludes directly.



 Comments   
Comment by David Nolen [ 05/May/15 7:23 AM ]

The second patch is preferred. However it seems the second patch is too permissive. The :excludes logic should only be applied if the symbol identifies a core macro or fn.

Comment by Chouser [ 05/May/15 3:46 PM ]

The ns form's own :refer-clojure :exclude accepts arbitrary symbols and adds them to the namespace's :excludes set, which seems like the same permissiveness problem. Do you want a patch that addresses the permissiveness of both ns and ns-unmap in this ticket, or should such a patch go in a new ticket?

Comment by David Nolen [ 05/May/15 4:08 PM ]

New ticket to fix the bug that :exclude doesn't check the symbol list for cljs.core declared vars, and an updated patch here please.





[CLJS-1236] `constructor` needs to munged if used as namespace segment Created: 01/May/15  Updated: 10/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

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


 Description   

Will make goog.require believe that the namespace has already been loaded and throw an exception since all JS objects have the constructor property.



 Comments   
Comment by David Nolen [ 04/May/15 8:19 AM ]

This issue is not quite as simple as it sounds as we actually need a special case for namespace munging. For example we don't want to munge Foo.constructor but we do want to munge ns.foo.constructor. To implement the fix correctly it would require changing all the cases where library names are munged.





[CLJS-1235] non-upstream :foreign-libs not copied to :output-dir Created: 01/May/15  Updated: 09/May/15  Resolved: 09/May/15

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

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


 Description   

When testing the following compiler option:

:foreign-libs [{:file "http://greggman.github.io/webgl-fundamentals/webgl/resources/webgl-utils.js"
                :provides ["gl-utils"]}

The file at the url does not get copied into :output-dir.



 Comments   
Comment by David Nolen [ 09/May/15 11:17 AM ]

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





[CLJS-1234] local :foreign-libs support for REPLs Created: 01/May/15  Updated: 10/May/15  Resolved: 10/May/15

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

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


 Description   

It appears local (not upstream) :foreign-libs will not get picked up by REPLs.



 Comments   
Comment by David Nolen [ 09/May/15 11:17 AM ]

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

Comment by David Nolen [ 09/May/15 3:55 PM ]

The current behavior is is add with the support for Closure libraries that follow classpath conventions.

Comment by David Nolen [ 10/May/15 8:57 AM ]

There are no issues with master. :libs directories need to be on the classpath.





[CLJS-1233] excluding + * etc. does not work for libraries in JARs Created: 01/May/15  Updated: 05/May/15  Resolved: 05/May/15

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

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


 Comments   
Comment by David Nolen [ 05/May/15 7:24 AM ]

This behavior was observed when using Kovas Boguta's Gamma library.

Comment by David Nolen [ 05/May/15 7:44 AM ]

The bug is in Gamma itself.





[CLJS-1232] bad arglists for doc, regression Created: 01/May/15  Updated: 01/May/15  Resolved: 01/May/15

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

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


 Description   

hash-map doesn't show anything. map only shows one arity, etc.



 Comments   
Comment by David Nolen [ 01/May/15 2:43 PM ]

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





[CLJS-1231] AMD Module Processing Created: 30/Apr/15  Updated: 30/Apr/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: GSoC

Type: Enhancement Priority: Major
Reporter: David Nolen Assignee: Maria Neise
Resolution: Unresolved Votes: 0
Labels: None





[CLJS-1230] ES 2015 Module Processing Created: 30/Apr/15  Updated: 30/Apr/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: GSoC

Type: Enhancement Priority: Major
Reporter: David Nolen Assignee: Maria Neise
Resolution: Unresolved Votes: 0
Labels: None





[CLJS-1229] Simplify Closure CommonJS & ES 2015 Module support Created: 30/Apr/15  Updated: 18/May/15  Resolved: 18/May/15

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

Type: Task Priority: Major
Reporter: David Nolen Assignee: Maria Neise
Resolution: Completed Votes: 1
Labels: None


 Description   

Google Closure Compiler's ProcessCommonJSModules constructors are currently private. ES6ModuleLoader is a package private class with private constructors. All of these things must be made public if we are going to use them as individual passes on files. The current state of this functionality in Closure Compiler assumes being driven from the command line to produce a final build. In our case we want to use them as part of incremental compilation.



 Comments   
Comment by Maria Neise [ 18/May/15 2:44 PM ]

This has been fixed with https://github.com/google/closure-compiler/pull/952. In addition to making ProcessCommonJSModules and ES6ModuleLoader public, we also made ProcessEs6Modules public.





[CLJS-1228] cljs.util/topo-sort is polynomial on larger dependency graphs Created: 28/Apr/15  Updated: 10/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

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


 Comments   
Comment by David Nolen [ 08/May/15 7:35 AM ]

This problem was reported due the performance of cljs.analyzer/ns-dependents when used by cljs.compiler/compile-file. However as cljs.compiler/compile-file does not need the topological sorting bit, we should supply a faster alternative to cljs.analyzer/ns-dependents which simply returns a distinct seq which can be poured into a set.





[CLJS-1227] Raise error when if form has more than 4 statements Created: 28/Apr/15  Updated: 28/Apr/15

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

Type: Enhancement Priority: Minor
Reporter: Nikita Prokopov Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: None

Attachments: Text File cljs-1227-raise-error-when-if-has-more-than-4-statements.patch    
Patch: Code

 Description   

This is a trivial change, but might be very helpful. I've been struck by this a lot: form mistakenly put inside if form after then and else is silently ignored. Solution: raise an error when if contains more than 4 elements.






[CLJS-1226] Add on-testing-complete hook Created: 27/Apr/15  Updated: 13/May/15  Resolved: 12/May/15

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

Type: Enhancement Priority: Minor
Reporter: Sebastian Bensusan Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: cljs, enhancement, test

Attachments: Text File cljs_1226.patch     Text File cls_1226_v2.patch    
Patch: Code

 Description   

When a test runner runs async tests created with cljs.test/async there is no reliable way to return the control from the async code in the test suite to the test runner. This is problematic since the test script might need the tests results to proceed or terminate.

A function to be called after all tests are done is proposed: cljs.test/*on-testing-complete-fn* and it would take the test summary as its only argument

It can be set by the user by calling cljs.test/set-on-testing-complete! which should be callable from JS (^:export)

Notes:
In the patch, the function cljs.test/successful? also has the ^:export metadata to be called from JS test runners.
The code was tested manually with V8, Spidermonkey, Nashorn, SlimerJs, and PhantomJS but not with JavaScript Core.



 Comments   
Comment by Jenan Wise [ 01/May/15 2:40 PM ]

Rather than relying on a global, what about if run-tests took a callback? It would differentiate the API from clojure.test but they are already different due to the env arg and nil return value.

Comment by Sebastian Bensusan [ 01/May/15 2:59 PM ]

It is currently in a global to allow easy access from outside cljs (js runners). By having it to pass it to run-tests it would be harder to make reusable test runners from outside cljs/ Said runners would have to know both the ns to run (TBD in each project) and the callback (what we want to reuse, i.e. phantom.exit(0))

Comment by David Nolen [ 05/May/15 7:02 AM ]

Is there any particular reason to not invoke do-report with a suitable dispatch value instead of adding a new function here?

Comment by Sebastian Bensusan [ 05/May/15 7:29 AM ]

I'm not sure that I understand. I thought do-report and report were meant for printing out the summary as a report. This on-testing-complete hook should allow the caller to do whatever he/she wants after all tests are done. Do you want to allow the caller to specify how report works for some new dispatch value by adding:

(defmethod report [::default :on-testing-complete] [m]
..custom-code)

Comment by David Nolen [ 05/May/15 7:32 AM ]

The purpose of report is just side effects, printing is only one possibility. Note there are several testing events that aren't even really used by the standard reporter.

Comment by Leon Grapenthin [ 05/May/15 12:37 PM ]

IMHO if you want to run anything synchronously before after or between tests, you should use fixtures or if necessary compose the desired blocks yourself.

At least making the latter possible is why I made run-block and the block builder fns public.

You can easily run

(run-block (concat (run-tests-block 'a-ns-to-be-tested 'another-ns-to-be-test )
[(fn []
;; your continuation code here
)]))

This is a reliable way to pick up control after testing.

This patch only affects testing done via run-tests. E. g. on-testing-complete-fn won't be invoked if a user invoked test-ns and testing is complete. You could hack it into the block composer in test-ns, but still users composing blocks in the way mentioned above couldn't rely on it being invoked.

Comment by Sebastian Bensusan [ 11/May/15 10:25 AM ]

I followed Leon's suggestions and used run-block to make my own test-block. The only problem is that my continuation function doesn't get the summary/env as an argument. From what I understood I could pass env as an argument to run-tests but it would get cleared right before my continuation function. I don't know how to work around this yet.

If you think my solution is a correct use of the cljs.test API then this patch isn't needed. If you believe that run-tests should report on-testing-done I'd be happy to submit a new patch adding a new event to the report event system. Then I could get the summary/env from a custom report method as David suggested.

Comment by David Nolen [ 11/May/15 10:37 AM ]

I would not consider anything at the level of run-block part of the public API nor anything that anyone should be looking into. This stuff may change.

Please add a real reporting hook thanks.

Comment by Sebastian Bensusan [ 12/May/15 5:39 AM ]

Added :end-run-test event to cljs.test and a dummy event handler for it.

Comment by David Nolen [ 12/May/15 3:04 PM ]

fixed https://github.com/clojure/clojurescript/commit/31736450c6ca951c63bb685d744c11074fbfe323

Comment by Leon Grapenthin [ 12/May/15 4:09 PM ]

For API consistency this should also be in the blocks of `test-all-vars` in `test-ns`, `test-var` and `test-vars`.

Comment by David Nolen [ 12/May/15 4:24 PM ]

Happy to see a new ticket + patch that addresses the consistency issue.

Comment by Sebastian Bensusan [ 13/May/15 2:51 AM ]

Leon, I filled CLJS-1267 to address your point. Feel free to add any other API inconsistencies that :end-run-tests introduced.





[CLJS-1225] Variadic function with same name as parent function gives runtime error in advanced compile mode. Created: 27/Apr/15  Updated: 06/May/15  Resolved: 06/May/15

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

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

windows, chrome



 Description   

This code fails with: Uncaught TypeError: undefined is not a function, when using advanced compilation.
If I do not pass the variadic arguments it works.
If I rename one of the functions it works.

(defn- incme []
  (let [incme (fn [a queue & args] (inc a))]
    (println (incme 1 [1] :color "#fff"))))

(incme)

Tried this on both 2913 and 3211 with the same result.



 Comments   
Comment by David Nolen [ 27/Apr/15 7:52 AM ]

It appears that the variadic invoke is being considered as a local and inadvertently getting renamed. Will look into it. Thanks for the report.

Comment by David Nolen [ 06/May/15 7:50 AM ]

The issue only exists when *cljs-static-fns* is bound to true.

Comment by David Nolen [ 06/May/15 9:01 AM ]

fixed https://github.com/clojure/clojurescript/commit/717cab5ed3f9879cddab7e560919522e7698e873





[CLJS-1224] cljs.repl: Memoize stack frame mapping Created: 26/Apr/15  Updated: 29/Apr/15  Resolved: 29/Apr/15

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

Type: Enhancement Priority: Major
Reporter: Mike Fikes Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: performance
Environment:

OS X QuickStart browser REPL against Safari


Attachments: Text File CLJS-1224.patch    

 Description   

When evaluating an expression that results in a stack overflow, and the resulting trace is source mapped by cljs.repl, this can result in thousands of frames being mapped which can take a few minutes. But, oftentimes stack overflow is the result of recursion, so many of the mapped frames are identical. This is trivial to optimize using memoize, resulting in the mapping occurring in a couple of seconds.

A test case, when using the Quick Start browser REPL against Safari, involves evaluating these 3 forms,

(defn next-results
  "Placeholder for function which computes some intermediate
  collection of results."
  [n]
  (range 1 n))

(defn build-result [n]
  (loop [counter 1
         results []]
    (if (< counter n)
      (recur (inc counter)
             (concat results (next-results counter)))
      results)))

(first (build-result 7000))

Note: The browser REPL sometimes fails to display a stack trace at times, showing an EOF error that is probably unrelated. When it does display the trace, though, you can see the performance effects. I found that you can get it to do this by starting with maybe 4000 in the call above, and increasing by 1000 until it overflows the stack.

Will attach a patch for consideration.



 Comments   
Comment by David Nolen [ 29/Apr/15 6:52 AM ]

fixed https://github.com/clojure/clojurescript/commit/4773730eda0a5c5d55cbb90adef54bc4bbe6b35e





[CLJS-1223] cljs.repl/doc for unqualified .. macro Created: 24/Apr/15  Updated: 24/Apr/15

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

Type: Defect Priority: Minor
Reporter: Mike Fikes Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Note: Also affects 0.0-3211 (not yet available in JIRA pulldown)
Quick Start cljs.jar
OS X



 Description   

In the REPL, (doc ..) fails, while it succeeds for similar macros like (doc ->), and it also succeeds for ns-qualified: (doc cljs.core/..).

$ java -jar cljs.jar -m cljs.repl.node
ClojureScript Node.js REPL server listening on 54359
To quit, type: :cljs/quit
cljs.user=> *clojurescript-version*
"0.0-3211"
cljs.user=> (doc ..)
-------------------------
/.
  nil

nil
cljs.user=> (doc cljs.core/..)
-------------------------
cljs.core/..
([x form] [x form & more])
Macro
  form => fieldName-symbol or (instanceMethodName-symbol args*)

  Expands into a member access (.) of the first member on the first
  argument, followed by the next member on the result, etc. For
  instance:

  (.. System (getProperties) (get "os.name"))

  expands to:

  (. (. System (getProperties)) (get "os.name"))

  but is easier to write, read, and understand.

nil





[CLJS-1222] Sequence of a stateful transducer is producing the wrong answer Created: 24/Apr/15  Updated: 10/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3211
Fix Version/s: Next

Type: Defect Priority: Minor
Reporter: Lucas Cavalcanti Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: bug, cljs, collections
Environment:

OSX 10.10.3, java 1.8.0-ea-b124



 Description   

I'm producing more than one element on the 1-arity of the transducer, and sequence is only considering the last one.

Here is the transducer and the tests that fail for sequence:

(defn sliding-window [n]
  (fn [rf]
    (let [a #js []]
      (fn
        ([] (rf))
        ([result]
         (loop [] ;; Here I'm emitting more than one element
           (when (not-empty a)
             (rf result (vec (js->clj a)))
             (.shift a)
             (recur))))
        ([result input]
         (.push a input)
         (if (== n (.-length a))
           (let [v (vec (js->clj a))]
             (.shift a)
             (rf result v))
           result))))))

;;This test fails! =(
(deftest sliding-window-in-a-sequence
  (is (= [[5 4 3]
          [4 3 2]
          [3 2 1]
          [2 1]
          [1]]
         (sequence (sliding-window 3) [5 4 3 2 1])))

  (is (= [[2 1]
          [1]]
         (sequence (sliding-window 3) [2 1]))))


 Comments   
Comment by Lucas Cavalcanti [ 24/Apr/15 11:18 AM ]

I could make it work by recurring on the result.

([result]
  (loop [res result]
    (if (not-empty a)
      (let [v (vec (js->clj a))]
        (.shift a)
        (recur (rf res v)))
      res)))

even so it's weird that the previous version behaves differently on core.async and sequences in cljs and clj

Comment by David Nolen [ 26/Apr/15 4:04 AM ]

Please demonstrate the problem without core.async. Thanks.

Comment by Lucas Cavalcanti [ 26/Apr/15 7:32 PM ]

Hi,

the last test I posted on the ticket, fails in cljs, but not in clj:

;;This test fails! =(
(deftest sliding-window-in-a-sequence
  (is (= [[5 4 3]
          [4 3 2]
          [3 2 1]
          [2 1]
          [1]]
         (sequence (sliding-window 3) [5 4 3 2 1])))

  (is (= [[2 1]
          [1]]
         (sequence (sliding-window 3) [2 1]))))
Comment by David Nolen [ 27/Apr/15 7:43 AM ]

I've removed the core.async bits from the description to clarify the issue.

Comment by David Nolen [ 10/May/15 2:40 PM ]

The implementation of sliding-window above does not appear to be correct, it doesn't return the result. This ticket needs more information.

Comment by Lucas Cavalcanti [ 10/May/15 3:51 PM ]

As I said on http://dev.clojure.org/jira/browse/CLJS-1222?focusedCommentId=38620&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-38620

changing the 1-arity of the sliding-window to that fixes the transducer.

The point of this ticket now is that the behavior of the same (wrong) transducer in clj (both core.async and sequence) and cljs (core.async) is different than cljs sequence.





[CLJS-1221] deftype/defrecord getBasis static method Created: 24/Apr/15  Updated: 29/Apr/15  Resolved: 29/Apr/15

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

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


 Comments   
Comment by David Nolen [ 29/Apr/15 6:54 AM ]

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





[CLJS-1220] Invalid regexp in src/clj/cljs/util.clj:130 Created: 23/Apr/15  Updated: 28/Apr/15  Resolved: 23/Apr/15

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

Type: Defect Priority: Major
Reporter: Marek Lipert Assignee: Unassigned
Resolution: Not Reproducible Votes: 0
Labels: None
Environment:

any



 Description   

There is an error in regex introduced in this commit:

https://github.com/clojure/clojurescript/commit/4228ee3a5dad6b04b1f852cb87138ac5c6d595be



 Comments   
Comment by David Nolen [ 23/Apr/15 7:52 PM ]

Tickets must present enough information to reproduce. Please include all information (environment etc.) necessary to replicate. Feel free to reopen when you can supply this.

Comment by Sebastian Bensusan [ 27/Apr/15 6:14 PM ]

This happens when ClojureScript is used with Java version < Java 7. The Regex ?U was added in Java 7.

Comment by David Nolen [ 28/Apr/15 6:52 AM ]

Right, but it's the case ClojureScript only works for Java >= 7 anyway due to the dependency on Closure Compiler.





[CLJS-1219] Eval doesn't work as expected Created: 23/Apr/15  Updated: 23/Apr/15  Resolved: 23/Apr/15

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

Type: Defect Priority: Major
Reporter: Alex Gunnarson Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: None
Environment:

Mac OS X Yosemite (10.10.1), lein-figwheel "0.2.7-SNAPSHOT"



 Description   

I've been doing some tests with macros and |eval| in ClojureScript and it doesn't work as expected. Here is the test file I'm using, which figwheel is reloading (src/cljc/quantum/test_fns.cljc):

=======================
(ns quantum.test-fns)

#?(:clj (defmacro eval-test0 [arg] `(eval '~arg)))
#?(:clj (defmacro eval-test1 [arg] (eval `~arg)))

#?(:clj
(defmacro mfn
"|mfn| is short for 'macro-fn'.
Originally named |functionize| by mikera."
{:attribution "mikera, http://stackoverflow.com/questions/9273333/in-clojure-how-to-apply-a-macro-to-a-list/9273560#9273560"}
[macro]
`(fn [& args#]
(eval (cons '~macro args#)))))

#?(:clj
(defmacro mfn-test
[macro]
(fn [& args]
(eval `(cons '~macro args)))))
=======================

I've been trying to get the macro |mfn| working, to be able to create macro aliases in ClojureScript like so:

=======================
(def cljs-for (mfn for))
(defalias lazy-for cljs-for)
=======================

By the way, the equivalent code in Clojure is a lot shorter and simpler, but it doesn't work in ClojureScript:

=======================
(defalias lazy-for for)
=======================

At the moment, |mfn| works in Clojure but not in ClojureScript. The error is as follows:

=======================
quantum.test => (quantum.test-fns/mfn 0)
WARNING: Use of undeclared Var cljs.core/eval at line 1 <cljs repl>
#<TypeError: Cannot read property 'call' of undefined>
=======================

So then I tried testing |eval| all by itself. I realize that runtime |eval| is not supported in ClojureScript, but from what I've read, it is supported within Clojure macros referenced by ClojureScript code. So I tried the following:

=======================
quantum.test => (eval-test0/mfn 0)
=======================

This gave the same error as calling |mfn|. So I tried the following next, which worked for CLJS-278 (http://dev.clojure.org/jira/browse/CLJS-278):

=======================
quantum.test => (eval-test1/mfn 0)
0
=======================

This, as you can see, works. So the problem seems to be nesting |eval| within a syntax-quote. With this in mind, I intended to patch |mfn| with |mfn-test|. So I called it like so, with the following result:

=======================
quantum.test => (quantum.test-fns/mfn-test 0)
java.lang.IllegalArgumentException: No method in multimethod 'emit-constant' for dispatch value: class quantum.test_fns$mfn_test$fn__94072
at clojure.lang.MultiFn.getFn(MultiFn.java:156)
at clojure.lang.MultiFn.invoke(MultiFn.java:229)
at cljs.compiler$eval2597$fn__2599.invoke(compiler.clj:355)
at clojure.lang.MultiFn.invoke(MultiFn.java:229)
at cljs.compiler$emit.invoke(compiler.clj:137)
at cljs.compiler$emit_str.invoke(compiler.clj:165)
at cljs.repl$evaluate_form.invoke(repl.clj:423)
at cljs.repl$eval_cljs.invoke(repl.clj:542)
at cljs.repl$repl_STAR_$read_eval_print__4217.invoke(repl.clj:808)
at cljs.repl$repl_STAR_$fn_4223$fn_4230.invoke(repl.clj:845)
at cljs.repl$repl_STAR_$fn__4223.invoke(repl.clj:844)
at cljs.compiler$with_core_cljs.invoke(compiler.clj:964)
at cljs.repl$repl_STAR_.invoke(repl.clj:810)
at figwheel_sidecar.repl$repl.invoke(repl.clj:172)
at figwheel_sidecar.repl$start_repl.invoke(repl.clj:389)
at figwheel_sidecar.repl$cljs_repl.invoke(repl.clj:405)
at figwheel_sidecar.repl$repl_switching_loop.invoke(repl.clj:416)
at figwheel_sidecar.repl$repl_switching_loop.invoke(repl.clj:412)
at figwheel_sidecar.repl$run_autobuilder.invoke(repl.clj:455)
at user$eval17648.invoke(form-init3534144446427289738.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6792)
at clojure.lang.Compiler.eval(Compiler.java:6782)
at clojure.lang.Compiler.load(Compiler.java:7237)
at clojure.lang.Compiler.loadFile(Compiler.java:7175)
at clojure.main$load_script.invoke(main.clj:275)
at clojure.main$init_opt.invoke(main.clj:280)
at clojure.main$initialize.invoke(main.clj:308)
at clojure.main$null_opt.invoke(main.clj:343)
at clojure.main$main.doInvoke(main.clj:421)
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)
=======================

This seems to be a problem with ClojureScript, but I may be wrong. Please do let me know.



 Comments   
Comment by David Nolen [ 23/Apr/15 7:50 PM ]

We do not look at tickets that involve tooling beyond involving anything other than ClojureScript. This ticket also suffers from not being a minimal case (conditional reading + something about eval). Feel free to open a new ticket that represents a minimal issue (only one dimension) using only ClojureScript thanks.





[CLJS-1218] Syntax quoting an alias created with :require-macros throws ClassCastException Created: 22/Apr/15  Updated: 28/Apr/15  Resolved: 28/Apr/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3196
Fix Version/s: 0.0-3211, 0.0-3255

Type: Defect Priority: Minor
Reporter: Ryan Berdeen Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None


 Description   

With ClojureScript 0.0-3196 or the current cljs.jar, ClojureScript fails to read this file:

a.cljs
(ns a
  (:require-macros [clojure.string :as alias]))
 
; this is fine
`xxx/name
 
; this throws clojure.lang.Symbol cannot be cast to clojure.lang.Namespace
`alias/name
java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to clojure.lang.Namespace
        at clojure.tools.reader$resolve_symbol.invoke(reader.clj:633)
        at clojure.tools.reader$syntax_quote_STAR_.invoke(reader.clj:677)
        at clojure.tools.reader$read_syntax_quote.invoke(reader.clj:724)
        at clojure.tools.reader$read_STAR_.invoke(reader.clj:873)


 Comments   
Comment by David Nolen [ 22/Apr/15 11:59 PM ]

Please open an issue in tools.reader first. If it's determined that that is the not source, then you can reopen this one.

Comment by Nicola Mometto [ 23/Apr/15 6:13 AM ]

Not a tools.reader bug – cljs is binding alias-map to a map of sym->sym, the documentation for alias-map talks about mapping ns alias -> ns.

However I realize that providing sym->ns mapping could be problematic for cljs so I've just cut a tools.reader 0.9.2 release allowing for sym->sym mapping (see https://github.com/clojure/tools.reader/commit/6ca3b8899fe3884706fbeb176c008dc43643dc4b)

Comment by David Nolen [ 28/Apr/15 8:24 PM ]

fixed as of e3ba4f4





[CLJS-1217] cljs.test/run-tests with default env has no way to access summary Created: 21/Apr/15  Updated: 17/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

Type: Enhancement Priority: Major
Reporter: Jenan Wise Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

clojure.test/run-tests returns a summary map that can be used to programmatically determine if a test has any errors or failures. As of the inclusion of async tests, cljs.test/run-tests returns nil. This makes it a bit verbose and redundant to write test runners that wish to use the default reporting but need to signal programmatically when there are errors or failures (such as when integrating with continuous build systems). As far as I can tell, the easiest approach under the current implementation looks like this:

;; All we care about is the error+fail count
;; and want cljs.test to print everything else as
;; normal.

(def error-count (atom 0))

(defmethod report [::test :pass] [m]
  ((get-method report [:cljs.test/default :pass]) m))

(defmethod report [::test :begin-test-ns] [m]
  ((get-method report [:cljs.test/default :begin-test-ns]) m))

(defmethod report [::test :error] [m]
  (swap! error-count inc)
  ((get-method report [:cljs.test/default :error]) m))

(defmethod report [::test :fail] [m]
  (swap! error-count inc)
  ((get-method report [:cljs.test/default :fail]) m))

(defmethod report [::test :summary] [m]
  ((get-method report [:cljs.test/default :summary]) m))

(defn runner
  []
  (run-tests (empty-env ::test) '...))

(from here)

This is true even when only sync tests are being used.

The docs mention that there is no support for coordination in cljs.test, which makes sense, but it seems like there should be a way to access the summary value without writing all of the report methods. Also, under the current implementation cljs.test/successful? appears to be unusable.



 Comments   
Comment by Sebastian Bensusan [ 01/May/15 1:30 PM ]

This problem is solved by the inclusion of :end-run-tests as specified in CLJS-1226.

You can define:

(defmethod cljs.test/report [:cljs.test/default :end-run-tests] [m]
  (cljs.test/successful? m]))

since m is the summary with {:type :end-run-tests}.





[CLJS-1216] varargs not passed properly Created: 21/Apr/15  Updated: 23/Apr/15  Resolved: 23/Apr/15

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

Type: Defect Priority: Critical
Reporter: Karsten Schmidt Assignee: David Nolen
Resolution: Completed Votes: 2
Labels: compiler


 Description   

The following is broken as of 3196 (3165 is still working correctly)

(defn foo
  ([a] (foo a 10))
  ([a b & [c]] [a b c]))

(foo 1)
;; => [1 (10) nil] => should be [1 10 nil]

(foo 1 2)
;; => [1 (2) nil] => should be [1 2 nil]

(foo 1 2 3)
;; => [1 (2 3) nil] => should be [1 2 3]


 Comments   
Comment by Stephen Nelson [ 21/Apr/15 7:18 PM ]

This only occurs with defns that have multiple bodies, it does not occur with fns or with defns with a single body, or when the defn is called via apply rather than directly. Seems like it might be an off-by-one error in the calculation of required arguments in the defn dispatcher function. Test case:

test/dispatch_test.cljs
(ns test.destructuring-test
  (:require [cljs.test :refer-macros [deftest is]]))

(defn destructure
  ([kvs]
   kvs)
  ([k v & args]
   [k v args]))

(deftest test-destructuring
  (is (= [1 2 [3 4]]                                        ;; fails
         (destructure 1 2 3 4)))
  (is (= [1 2 [3 4]]                                        ;; passes
         (apply destructure [1 2 3 4])))
  )

In the compiled javascript the default case of the dispatcher only pulls one argument off before calling the variadic body, whereas the applyTo body pulls two off. Seems like the dispatcher is at fault.

test/dispatch_test.js
...
test.destructuring_test.destructure = (function test$destructuring_test$destructure() {
    var G__48557 = arguments.length;
    switch (G__48557) {
        case 1:
            return test.destructuring_test.destructure.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

            break;
        default:
            var argseq__17948__auto__ = (new cljs.core.IndexedSeq(Array.prototype.slice.call(arguments, 1), (0)));
            return test.destructuring_test.destructure.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]), argseq__17948__auto__);

    }
});

test.destructuring_test.destructure.cljs$core$IFn$_invoke$arity$1 = (function (kvs) {
    return kvs;
});

test.destructuring_test.destructure.cljs$core$IFn$_invoke$arity$variadic = (function (k, v, args) {
    return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [k, v, args], null);
});

test.destructuring_test.destructure.cljs$lang$applyTo = (function (seq48553) {
    var G__48554 = cljs.core.first.call(null, seq48553);
    var seq48553__$1 = cljs.core.next.call(null, seq48553);
    var G__48555 = cljs.core.first.call(null, seq48553__$1);
    var seq48553__$2 = cljs.core.next.call(null, seq48553__$1);
    return test.destructuring_test.destructure.cljs$core$IFn$_invoke$arity$variadic(G__48554, G__48555, seq48553__$2);
});
...
Comment by Karsten Schmidt [ 22/Apr/15 5:20 AM ]

You're right, Stephen! I've narrowed down the first occurrence, it's starting at r3178 - most likely with the changes done to cljs.core in this commit: https://github.com/clojure/clojurescript/commit/576fb6e054dd50ec458a3c9e4172a5a0002c7aea

will dig more & attempt a patch later today...

Comment by David Nolen [ 23/Apr/15 12:34 AM ]

I have a fix for this, just a simple error around computing the max fixed arity.

Comment by David Nolen [ 23/Apr/15 12:39 AM ]

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

Comment by David Nolen [ 23/Apr/15 12:51 AM ]

Cut 0.0-3211 with this fix.





[CLJS-1215] Guard against older Clojure dep Created: 21/Apr/15  Updated: 23/Apr/15  Resolved: 23/Apr/15

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

Type: Enhancement Priority: Minor
Reporter: Mike Fikes Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: None
Environment:

OS X



 Description   

Not sure if this is even the responsibility of, or possible to address from, the ClojureScript compiler, but here is the ask: If someone uses a project.clj specifying Clojure 1.6.0, emit a warn or balk. (I'm only thinking this is remotely possible from within the ClojureScript compiler if it can check the version of Clojure being used prior to making calls into Clojure.)

Rationale: Discovered a case where important compiler/analyzer warnings were not being emitted until project.clj was revised to specify Clojure 1.7.0-beta1.

Here is a minimal setup exhibiting the problem, (including both Quick Start and cljsbuild bits so it is easy to see the effects of the setup):

src/foo/bar.cljs:

(ns foo.bar
  (:require-macros [foo.macros :refer [call]]))

(call)

src/foo/macros.clj:

(ns foo.macros)

(defmacro call []
  `(foo.baz/quux))

src/foo/baz.cljs:

(ns foo.baz)

(defn quux [])

build.clj (meant to be used with cljs.jar):

(require 'cljs.closure)

(cljs.closure/build "src"
  {:output-to "main.js"})

project.clj:

(defproject ex "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/clojurescript "0.0-3196"]]
  :plugins [[lein-cljsbuild "1.0.5"]]
  :source-paths ["src"]
  :cljsbuild {
    :builds [{:id "dev"
              :source-paths ["src"]
              :compiler {
                :output-to "main.js"}}]})

In the above project, the code is missing an important :require and the emitted JavaScript will be bad for :none. The good thing is the compiler warns about it:

$ java -cp cljs.jar:src clojure.main build.clj
WARNING: Use of undeclared Var foo.baz/quux at line 4 src/foo/bar.cljs

But, if cljsbuild is used, no warning is issued:

$ rm main.js
$ lein cljsbuild once dev
Compiling ClojureScript.
Compiling "main.js" from ["src"]...
Successfully compiled "main.js" in 4.567 seconds.

If the project.clj is revised to specify 1.7.0-beta1, then:

$ rm main.js 
$ lein cljsbuild once dev
Compiling ClojureScript.
Compiling "main.js" from ["src"]...
WARNING: Use of undeclared Var foo.baz/quux at line 4 src/foo/bar.cljs
Successfully compiled "main.js" in 4.258 seconds.


 Comments   
Comment by Mike Fikes [ 21/Apr/15 1:37 PM ]

An additional note:

If you downgrade the ClojureScript dep in project.clj to 0.0-3126 and use it specifying Clojure 1.6.0, then the desired warning is emitted:

$ lein cljsbuild once dev
Compiling ClojureScript.
Compiling "main.js" from ["src"]...
WARNING: Use of undeclared Var foo.baz/quux at line 4 src/foo/bar.cljs
Successfully compiled "main.js" in 3.969 seconds.

(In other words, the issue at the core of this ticket only happens if and only if you upgrade to the most recent ClojureScript and fail to also upgrade to the required Clojure dep.)

Comment by David Nolen [ 23/Apr/15 12:04 AM ]

Doing this isn't in scope. All the current tools have good support for detecting such issues and the new uberjar for people exploring ClojureScript for the first time doesn't have this problem.





[CLJS-1214] :arglists meta has needless quoting Created: 21/Apr/15  Updated: 01/May/15  Resolved: 01/May/15

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

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


 Comments   
Comment by David Nolen [ 01/May/15 11:00 AM ]

(-> #'first meta :arglists)

=>

(quote ([coll]))
Comment by David Nolen [ 01/May/15 2:45 PM ]

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





[CLJS-1213] cljs.analyzer incorrectly marks all defs as tests when eliding test metadata Created: 20/Apr/15  Updated: 26/Apr/15  Resolved: 26/Apr/15

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

Type: Defect Priority: Minor
Reporter: Stephen Nelson Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None


 Description   

https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/analyzer.clj#L861

Cond threading will unconditionally assoc :test true when eliding test metadata for a namespace def.

This prevents accurate detection of test vars in cljs macros.



 Comments   
Comment by David Nolen [ 26/Apr/15 6:07 AM ]

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





[CLJS-1212] Error in set ctor for > 8-entry map literal Created: 18/Apr/15  Updated: 01/May/15  Resolved: 01/May/15

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

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


 Description   
orion:Desktop mfikes$ java -jar cljs.jar -m cljs.repl.nashorn
To quit, type: :cljs/quit
cljs.user=> *clojurescript-version*
"0.0-3208"
cljs.user=> (set {:a 0 :b 0 :c 0 :d 0 :e 0 :f 0 :g 0 :h 0})             
#{[:a 0] [:b 0] [:c 0] [:d 0] [:e 0] [:f 0] [:g 0] [:h 0]}
cljs.user=> (set {:a 0 :b 0 :c 0 :d 0 :e 0 :f 0 :g 0 :h 0 :i 0})
TypeError: Cannot call undefined
	 cljs$core$set (.cljs_nashorn_repl/cljs/core.cljs:7912:11)
	 (NO_SOURCE_FILE <eval>:1:0)
	 (NO_SOURCE_FILE <eval>:1:0)
	 (NO_SOURCE_FILE <eval>:1:0)

This doesn't appear to be a recent regression (it is reproducible for versions from several months ago).



 Comments   
Comment by David Nolen [ 18/Apr/15 9:51 AM ]

It appears NodeSeq does not implement INext. We should probably have a fast path for INext implementors and something simpler for everyone else.

Comment by David Nolen [ 01/May/15 9:07 AM ]

fixed https://github.com/clojure/clojurescript/commit/41207811f3e72748ddf51c21ab3b5359c287960c

Comment by Mike Fikes [ 01/May/15 10:11 AM ]

Confirmed fixed.





[CLJS-1211] Automatically requiring :main namespace under :none fails in IE9 Created: 17/Apr/15  Updated: 17/Apr/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3058, 0.0-3115, 0.0-3196, 0.0-3117, 0.0-3119, 0.0-3123, 0.0-3126
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Immo Heikkinen Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Internet Explorer 9



 Description   

Automatic goog/base.js inclusion using :none & :main doesn't work in Internet Explorer 9. The following error message is printed to the console:

ClojureScript could not load :main, did you forget to specify :asset-path?

There seems to be a timing issue after writing script tags to the HTML document. Inline JavaScript for requiring the main namespace gets executed while goog is still undefined.

I played a bit with this but couldn't get it working in IE9. I tried moving the require statement to a separate JS file and adding a script tag to load that file, then goog was no longer undefined but I still got an error message:

SCRIPT5022: Undefined nameToPath for goog.string
base.js, line 753 character 9

The feature seems to work fine in other browsers (also IE10). Probably not worth fixing but at least the limitation is documented now in case someone else wonders the why it doesn't work in IE9.






[CLJS-1210] Javascript built-in arguments replaces nil arguments locally defined by let Created: 16/Apr/15  Updated: 17/Apr/15

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

Type: Defect Priority: Minor
Reporter: Darrick Wiebe Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Environment:

NodeJs 0.12.2 on OSX. Using lein cljsbuild project generated with mies template



 Description   

I encountered this using cljs.tools.cli/parse-opts which returns a map that may contain an arguments key. It is easy to work around by avoiding destructuring, but could lead to some very confusing bugs.

(deftest arguments-error
  (let [{:keys [arguments]} {}
        arguments (or arguments [])]
    (is (= [] arguments))))





[CLJS-1209] Reduce produces additional final nil when used w/ eduction Created: 16/Apr/15  Updated: 10/May/15  Resolved: 10/May/15

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

Type: Defect Priority: Major
Reporter: Karsten Schmidt Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: transducers


 Description   
Unable to find source-code formatter for language: clojure. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
(defn my-conj
  [acc x]
  (prn acc x)
  (conj acc x))

(reduce my-conj [] (eduction (map identity) [1 2 3]))
;; [] 1
;; [1] 2
;; [1 2] 3
;; [1 2 3] nil
;; [1 2 3 nil]

This seems to be a CLJS specific issue - the above works fine in CLJ1.7.0-beta1. On the other hand, reductions too doesn't suffer this behavior (in CLJS):

Unable to find source-code formatter for language: clojure. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
(reductions my-conj [] (eduction (map identity) [1 2 3]))
;; [] 1
;; [1] 2
;; [1 2] 3
;; ([] [1] [1 2] [1 2 3])


 Comments   
Comment by David Nolen [ 10/May/15 2:30 PM ]

I cannot reproduce with 0.0-3269. Please feel free to reopen if more information can be supplied.

Comment by Karsten Schmidt [ 10/May/15 4:44 PM ]

I don't know, David - don't understand how this can be, since I just tried the same w/ 3269 and the extra `nil` still is happening (I first did use a clean setup as described in CLJS quickstart wiki). The below is from a figwheel REPL:

cljs.user=> *clojurescript-version*
"0.0-3269"

cljs.user=> (defn my-conj [acc x] (prn acc x) (conj acc x))
#<function cljs$user$my_conj(acc,x){
cljs.core.prn.call(null,acc,x);
return cljs.core.conj.call(null,acc,x);
}>

cljs.user=> (reduce my-conj [] (eduction (map identity) [1 2 3]))
[] 1
[1] 2
[1 2] 3
[1 2 3] nil
[1 2 3 nil]
Comment by Karsten Schmidt [ 10/May/15 4:47 PM ]

verified to still occur w/ 0.0-3269

Comment by Karsten Schmidt [ 10/May/15 4:49 PM ]

I you want, I can attach a zip of my test project...

Comment by David Nolen [ 10/May/15 5:10 PM ]

I wasn't quite careful enough when trying out your failing example. I see the problem, fix coming.

Comment by David Nolen [ 10/May/15 5:14 PM ]

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





[CLJS-1208] local deps.cljs should take precedence over upstream libs when containing the same :provides Created: 15/Apr/15  Updated: 16/Apr/15  Resolved: 16/Apr/15

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

Type: Defect Priority: Minor
Reporter: Kevin Webster Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: None

Attachments: Text File rabidpraxis-reversed-deps.patch    
Patch: Code

 Description   

Creating a deps.cljs in attempt to override :foreign-libs from an upstream dependency (ex. cljsjs) does not work when the :provides are the same.

https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/closure.clj#L1251

It looks as though getResources returns a sequence of deps.cljs where the upstream versions are ordered at the end of the seq. Because of this, when this gets built into the index, the upstream version always takes precedence.

Reversing the sequence seems to fix the problem.



 Comments   
Comment by David Nolen [ 16/Apr/15 1:53 PM ]

This is not how overriding works, overriding is done by supplying overrides via compiler options.





[CLJS-1207] Emit a warning if multiple resources found for a ClojureScript namespace Created: 15/Apr/15  Updated: 10/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

Type: Enhancement Priority: Major
Reporter: David Nolen Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

We should emit a simple warning if a namespace doesn't not appear to be unique on the classpath.






[CLJS-1206] Images in HTML don't show up when served from localhost:9000 Created: 15/Apr/15  Updated: 20/May/15  Resolved: 20/May/15

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

Type: Defect Priority: Minor
Reporter: J David Eisenberg Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: brepl, bug
Environment:

Fedora core 21, java version "1.8.0_40" Java(TM) SE Runtime Environment (build 1.8.0_40-b26) Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)


Attachments: Text File cljs_1206.patch     Text File cljs_1206_v2.patch     File imgtest_files.tgz    
Patch: Code

 Description   

In a project built from latest version of mies (from github), put an img element in the index.html page. When running scripts/brepl and loading http://localhost:9000, the image does not appear and the console gives a 404 error (see screenshot in attached tarball). The image shows up fine when loading the index.html as a plain file:/// in the browser, so the image definitely does exist in the correct directory.

I think the problem is in file src/clj/cljs/repl/browser.clj, the code starting server/dispatch-on; it lacks options for paths ending in .jpg and .png

I've included a diff -u file in the tarball as well with a possible patch. The patch also adds .svg as a valid type of file to serve, which was the particular thing I needed when I first saw this problem.



 Comments   
Comment by David Nolen [ 15/Apr/15 8:47 AM ]

Please attach patches directly, thanks!

Comment by J David Eisenberg [ 15/Apr/15 10:12 AM ]

Not sure what the format for a patch is, nor where it should be attached. (Add another attachment with the diff file?) Also, I think I see why the image doesn't appear -somewhere in the input or output process, the binary data is being converted to UTF-8.

Comment by Francis Avila [ 15/Apr/15 10:47 AM ]

Patch instructions. Add patch file as independent attachment to this ticket.

Before your code can be accepted you must sign a contributor's agreement.

Comment by J David Eisenberg [ 15/Apr/15 7:04 PM ]

Patch that allows server to correctly serve PNG, JPG, and SVG files. Patch uses maps to store data about MIME types and encoding, so other file extensions and types can be added easily if necessary.

Comment by Sander Dijkhuis [ 05/May/15 1:50 AM ]

Related / same issue:
http://dev.clojure.org/jira/browse/CLJS-1124

Comment by David Nolen [ 14/May/15 9:35 PM ]

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

Comment by kovas boguta [ 20/May/15 2:50 PM ]

New patch.

Comment by David Nolen [ 20/May/15 3:01 PM ]

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

Comment by J David Eisenberg [ 20/May/15 3:47 PM ]

Why no love for SVG? It's part of HTML5, and is used to a fair extent in the "real world."

Comment by David Nolen [ 20/May/15 4:24 PM ]

We just have to draw the line somewhere. browser REPL is not a replacement for a real web server.





[CLJS-1205] Support conditional reading in REPLs Created: 14/Apr/15  Updated: 14/Apr/15  Resolved: 14/Apr/15

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

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


 Description   

Same as CLJ-1700



 Comments   
Comment by David Nolen [ 14/Apr/15 6:33 PM ]

fixed https://github.com/clojure/clojurescript/commit/78c882f1f61023c0b0a75b87bd8e8bcb7058ed04





[CLJS-1204] cljs.closure/watch cannot take cljs.closure/Compilable Created: 14/Apr/15  Updated: 14/Apr/15  Resolved: 14/Apr/15

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

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


 Description   

Blocker for exporting an official cljs.build.api/watch.



 Comments   
Comment by David Nolen [ 14/Apr/15 6:10 PM ]

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





[CLJS-1203] official way to supply multiple files/directories to cljs.closure/build and cljs.closure/watch Created: 14/Apr/15  Updated: 14/Apr/15  Resolved: 14/Apr/15

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

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


 Comments   
Comment by David Nolen [ 14/Apr/15 9:02 AM ]

https://github.com/clojure/clojurescript/commit/5353489fe3beda9a6e9d044e89da3bd0d2accce7





[CLJS-1202] load-file is not additive, unmaps the namespace Created: 14/Apr/15  Updated: 14/Apr/15  Resolved: 14/Apr/15

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

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


 Comments   
Comment by David Nolen [ 14/Apr/15 7:23 AM ]

fixed https://github.com/clojure/clojurescript/commit/53780c6e0aaf68e8c687ebb666cf2d4092ba136f





[CLJS-1201] compare-indexed: improper handling of empty indexed collections Created: 14/Apr/15  Updated: 14/Apr/15  Resolved: 14/Apr/15

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

Type: Defect Priority: Major
Reporter: Nikita Prokopov Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File cljs-1201-empty-vectors-throw-on-compare.patch    

 Description   
(compare (into [] '()) [])
(compare (vec #js[]) [])
(compare (with-meta [] {}) [])
(compare (pop [1]) [])
(compare (subvec [1] 0 0) (subvec [1] 0 0))

all throw #<Error: No item 0 in vector of length 0>

(compare [] []) only passes because they're considered identical?
(-compare [] []) throws too



 Comments   
Comment by David Nolen [ 14/Apr/15 7:18 AM ]

This is a dupe of CLJS-1200. Prefer a patch that simply covers all cases not individual problems.

Comment by Nikita Prokopov [ 14/Apr/15 7:33 AM ]

No, it is not a dupe. CLJS-1200 is a conceptual thing: should compare compare objects of different types? It’s a language-level decision. E.g. Clojure’s compare does not. We can discuss it for months.

This one is an actual bug in compare-indexed. A zero-index access inside empty collection. Missed codepath, real exception.

Please fix this one as it affects our production code.

Comment by David Nolen [ 14/Apr/15 7:55 AM ]

Nikita, accurate ticket titles help when assessing the intent of patches. I understand the issue now.

Comment by David Nolen [ 14/Apr/15 7:59 AM ]

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

Comment by Nikita Prokopov [ 14/Apr/15 8:00 AM ]

Oh, you probably thought that I’m comparing PersistentVector to Subvec. Sorry, didn’t want to confuse you





[CLJS-1200] compare behaves differently from Clojure Created: 13/Apr/15  Updated: 10/May/15

Status: In Progress
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

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


 Description   
(compare [:foo 1] [:foo "one"])

Fails, also array-map & hash-map apparently cannot compare.






[CLJS-1199] array-map can reuse skipped elements of IndexedSeq Created: 13/Apr/15  Updated: 13/Apr/15  Resolved: 13/Apr/15

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

Type: Defect Priority: Major
Reporter: Nikita Prokopov Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File cljs-1199.patch    

 Description   
(let [x (drop 1 [0 :a 1 :b 2])]
  (apply array-map x))

Expected:

{:a 1, :b 2}

Got:

{0 :a, 1 :b, 2 nil}

Broken by this commit: https://github.com/clojure/clojurescript/commit/815dde62ef06e591444d5deec8f2425890f57a1f

(defn array-map
  "keyval => key val
  Returns a new array map with supplied mappings."
  [& keyvals]
  (let [arr (if (instance? IndexedSeq keyvals)
              (.-arr keyvals)
              (into-array keyvals))]
    (.fromArray cljs.core/PersistentArrayMap arr true false)))

This code should also check for (zero? (.-i keyvals))



 Comments   
Comment by David Nolen [ 13/Apr/15 8:37 AM ]

fixed https://github.com/clojure/clojurescript/commit/0c0602ac25a4092e0d3fbc53b5a7ff0479307307





[CLJS-1198] cljs.test may report summary before all async tests complete Created: 12/Apr/15  Updated: 11/May/15  Resolved: 05/May/15

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

Type: Defect Priority: Major
Reporter: Jenan Wise Assignee: David Nolen
Resolution: Completed Votes: 1
Labels: None

Attachments: File cljs-1198-1    

 Description   

cljs.test may report summary before all async tests complete.

E.g, if you have an async test that looks like this:

(deftest a-test
  (async done
         (testing "a slow async test"
           (go
             (<! (timeout 1000))
             (is (= 0 1))
             (done)))))

then the report output may look like this:

Ran 1 tests containing 0 assertions.
0 failures, 0 errors.

<1 second elapses>

FAIL in () (cljs_test_with_slow_async_example/core_test.js:201:49)
expected: (= 0 1)
  actual: (not (= 0 1))

Minimal repo: https://github.com/jenanwise/cljs-test-with-slow-async-example



 Comments   
Comment by Leon Grapenthin [ 15/Apr/15 12:28 PM ]

I am quite surre that the problem has been introduced with this commit: https://github.com/clojure/clojurescript/commit/9bf486b22cebf5aba4154d07f3ad52e990ddc305

@David
I don't understand the intent of the commit message "cljs.test needs to default to sync, remove broken validation"

Why should the execution strategy default to :sync?

From my reading of the commit this would imply that, unless one provides map fixtures, tests are executed without support for async testing.

This is what happens. The problem goes away if I one adds e. g.

(use-fixtures :each {:before (fn [_])
:after (fn [_])})

I don't see why you removed the guard around async tests in the :sync execution. Its purpose was to throw when execution strategy is :sync an and async test is encountered.

If you can help with the intent of your commit, I'd be glad to provide the fix for myself. What validation was broken?

Comment by David Nolen [ 15/Apr/15 1:41 PM ]

Leon, when I changed how top-level fn emission worked for cross module code motion even though I could see good code getting generated I couldn't run the tests because of the validation bit. After poking around I couldn't make heads or tails of the invariant the code was trying to maintain and so I removed it. All the tests started working again.

Happy to see the invariants re-introduced if the code more clearly documents intent so I can understand it

Comment by Leon Grapenthin [ 15/Apr/15 2:26 PM ]

Can you specify on what you mean by the invariant?

Comment by David Nolen [ 15/Apr/15 2:28 PM ]

Leon, I have no idea what the check was doing nor why it was done that way, only that it prevented me from successfully running more important tests. So you will have to explain the approach to me

Comment by Leon Grapenthin [ 16/Apr/15 2:51 PM ]

Here I try to give you a quick overview of what is going on in the code you have removed/altered:

It solved the problem brought up in our discussion regarding the CLJS-988: The style in which clojure.test requires fixtures to be written didn't allow one to determine when an async test is over. Hence you came up with this requirement: http://dev.clojure.org/jira/browse/CLJS-988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#issue-tabs

This is the way I have chosen to implement it:

In test-vars-block we create a block that looks up fixtures in the current env and decides whether to support async testing via execution-strategy.

In any case except for wrapped fixtures we run with support for async testing by executing the provided test functions in a block so that they can return async tests which are then picked up by the block runner. Also, via test-var-block additional code is wrapped around and added after them for reporting purposes.

In the case where wrapped fixtures are provided, we can't just create a test-var-block in the same fashion because flow control is passed to the wrapping fixtures and they don't execute or return a block. The only way work around this is to provide them directly with a function that invokes a nested block runner. Implicitly reusing test-var-block here was a decision made for obvious DRY reasons.

Now if async tests are used in the test function, the nested block runner could return before testing is finished, continuing testing too early. This is why the execution strategy is called sync: It expects the nested block runners to finish synchronously.

Per your requirment, testing should be aborted if an async test is encountered in the latter case. We can only know whether a test is async once it has been called and returned something. I didn't see a way to find out what was returned in the :sync result-expr directly, since test-var doesn't return what the test has returned. Hence I picked to look at what the test has returned in the test-var-block and throw if an async test is returned and async tests are disabled, storing this condition in the test-env. Today I see a strong alternative to that: Directly wrap the :test fn in the var in the :sync result-expr to throw if it returns an async test. It surely seems cleaner. You'd get a true invariant because the test-env would be out of the game. Notice though that anyhting thrown there will be catched by the reporting exception handler in test-var-block and testing would continue, so it has to rethrow to truely abort testing. Directly looking up the test-env in the async macro would have been another alternative which I have discarded for its dirtiness because it requires users to invoke async during testing to work.

I hope this helped you to understand the code. To make the code more understandable one could rename execution-strategy to async-supported? and return a boolean.

In any case, the :async execution-strategy needs to be the default, otherwise returned async test objects are not expanded into the root block and this CLJS-1198 happens.

I can provide a patch with the aforementioned improvements on sunday if you like. Finally I have no idea why the check prevented your tests from running - Can you tell me which tests I can use to potentially reproduce the problem?

Comment by Leon Grapenthin [ 19/Apr/15 8:32 AM ]

Patch notes:

  • changes default execution-strategy back to :async
  • prevents async tests from running when execution-strategy is sync

@David: I had to dissect test-var-block a bit because apparently alter-meta! is broken for vars. Please see commented lines 549 and 552 - Also I couldn't check whether this resolves the issue you had with tests being prevented from running after the compiler changes.

Comment by Sebastian Bensusan [ 01/May/15 3:36 PM ]

Experience report: tested this patch with the problematic repo and some other slow async test cases including fixture variations and it seems to work as expected. It also worked with ClojureScript's own tests (tested on all platforms but JavaScriptCore).

Hope this helps.

Comment by David Nolen [ 05/May/15 6:58 AM ]

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

Comment by Jenan Wise [ 11/May/15 12:31 PM ]

Many thanks!





[CLJS-1197] load-file does not reload associated macro namespace Created: 12/Apr/15  Updated: 12/Apr/15  Resolved: 12/Apr/15

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

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


 Description   

In the case of a ns with a accompanying macros ns of the same name we should reload the macro namespace when using load-file.



 Comments   
Comment by David Nolen [ 12/Apr/15 5:51 PM ]

fixed https://github.com/clojure/clojurescript/commit/3cf142cdfe83b7ce59fcbbe5e0e721f3176123df





[CLJS-1196] Assert failed on 3190+ while :require-ing .js file in :libs directory Created: 12/Apr/15  Updated: 09/May/15  Resolved: 09/May/15

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

Type: Defect Priority: Major
Reporter: Michal Till Assignee: David Nolen
Resolution: Completed Votes: 4
Labels: None
Environment:

OSX, jre 1.8.0_05-b13, Clojure 1.7.0-beta1



 Description   

While :require-ing a GC-compatible .js file that is in one of the :libs directories I get a failed assertion. I tried to hunt it down but wasn't successful.

My setup is:

  • :libs ["libs"] in project.clj
  • test.js in libs/test.js with a proper declaration goog.provide("app.test") at the first line
  • [app.test :as test] in one of the app ns header

This happens specifically from 0.0-3190 and newer, it does NOT happen in 0.0-3178.

Exception in thread "main" java.lang.AssertionError: Assert failed: (or (file? x) (url? x) (string? x)), compiling/private/var/folders/ym/l2qxd7l97kzfzftrdpqsclm40000gn/T/form-init5482203094887638175.clj:1:125)
at clojure.lang.Compiler.load(Compiler.java:7249)
at clojure.lang.Compiler.loadFile(Compiler.java:7175)
at clojure.main$load_script.invoke(main.clj:275)
at clojure.main$init_opt.invoke(main.clj:280)
at clojure.main$initialize.invoke(main.clj:308)
at clojure.main$null_opt.invoke(main.clj:343)
at clojure.main$main.doInvoke(main.clj:421)
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.AssertionError: Assert failed: (or (file? x) (url? x) (string? x))
at cljs.util$ext.invoke(util.clj:114)
at cljs.closure$source_on_disk.invoke(closure.clj:1172)
at cljs.closure$output_unoptimized$fn__3624.invoke(closure.clj:1201)
at clojure.core$map$fn__4532.invoke(core.clj:2622)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.RT.seq(RT.java:507)
at clojure.core$seq__4107.invoke(core.clj:135)
at clojure.core$filter$fn__4559.invoke(core.clj:2677)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.RT.seq(RT.java:507)
at clojure.core$seq__4107.invoke(core.clj:135)
at clojure.core$map$fn__4532.invoke(core.clj:2614)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.Cons.next(Cons.java:39)
at clojure.lang.RT.next(RT.java:674)
at clojure.core$next__4091.invoke(core.clj:64)
at clojure.core$str$fn__4167.invoke(core.clj:528)
at clojure.core$str.doInvoke(core.clj:526)
at clojure.lang.RestFn.applyTo(RestFn.java:139)
at clojure.core$apply.invoke(core.clj:628)
at cljs.closure$deps_file.invoke(closure.clj:1015)
at cljs.closure$output_deps_file.invoke(closure.clj:1035)
at cljs.closure$output_unoptimized.doInvoke(closure.clj:1215)
at clojure.lang.RestFn.applyTo(RestFn.java:139)
at clojure.core$apply.invoke(core.clj:630)
at cljs.closure$build.invoke(closure.clj:1480)
at cljs.closure$build.invoke(closure.clj:1392)
at cljsbuild.compiler$compile_cljs$fn__3791.invoke(compiler.clj:81)
at cljsbuild.compiler$compile_cljs.invoke(compiler.clj:80)
at cljsbuild.compiler$run_compiler.invoke(compiler.clj:180)
at user$eval3923$iter_39593963$fn3964$fn_3982.invoke(form-init5482203094887638175.clj:1)
at user$eval3923$iter_39593963$fn_3964.invoke(form-init5482203094887638175.clj:1)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.RT.seq(RT.java:507)
at clojure.core$seq__4107.invoke(core.clj:135)
at clojure.core$dorun.invoke(core.clj:3007)
at clojure.core$doall.invoke(core.clj:3023)
at user$eval3923.invoke(form-init5482203094887638175.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6792)
at clojure.lang.Compiler.eval(Compiler.java:6782)
at clojure.lang.Compiler.load(Compiler.java:7237)
... 11 more



 Comments   
Comment by David Nolen [ 09/May/15 12:46 PM ]

fixed https://github.com/clojure/clojurescript/commit/159fad2df02efd869842076fef22b51de3a6c085





[CLJS-1195] generic reusable command line argument parsing for REPLs Created: 10/Apr/15  Updated: 10/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

Type: Enhancement Priority: Minor
Reporter: David Nolen Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: newbie


 Description   

REPLs are more or less started in the same way and all the builtin ones provide a -main entry point. We should supply reusable command line argument parsing that any REPL can use to get standard command line driven start.






[CLJS-1194] data_readers.cljc Created: 10/Apr/15  Updated: 19/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

Type: Enhancement Priority: Major
Reporter: David Nolen Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Now that conditional reading has landed we can implement support for data_readers.cljc to get both compile time and runtime support.



 Comments   
Comment by David Nolen [ 10/Apr/15 7:45 PM ]

This needs http://dev.clojure.org/jira/browse/CLJ-1699 to be useful.

Comment by Nikita Prokopov [ 19/May/15 7:58 AM ]

CLJ-1699 has landed.

Right now CLJS tries to compile data_readers.cljc as a regular source code file:

Exception in thread "main" java.lang.AssertionError: No ns form found in src/data_readers.cljc, compiling:(/private/var/folders/0h/9vv4g3d955l6ctwwl4k9xjy40000gn/T/form-init3533791126017861878.clj:1:125)
	at clojure.lang.Compiler.load(Compiler.java:7249)
	at clojure.lang.Compiler.loadFile(Compiler.java:7175)
	at clojure.main$load_script.invoke(main.clj:275)
	at clojure.main$init_opt.invoke(main.clj:280)
	at clojure.main$initialize.invoke(main.clj:308)
	at clojure.main$null_opt.invoke(main.clj:343)
	at clojure.main$main.doInvoke(main.clj:421)
	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)
Comment by David Nolen [ 19/May/15 8:53 AM ]

This should be addressed first: http://dev.clojure.org/jira/browse/CLJS-1277





[CLJS-1193] recompile dependents fails to work when not auto-building Created: 10/Apr/15  Updated: 10/Apr/15  Resolved: 10/Apr/15

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

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


 Comments   
Comment by David Nolen [ 10/Apr/15 8:52 AM ]

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





[CLJS-1192] cljs.repl.node mistakenly depends upon JDK8 API Created: 08/Apr/15  Updated: 08/Apr/15  Resolved: 08/Apr/15

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

Type: Defect Priority: Major
Reporter: Chas Emerick Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: File CLJS-1192.diff    
Patch: Code

 Description   

The errant patch was associated with CLJS-1176.



 Comments   
Comment by David Nolen [ 08/Apr/15 11:44 AM ]

fixed https://github.com/clojure/clojurescript/commit/689ed7db5507fd3a10285f88086f8a379f55bbe6





[CLJS-1191] Update clojure.walk to the current version on clojure Created: 06/Apr/15  Updated: 10/May/15

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

Type: Defect Priority: Minor
Reporter: Stuart Mitchell Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: enhancement, performance

Attachments: Text File 50.patch     Text File CLJS-1191.patch    
Patch: Code

 Description   

Currently clojure.walk can not handle records

It is using an old version of clojure.walk and clojure has improved the implementation because of

http://dev.clojure.org/jira/browse/CLJ-1105


src/cljs/clojure/walk.cljs | 4 ++++
1 file changed, 4 insertions

diff --git a/src/cljs/clojure/walk.cljs b/src/cljs/clojure/walk.cljs
index f2ebd8d..541ecea 100644
— a/src/cljs/clojure/walk.cljs
+++ b/src/cljs/clojure/walk.cljs
@@ -43,7 +43,11 @@ the sorting function."}
{:added "1.1"}
[inner outer form]
(cond
+ (list? form) (outer (apply list (map inner form)))
+ (satisfies? IMapEntry form) (outer (vec (map inner form)))
(seq? form) (outer (doall (map inner form)))
+ (satisfies? IRecord form)
+ (outer (reduce (fn [r x] (conj r (inner x))) form form))
(coll? form) (outer (into (empty form) (map inner form)))
:else (outer form)))



 Comments   
Comment by David Nolen [ 07/Apr/15 5:56 AM ]

Please attach the patch as a file. Thanks!

Comment by Stuart Mitchell [ 07/Apr/15 7:18 PM ]

I think this one works

it is a mail formatted patch

Comment by David Nolen [ 08/Apr/15 6:07 AM ]

Please follow the patch conventions described here https://github.com/clojure/clojurescript/wiki/Patches. Thank you.

Comment by David Nolen [ 12/Apr/15 4:53 PM ]

Stuart, I don't see you on the list of contributors. Please submit a CA so I can apply the patch. Thanks!

Comment by Stuart Mitchell [ 13/Apr/15 7:49 PM ]

Hopefully this is the right format

Comment by Stuart Mitchell [ 13/Apr/15 7:50 PM ]

Contributor agreement signed as well

Comment by Sebastian Bensusan [ 01/May/15 1:24 PM ]

Tested the patch on the REPL, works as expected except for walking fns that modify the keys:

> (defrecord Foo [name])
cljs.user/Foo
> (w/prewalk #(if (keyword? %) (str %) %) (Foo. "foo"))
#cljs.user.Foo{:name "foo", ":name" "foo"}

It is not consistent with walking the same fn over a map:

> (w/prewalk #(if (keyword? %) (str %) %) {:name "foo"})

{":name" "foo"}

This behavior was noted in the original Clojure patch as well: http://dev.clojure.org/jira/browse/CLJ-1239 and might be undesirable since it surprises the user.





[CLJS-1190] definterface support Created: 03/Apr/15  Updated: 29/Apr/15

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

Type: Enhancement Priority: Minor
Reporter: David Nolen Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

A interop thing for JSDoc using JavaScript libraries, but also a potential Clojure interop thing. We can generate an empty object + methods that includes JSDoc @interface annotation.






[CLJS-1189] array-map will return PersistentHashMap if applied to more than (.-HASHMAP-THRESHOLD PersistentArrayMap) pairs Created: 03/Apr/15  Updated: 10/Apr/15  Resolved: 03/Apr/15

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

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


 Description   

cljs.user=> (type (apply array-map [1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0]))
cljs.core/PersistentArrayMap
cljs.user=> (type (apply array-map [1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 10 0]))
cljs.core/PersistentHashMap



 Comments   
Comment by David Nolen [ 03/Apr/15 5:22 PM ]

fixed https://github.com/clojure/clojurescript/commit/815dde62ef06e591444d5deec8f2425890f57a1f

Comment by Mike Fikes [ 03/Apr/15 5:30 PM ]

Confirmed fixed.

Comment by Michał Marczyk [ 10/Apr/15 7:31 PM ]

array-map actually should always return array maps – it does so in Clojure and this is documented as desired behaviour in the docstring (which promises to return an array map) and on the Data Structures page on clojure.org:

http://clojure.org/data_structures

ArrayMaps
When doing code form manipulation it is often desirable to have a map which maintains key order. An array map is such a map - it is simply implemented as an array of key val key val... As such, it has linear lookup performance, and is only suitable for very small maps. It implements the full map interface. New ArrayMaps can be created with the array-map function. Note that an array map will only maintain sort order when un-'modified'. Subsequent assoc-ing will eventually cause it to 'become' a hash-map.

Clojure keeps the above promise:

Clojure 1.7.0-beta1
user=> (class (apply array-map (range 1000)))
clojure.lang.PersistentArrayMap

See also CLJS-873 (with my patch to make non-higher-order calls to array-map return array maps) and CLJS-872 (tangentially related).





[CLJS-1188] multi-arity fns hinder cross-module code motion Created: 03/Apr/15  Updated: 07/Apr/15  Resolved: 06/Apr/15

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

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

Attachments: Text File CLJS-1188.patch    

 Description   

Google Closure compiler will not move multi-arity ClojureScript functions as they are constructed via a function invoke.



 Comments   
Comment by David Nolen [ 03/Apr/15 7:14 PM ]

Experimented with lazy loading top-level multi-arity fns (which also required eliminating all existing invoke optimization) and confirmed that multi-arity fns in their current form defeat code motion. With working code motion the results can be quite dramatic, in the case of the Mori it shrinks the base module to about 25K.

Comment by David Nolen [ 03/Apr/15 7:35 PM ]

Lazy loading is not the way to do it as it cannot be reconciled without our other optimizations. We should treat top-level multi-arity fns as a special case. There is now a code-motion branch where this exploration is underway.

Comment by David Nolen [ 04/Apr/15 1:38 PM ]

In the code-motion branch currently explores doing this at the macro level. Doing this at the macro level avoids further complications to def and fn analyzer cases which are already the two of most complicated bits of the analyzer outside of ns. Doing this at the macro level does introduce its own issues - we have to replicate the implementation specific code generation bits handled by the compiler emission around multi-arity fns (the dispatcher), and the variadic fns (the argument wrangling, and runtime metadata). Another complication is that the compiler sees an fn var which takes no arguments. We will need to hack around this by collecting this information passing it along on the fn form.

Comment by David Nolen [ 06/Apr/15 6:30 PM ]

fixed https://github.com/clojure/clojurescript/commit/576fb6e054dd50ec458a3c9e4172a5a0002c7aea

Comment by Thomas Heller [ 07/Apr/15 4:48 AM ]

Nice work! Not seeing much in terms of movement between modules but my main module goes from 98KB to 91KB (gzip'd) due to extra removable code.

Comment by David Nolen [ 07/Apr/15 5:53 AM ]

Thomas that's great to hear. As another datapoint, for Mori the difference is about a 30-35% reduction of the base module.





[CLJS-1187] var ast contains internal nodes with bad analysis :context Created: 02/Apr/15  Updated: 03/Apr/15  Resolved: 03/Apr/15

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

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


 Description   
(defn foo [] (print "foo!"))
 
(defn bar [] (print "bar!"))
 
(defn print-foo [fb]
  (apply 
    (case fb
      :foo #'foo
      :bar #'bar) []))


 Comments   
Comment by David Nolen [ 03/Apr/15 5:50 AM ]

fixed https://github.com/clojure/clojurescript/commit/49ed83337baf762ef21a907be234ebdbcc105d66





[CLJS-1186] add :postamble option to compiler Created: 02/Apr/15  Updated: 02/Apr/15

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

Type: Enhancement Priority: Minor
Reporter: Michael Bradley Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: cljs

Attachments: Text File cljs_1186.patch    

 Description   

Similar to CLJS-723:

1) :postamble's value will be a vector of paths
2) the compiled output is appended with the contents of the files at those paths
3) the generated source map points to the correct/adjusted line numbers






[CLJS-1185] Support preambles when our target is node.js and we are compiler a main file Created: 02/Apr/15  Updated: 02/Apr/15

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

Type: Enhancement Priority: Trivial
Reporter: Ivan Willig Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Text File CLJS-1185.patch    




[CLJS-1184] log module building activity under verbose Created: 02/Apr/15  Updated: 03/Apr/15  Resolved: 03/Apr/15

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

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


 Description   

Log how modules are constructed to support user reports as well as development.



 Comments   
Comment by David Nolen [ 03/Apr/15 7:25 AM ]

fixed https://github.com/clojure/clojurescript/commit/343573f5bf748aec6943d71e85e9c9a36dcfb529





[CLJS-1183] load-file doesn't copy source to output directory Created: 01/Apr/15  Updated: 01/Apr/15  Resolved: 01/Apr/15

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

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

0.0-3169 QuickStart Browser REPL with watch commented out, OS X, Chrome



 Description   

If you invoke load-file for a path like "src/foo/bar.cljs", compiler output for the file is placed in "out/foo", but the source "bar.cljs" file is not copied. This results in java.io.FileNotFoundException: /Users/mfikes/Desktop/hello_world/out/foo/bar.cljs if source mapping of exception stacktraces needs to access the file.

To repro:
1. Use 0.0-3169 in QuickStart.
2. Set up Browser REPL following QuickStart, but comment out :watch.
3. Connect and ensure REPL is working.
4. Add "src/foo/bar.cljs" with contents below (a fn that will throw).
5. Do (load-file "src/foo/bar.cljs")
6. Call the fn: (foo.bar/call-me)
7. Observe attempt to read source in out when processing stacktrace.

cljs.user=> (foo.bar/call-me)
Error: 1 is not ISeqable
Exception in thread "main" java.io.FileNotFoundException: /Users/mfikes/Desktop/hello_world/out/foo/bar.cljs (No such file or directory), compiling:(/Users/mfikes/Desktop/hello_world/repl.clj:8:19)
	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$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)
Caused by: java.io.FileNotFoundException: /Users/mfikes/Desktop/hello_world/out/foo/bar.cljs (No such file or directory)
	at java.io.FileInputStream.open0(Native Method)
	at java.io.FileInputStream.open(FileInputStream.java:195)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at clojure.java.io$fn__8702.invoke(io.clj:229)
	at clojure.java.io$fn__8615$G__8606__8622.invoke(io.clj:69)
	at clojure.java.io$fn__8676.invoke(io.clj:165)
	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$parse_ns$fn__1510.invoke(analyzer.clj:2049)
	at cljs.analyzer$parse_ns.invoke(analyzer.clj:2035)
	at cljs.analyzer$parse_ns.invoke(analyzer.clj:2026)
	at cljs.repl$read_source_map.invoke(repl.clj:218)
	at clojure.core$juxt$fn__4211.invoke(core.clj:2440)
	at cljs.repl$mapped_stacktrace$iter__3903__3907$fn__3908$fn__3909.invoke(repl.clj:287)
	at cljs.repl$mapped_stacktrace$iter__3903__3907$fn__3908.invoke(repl.clj:278)
	at clojure.lang.LazySeq.sval(LazySeq.java:40)
	at clojure.lang.LazySeq.seq(LazySeq.java:49)
	at clojure.lang.RT.seq(RT.java:484)
	at clojure.core$seq.invoke(core.clj:133)
	at clojure.core$map$fn__4245.invoke(core.clj:2551)
	at clojure.lang.LazySeq.sval(LazySeq.java:40)
	at clojure.lang.LazySeq.seq(LazySeq.java:49)
	at clojure.lang.LazySeq.more(LazySeq.java:85)
	at clojure.lang.RT.more(RT.java:607)
	at clojure.core$rest.invoke(core.clj:73)
	at cljs.repl$mapped_stacktrace.invoke(repl.clj:322)
	at cljs.repl$print_mapped_stacktrace.invoke(repl.clj:333)
	at cljs.repl$display_error.invoke(repl.clj:403)
	at cljs.repl$repl_caught.invoke(repl.clj:696)
	at cljs.repl$repl_STAR_$fn__4076$fn__4083.invoke(repl.clj:835)
	at cljs.repl$repl_STAR_$fn__4076.invoke(repl.clj:832)
	at cljs.compiler$with_core_cljs.invoke(compiler.clj:951)
	at cljs.repl$repl_STAR_.invoke(repl.clj:798)
	at cljs.repl$repl.doInvoke(repl.clj:914)
	at clojure.lang.RestFn.invoke(RestFn.java:439)
	at user$eval198.invoke(repl.clj:10)
	at clojure.lang.Compiler.eval(Compiler.java:6703)
	at clojure.lang.Compiler.load(Compiler.java:7130)
	... 9 more

Contents of "src/foo/bar.cljs"

(ns foo.bar)

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

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


 Comments   
Comment by Mike Fikes [ 01/Apr/15 1:41 PM ]

Occurs for me with master (https://github.com/clojure/clojurescript/commit/d12d678d9babb7d9a164e11997f084eeeb378c16)

Comment by David Nolen [ 01/Apr/15 3:22 PM ]

Ah right, this is probably due to the fact that load-file doesn't copy over the original source file into :output-dir which is needed for source mapping to work.

Comment by David Nolen [ 01/Apr/15 5:43 PM ]

fixed https://github.com/clojure/clojurescript/commit/6c446bce4ffe367ad4b32e60f5139f201651bf29

Comment by Mike Fikes [ 01/Apr/15 5:50 PM ]

Confirmed fixed.





[CLJS-1182] semantics of load-file should be require + implicit :reload Created: 01/Apr/15  Updated: 01/Apr/15  Resolved: 01/Apr/15

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

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


 Comments   
Comment by David Nolen [ 01/Apr/15 6:02 AM ]

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





[CLJS-1181] User Defined Tagged literal for integer causes all repls to hang Created: 01/Apr/15  Updated: 29/Apr/15  Resolved: 29/Apr/15

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

Type: Defect Priority: Minor
Reporter: Kuldeep Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: None


 Description   

For a user define tagged literal brepl, rhino repl crash/hang on startup or form evaluation.

; CLJS
(register-tag-parser! 'my/int #(js/parseInt %))

; Clojure
(defn- print-int
  [^Integer i ^java.io.Writer w]
  (.write w (str "#my/int \"" i "\"")))

(defmethod print-method Integer
  [^Integer i ^java.io.Writer w]
  (print-int i w))

(defmethod print-dup Integer
  [^Integer i ^java.io.Writer w]
  (print-int i w))

(defn read-int
  [^String s]
  (Integer. s))

; resources data_readers.clj
; {my/int     myns/read-int}


 Comments   
Comment by David Nolen [ 01/Apr/15 5:57 AM ]

This ticket needs more information. Please include the stacktrace. Thanks.

Comment by Kuldeep [ 29/Apr/15 8:06 AM ]

Hello I would like to close this ticket as I think defining tagged literals for primitives was stupid idea in the first place. Please reopen if you think otherwise.





[CLJS-1180] Cache is read using read-edn, which does not accept all keywords that clojurescript accepts Created: 31/Mar/15  Updated: 01/Apr/15  Resolved: 01/Apr/15

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

Type: Defect Priority: Minor
Reporter: Stephen Nelson Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: None


 Description   

Source that contains keywords such as `:*:` cannot be loaded from the cache because it's not valid edn. The same keyword is accepted by cljsc. Consequently, non-clean builds can fail when they attempt to load from the cache.

This particular keyword is used in hiccup vectors to indicate splicing (e.g. keminglabs/singult).



 Comments   
Comment by David Nolen [ 01/Apr/15 6:07 AM ]

This ticket needs more information - i.e. is this actually considered a valid keyword? Just because something can be read does not mean it's actually valid. According to http://clojure.org/reader, it appears keywords ending with : would be reserved by Clojure.

Comment by Francis Avila [ 01/Apr/15 9:52 AM ]

There are definitely problems with the keyword and symbol lack-of-specs and differences between edn and clojure, but :*: is an unreadable form everywhere.

Probably :*: was created from a string with (keyword ":*:"). So the problem here is really that Clojure will print forms that it and edn can't read back.

I think there was a proposal to have tagged-literal forms for symbols and keywords which are not readable directly, but I can't find a ticket for it. (e.g. print #kw [nil "*:"] instead.)

Related: CLJ-1527 CLJS-677 CLJ-1286

Comment by Stephen Nelson [ 01/Apr/15 4:34 PM ]

minimal reproduction using cljs.jar and the 'Quick Start' instructions.

:*: is a valid keyword in clojurescript, in so far that it's accepted by the cljs reader (without requiring using the keyword constructor). This is demonstrated by the reproduction I've created, the relevant source line is (println :*:). It is not accepted by the edn or clj readers.

The http://clojure.org/reader spec is an inaccurate representation of the syntax actually accepted by various readers. I think the compiler should at least be internally consistent in its behaviour, even if it doesn't follow the spec. I don't think it's reasonable for cljsc to fail when it loads from its cache as this behaviour is hard to diagnose for a user.

Tightening the constraints on keywords in the cljs reader to match edn and/or the clj reader would be an acceptable resolution of this issue.

Comment by David Nolen [ 01/Apr/15 4:43 PM ]

Just verified that this is an unreadable form in Clojure. Please feel free to file an issue with Singult or tools.reader which is what we use to read.





[CLJS-1179] strange load-file behavior Created: 31/Mar/15  Updated: 31/Mar/15  Resolved: 31/Mar/15

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

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


 Description   

As reported by Colin Fleming:

~/d/cljs> cat node_repl.clj 
(require 'cljs.repl)
(require 'cljs.closure)
(require 'cljs.repl.node)

(cljs.closure/build "src"
  {:main 'hello-world.core
   :output-to "out/main.js"
   :verbose true})

(cljs.repl/repl (cljs.repl.node/repl-env)
  :watch "src"
  :output-dir "out")

~/d/cljs> cat src/hello_world/core.cljs 
(ns hello-world.core
  (:require [cljs.nodejs :as nodejs]))

(nodejs/enable-util-print!)

(defn -main [& args]
  (println "Hello world!"))

(set! *main-cli-fn* -main)

(defn foo [a b] (+ a b))

~/d/cljs> rlwrap java -cp cljs.jar:src clojure.main node_repl.clj
Reading analysis cache for jar:file:/Users/colin/dev/cljs/cljs.jar!/cljs/core.cljs
Compiling src/hello_world/core.cljs
Analyzing jar:file:/Users/colin/dev/cljs/cljs.jar!/cljs/nodejs.cljs
Compiling out/cljs/nodejs.cljs
Compiling out/cljs/core.cljs
Using cached cljs.core out/cljs/core.cljs
ClojureScript Node.js REPL server listening on 55907
Watch compilation log available at: out/watch.log
To quit, type: :cljs/quit
cljs.user=> (load-file "/Users/colin/dev/cljs/src/hello_world/core.cljs")
nil
cljs.user=> (hello-world.core/foo 1 2)
repl:13
throw e__3976__auto__;
      ^
TypeError: Cannot read property 'call' of undefined
    at repl:1:109
    at repl:9:3
    at repl:14:4
    at Object.exports.runInThisContext (vm.js:74:17)
    at Domain.<anonymous> ([stdin]:41:34)
    at Domain.run (domain.js:197:16)
    at Socket.<anonymous> ([stdin]:40:25)
    at Socket.emit (events.js:107:17)
    at readableAddChunk (_stream_readable.js:163:16)
    at Socket.Readable.push (_stream_readable.js:126:10)
cljs.user=> (require '[hello-world.core :as hello] :reload)
/Users/colin/dev/cljs/out/hello_world/core.js:5
cljs.nodejs.enable_util_print_BANG_.call(null);
           ^
TypeError: Cannot read property 'enable_util_print_BANG_' of undefined
    at Object.<anonymous> (/Users/colin/dev/cljs/out/hello_world/core.cljs:4:2)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at global.CLOSURE_IMPORT_SCRIPT (repl:75:16)
    at Object.goog.require (repl:19:60)
    at repl:3:6
cljs.user=> :cljs/quit

~/d/cljs> rlwrap java -cp cljs.jar:src clojure.main node_repl.clj
Reading analysis cache for jar:file:/Users/colin/dev/cljs/cljs.jar!/cljs/core.cljs
Compiling src/hello_world/core.cljs
Reading analysis cache for jar:file:/Users/colin/dev/cljs/cljs.jar!/cljs/nodejs.cljs
Compiling out/cljs/nodejs.cljs
ClojureScript Node.js REPL server listening on 50817
Watch compilation log available at: out/watch.log
To quit, type: :cljs/quit
cljs.user=> (require '[hello-world.core :as hello] :reload)
nil
cljs.user=> (hello-world.core/foo 1 2)
3
cljs.user=> :cljs/quit
~/d/cljs>


 Comments   
Comment by David Nolen [ 31/Mar/15 7:32 AM ]

fixed https://github.com/clojure/clojurescript/commit/5b847b9da7997f30f42aa82f4f9225012035ae81





[CLJS-1178] Compiler does not know Math ns is not not-native Created: 29/Mar/15  Updated: 29/Apr/15  Resolved: 29/Apr/15

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

Type: Defect Priority: Minor
Reporter: Francis Avila Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: compiler

Attachments: Text File cljs-1178.patch    
Patch: Code

 Description   

With static-fns true, compiler will emit invocations of functions in the Math "namespace" with a conditional arity check or .call() because it does not know that the Math namespace is not not-native. Example with the fix function (advanced compilation, pseudo-names true):

function $cljs$core$fix$$($q$$28$$) {
  return 0 <= $q$$28$$ ? Math.floor.$cljs$core$IFn$_invoke$arity$1$ ? Math.floor.$cljs$core$IFn$_invoke$arity$1$($q$$28$$) : Math.floor.call(null, $q$$28$$) : Math.ceil.$cljs$core$IFn$_invoke$arity$1$ ? Math.ceil.$cljs$core$IFn$_invoke$arity$1$($q$$28$$) : Math.ceil.call(null, $q$$28$$);
}

With attached patch, the following is emitted instead:

function $cljs$core$fix$$($q$$28$$) {
  return 0 <= $q$$28$$ ? Math.floor($q$$28$$) : Math.ceil($q$$28$$);
}


 Comments   
Comment by David Nolen [ 29/Apr/15 7:04 AM ]

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





[CLJS-1177] A compiler support for non-Closure transforms (JSX, etc) Created: 28/Mar/15  Updated: 30/Apr/15

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

Type: Enhancement Priority: Major
Reporter: David Nolen Assignee: Maria Neise
Resolution: Unresolved Votes: 1
Labels: None


 Description   

There are now a variety of JS dialects, JSX, TypeScript etc. which need to be transformed first into regular JS before module processing. We should devise a standard way to deal with this. As we cannot predict what various dialects may arise in the future it's probably best to provide something like :preprocess-module option to cljs.closure/build.






[CLJS-1176] Push node.js REPL output through *out* and *err* Created: 27/Mar/15  Updated: 23/May/15  Resolved: 28/Mar/15

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

Type: Enhancement Priority: Major
Reporter: Chas Emerick Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None

Attachments: File CLJS-1176.diff    
Patch: Code

 Description   

The node.js REPL environment currently lets the child node process inherit the JVM's stdout/err. This is bad for nREPL, and for any other setup where one would like to rebind *out* and/or *err* in order to redirect content print ed by ClojureScript code. Turning off the inheritance and pumping output from the process to *out* and *err* should be straightforward.

Related nREPL/piggieback issue: https://github.com/cemerick/piggieback/issues/41



 Comments   
Comment by Chas Emerick [ 28/Mar/15 5:10 AM ]

Patch attached. Node REPL now sends output to *out* and *err*.

Comment by David Nolen [ 28/Mar/15 12:07 PM ]

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

Comment by Joel Wilsson [ 08/Apr/15 7:10 AM ]

This doesn't work for me, because java.lang.Process does not have an isAlive() method. Maybe you were thinking of java.lang.Thread isAlive()?

user=> (require '[cljs.repl :as repl])
nil
user=> (require '[cljs.repl.node :as node])
nil
user=> (def env (node/repl-env))
#'user/env
user=> (repl/repl env)
Exception in thread "Thread-8" Exception in thread "Thread-9" java.lang.IllegalArgumentException: No matching field found: isAlive for class java.lang.UNIXProcess
	at clojure.lang.Reflector.getInstanceField(Reflector.java:271)
	at clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:315)
	at cljs.repl.node$pipe.invoke(node.clj:85)
	at cljs.repl.node$setup$fn__10733.invoke(node.clj:109)
...
Comment by Chas Emerick [ 08/Apr/15 7:37 AM ]

Damn, no, looks like I was using the JDK 8 javadoc when I wrote the patch: http://docs.oracle.com/javase/8/docs/api/java/lang/Process.html#isAlive--

Looks like this would be an equivalent expression:

(try (.exitValue proc) false (catch IllegalThreadStateException _ true))

We'll see if David prefers a patch for this, or to paste it in himself…

Comment by Chas Emerick [ 08/Apr/15 8:03 AM ]

Patch attached to CLJS-1192. Sorry for the snafu! :-/

Comment by Daniel Skarda [ 23/May/15 1:03 PM ]

In 0.0-3291 there is still one call to isAlive left on src/main/clojure/cljs/repl/node.clj:92

Comment by David Nolen [ 23/May/15 1:32 PM ]

fixed https://github.com/clojure/clojurescript/commit/46af7373d88f77972eb0f030ca43724d43c6b648





[CLJS-1175] CLJS defmulti doesn't exhibit same defonce behavior as Clojure's defmulti, suggesting an even better reloading behavior Created: 27/Mar/15  Updated: 28/Mar/15  Resolved: 28/Mar/15

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

Type: Defect Priority: Major
Reporter: Bruce Hauman Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None


 Description   

I just noticed that the redefinition of a defmulti completely destroys the dispatch table associated with it.

This is not the case in Clojure.
http://dev.clojure.org/jira/browse/CLJ-900
https://github.com/clojure/clojure/commit/1b8d5001ba094053b24c55829994785be422cfbf

I actually think the better behavior is to create a new MultiFn with the new options and steal the dispatch table state from the current MultiFn.

I think this is the least surprising behavior.



 Comments   
Comment by David Nolen [ 27/Mar/15 1:32 PM ]

defmulti in Clojure has defonce semantics. I don't think we need to do anything at all beyond that. Patch welcome for this.

Comment by David Nolen [ 28/Mar/15 12:29 PM ]

fixed https://github.com/clojure/clojurescript/commit/380c8b19c5fada55c40759063a4a23332bc7fdf8





[CLJS-1174] Simple warning if a namespace with dashes not found but a file path with dashes exists Created: 27/Mar/15  Updated: 10/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

Type: Enhancement Priority: Major
Reporter: David Nolen Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: easy





[CLJS-1173] standard way to identify types originating from ClojureScript Created: 27/Mar/15  Updated: 26/Apr/15  Resolved: 26/Apr/15

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

Type: Defect Priority: Major
Reporter: David Nolen Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: easy


 Comments   
Comment by David Nolen [ 23/Apr/15 1:12 AM ]

We expose this only as a property cljs$lang$type. A simple predicate cljs-type? would suffice.

Comment by David Nolen [ 26/Apr/15 5:22 AM ]

There's not a way to determine this in Clojure either.





[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: 0.0-3196

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: 0.0-3196

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: 0.0-3196

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: 0.0-3196

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-1168] REPL fails to find .js files in :libs Created: 25/Mar/15  Updated: 09/May/15  Resolved: 09/May/15

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

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

org.clojure/clojurescript 0.0-3149
Tested with both basic clojurescript REPL and new com.cemerick/piggieback 0.2.0-20150324.120715-1



 Description   

We use Google E2E library for encryption. This library is written using Google Closure.
The library is stored locally in a directory ("closure-libs/e2e") and we pass :libs ["closure-libs/e2e"] to the compiler.

Compilation of our project works fine. Compiler does find the library without problems in all optimization modes.

Recently we have problem with REPL. With same parameters, REPL fails to load the library:

java.lang.IllegalArgumentException: Namespace e2e.async.Result does not exist
at cljs.closure$source_for_namespace.invoke(closure.clj:501)
at cljs.repl$load_namespace.invoke(repl.clj:181)
at cljs.repl$load_dependencies.invoke(repl.clj:201)
at cljs.repl$evaluate_form.invoke(repl.clj:444)
at cljs.repl$eval_cljs.invoke(repl.clj:527)
at cljs.repl$repl_STAR_$read_eval_print__4890.invoke(repl.clj:783)
at cljs.repl$repl_STAR_$fn_4896$fn_4903.invoke(repl.clj:821)
at cljs.repl$repl_STAR_$fn__4896.invoke(repl.clj:820)
at cljs.compiler$with_core_cljs.invoke(compiler.clj:951)
at cljs.repl$repl_STAR_.invoke(repl.clj:785)
at cryptelo.dev.cljs.env$eval11953.invoke(02b7dffab3345931421313ec2fe5d506990ab5e5-init.clj:1)

I spent long time investigating the issue (which is not easy given jungle of compiler and repl option maps, bindings of global variables etc).

What I found:

  • compiler finds the library without problem, all our tests invoked from the command line pass
  • both basic cljs REPL and piggieback (0.2.0 experimental branch) fails to find the library
  • :libs files are not copied to :output-dir
  • at the beginning, repl calls default-compiler-env with options
  • default-compiler-options run js-dependency-index, which scans all libraries and stores it in compiler atom
  • strace proves that clojurescript finds closure-libs/e2e/deps.js and reads it
  • calling (js-dependency-index {:libs ["closure-lib/e2e"]}) proves that the e2e.async.Result was found

But:

  • library-dependencies stores file path as URL in {:url ...}
  • source-for-namespace (from error stack) finds the file, but expects relative path with key :file

This is where my investigation stops. I am sure that fix would be probably easy, but I do not know all details of information cljs stores about .js files. Moreover I do not know why it works in compiler and not in REPL. Probably compiler does not open file and passes
it as a argument to Google Closure, while REPL actually wants to load the file itself.

Hope you have all information to fix the problem.

Thank you.



 Comments   
Comment by David Nolen [ 25/Mar/15 8:49 AM ]

Please do not include piggieback information when reporting issues to JIRA. We do not consider downstream tooling here at all. Will take a look, thanks for the report!

Comment by David Nolen [ 09/May/15 1:47 PM ]

fixed https://github.com/clojure/clojurescript/commit/5858966764728393f86cdeca50a049e350c670eb





[CLJS-1167]  Using (require 'namespace.core :reload) causes "too much recursion" - one process only. Created: 24/Mar/15  Updated: 29/Apr/15  Resolved: 29/Apr/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, openjdk version "1.8.0_31"


Attachments: File m060.tgz    

 Description   

At shell prompt, using "mies" from github: lein new mies m060
In core.cljs uncomment: (repl/connect "http://localhost:9000/repl")
In core.cljs add (defn doubled [x] (* 2 x))
At shell prompt: scripts/build # finishes successfully
At shell prompt: scripts/brepl

This will generate two warnings about goog.next.xpc.TransportNames and goog.net.xpc.CfgFields

In browser, connect to localhost:9000

In REPL: (require 'm060.core)
In REPL: (in-ns 'm060.core)
In REPL: (doubled 10) ;; this works correctly

In core.cljs, add: (defn tripled [x] (* 3 x))
in REPL: (require 'm060.core :reload)

browser shows "too much recursion" error twice (in Firefox)
in REPL: (tripled 10) ;; also works correctly

in core.cljs, add: (defn quad [x] (* 4 x))

in REPL: (require 'm060.core :reload)
Internal error: Too much recursion
Many repetitions of clojure$browser$repl$bootstrapgoog.require (out/clojure/browser/repl.cljs:158:33)


Note: this error can be avoided by replacing the (repl/connect "http://localhost:9000/repl") by
(defonce conn (repl/connect "http://localhost:9000/repl")) ;; as in quick start guide



 Comments   
Comment by David Nolen [ 29/Apr/15 6:59 AM ]

You must defonce the REPL connection if you want to reload that namespace. This is covered in the Quick Start.





[CLJS-1166] Browser REPL stacktraces unprocessed if explicit IP used Created: 24/Mar/15  Updated: 10/May/15  Resolved: 10/May/15

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

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

QuickStart Browser REPL OS X Safari (other browsers as well)



 Description   

Go through the Quick Start but change the repl/connect form to use an explicit IP instead of localhost. (In this case the IP I am trying is indeed the same host, if that matters.)

(defonce conn
  (repl/connect "http://10.96.82.207:9000/repl"))

Then connect to the REPL using the explicit IP http://10.96.82.207:9000.

The REPL will function properly but stacktraces are not properly processed. Here is an example (generated using Safari):

ClojureScript:cljs.user> (ffirst [1])
Error: 1 is not ISeqable
cljs$core$seq@http://10.96.82.207:9000/out/cljs/core.js:4667:17
cljs$core$first@http://10.96.82.207:9000/out/cljs/core.js:4697:22
cljs$core$ffirst@http://10.96.82.207:9000/out/cljs/core.js:5774:23


eval code
eval@[native code]
http://10.96.82.207:9000/out/clojure/browser/repl.js:42:271
clojure$browser$repl$evaluate_javascript@http://10.96.82.207:9000/out/clojure/browser/repl.js:45:4
http://10.96.82.207:9000/out/clojure/browser/repl.js:242:173
deliver@http://10.96.82.207:9000/out/goog/messaging/abstractchannel.js:142:21
xpcDeliver@http://10.96.82.207:9000/out/goog/net/xpc/crosspagechannel.js:733:19
messageReceived_@http://10.96.82.207:9000/out/goog/net/xpc/nativemessagingtransport.js:321:23
fireListener@http://10.96.82.207:9000/out/goog/events/events.js:741:25
handleBrowserEvent_@http://10.96.82.207:9000/out/goog/events/events.js:862:34
http://10.96.82.207:9000/out/goog/events/events.js:276:42


 Comments   
Comment by David Nolen [ 10/May/15 2:45 PM ]

as far as I can tell this was resolved with the fix for CLJS-1258 https://github.com/clojure/clojurescript/commit/d0bf12f24f3455fdc45962206580ab50ca907638





[CLJS-1165] Support for multiple source directories in cljs.closure/build and watch Created: 24/Mar/15  Updated: 29/Apr/15  Resolved: 29/Apr/15

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

Type: Defect Priority: Minor
Reporter: Daniel Skarda Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None


 Description   

Quick-Start wiki page describes build and watch as functions with source (directory) as first argument

However more complex projects have multiple source paths (eg "src/cljs", "test/cljs" or cljx output "target/generated/cljs" and in future also "src/cljc").

Maybe I am missing some important point of a puzzle but I do not see a way how to (for example) build or watch multiple directories. Should we extend these function to support vectors of directories?



 Comments   
Comment by David Nolen [ 29/Apr/15 7:05 AM ]

CLJS-1203





[CLJS-1164] quot and rem are inefficient Created: 24/Mar/15  Updated: 29/Mar/15

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

Type: Enhancement Priority: Minor
Reporter: Francis Avila Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: math

Attachments: Text File cljs-1164.patch    
Patch: Code and Test

 Description   

The implementation of the quot and rem functions are needlessly complicated. Currently they are:

(defn quot [n d] (fix (/ (- n (js-mod n d)) d)))
(defn rem [n d] (- n (* d (quot n d))))

However all numbers in js are doubles already, so all this is unnecessary:

(defn quot [n d] (fix (/ n d)))
(defn rem [n d] (js-mod n d)))

Notice that "rem" is simply js-mod, and I'm not sure why no one noticed this before. I keep js-mod for now since a lot of code uses it, and if cljs ever grows a number tower the distinction may be important.

Patch attached, which also:

  • Creates a macro version of quot and rem.
  • Updates documentation for quot, rem, js-mod and mod for clarity.
  • Implement fix (private function to round to zero) with ES6 Math.trunc() if available.

Existing quot and rem tests pass, although there could be some better tests of edge cases (negative decimal num or div, NaN and +-Infinity args).



 Comments   
Comment by Francis Avila [ 24/Mar/15 12:27 PM ]

Better tests found rounding errors in my updated rem, which should stay as-is. (Not simply js-mod after all! Seems to round args first? Not obvious from the spec.) Changed quot however is correct and introduces less error than the current one. Will update patch and tests when I get a chance.

Comment by Francis Avila [ 29/Mar/15 12:39 AM ]

Working patch with tests attached. Tests expanded to cover floating-point cases. rem is now fundamentally the same as master (was more accurate than js-mod!!), but returns results consistent with js-mod for non-finite args or zero divisor.





[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-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: 0.0-3196
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: 0.0-3196

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-1160] Source map js / cljs line number mixup Created: 23/Mar/15  Updated: 23/Mar/15

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

Type: Defect Priority: Minor
Reporter: Mike Fikes Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Environment:

QuickStart Browser REPL Chrome OS X



 Description   

Note the source location for cljs.core.LazySeq.sval in the following 0.0-3126 stacktrace:

ClojureScript:cljs.user> (map ffirst (range))
Error: 0 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)
	 cljs.core.map.cljs$core$map__2 (out/cljs/core.cljs:4046:30)
	 cljs.core.LazySeq.sval (out/cljs/core.cljs:11400:3)
	 cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (out/cljs/core.cljs:2884:12)
	 cljs$core$seq (out/cljs/core.cljs:938:7)
	 cljs$core$pr_sequential_writer (out/cljs/core.cljs:8426:13)

It turns out that line 11400 is actually in core.js, but the source map logic is evidently getting tripped up by this one, and core.cljs gets reported with the JS line numbers (core.cljs doesn't even have that many lines).

Note that this also occurs on master (where CLJS-1154 and CLJS-1157 have landed):

ClojureScript:cljs.user> (map ffirst (range))
Error: 0 is not ISeqable
	 cljs.core/seq (out/cljs/core.cljs:951:20)
	 cljs.core/first (out/cljs/core.cljs:960:16)
	 cljs$core$ffirst (out/cljs/core.cljs:1393:11)
	 cljs.core.map.cljs$core$map__2 (out/cljs/core.cljs:4046:30)
	 cljs.core.LazySeq.sval (out/cljs/core.cljs:11400:3)
	 cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (out/cljs/core.cljs:2884:12)
	 cljs.core/seq (out/cljs/core.cljs:938:25)
	 cljs$core$pr_sequential_writer (out/cljs/core.cljs:8426:20)





[CLJS-1159] compiled files with warnings that otherwise don't need recompilation will not emit warnings on the next compile Created: 23/Mar/15  Updated: 10/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

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


 Description   

The aggressive caching approach is odds with warning visibility. It probably makes sense for a compiled file with warnings to always return true for requires-compilation?.






[CLJS-1158] Regression: compiler fails to see symbols defined in another namespace Created: 23/Mar/15  Updated: 09/Apr/15  Resolved: 07/Apr/15

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

Type: Defect Priority: Major
Reporter: Nikita Prokopov Assignee: David Nolen
Resolution: Completed Votes: 1
Labels: None

Attachments: Zip Archive cljs-1158.zip    

 Description   

Regression happened between 0.0-2985 and 0.0-3030.

E.g. I have this setup:

(ns datascript
  (:require [datascript.core :as dc]))

(def filter dc/filter)
(ns datascript.js
  (:require
    [datascript :as d]))

d/filter

This is the output of compiler for 0.0-2985:

Compiling ClojureScript.
Compiling "target/datascript.js" from ["src" "test"]...
Analyzing jar:file:/Users/prokopov/.m2/repository/org/clojure/clojurescript/0.0-2985/clojurescript-0.0-2985.jar!/cljs/core.cljs
Compiling src/datascript/btset.cljs
Compiling src/datascript/core.cljs
Compiling src/datascript/debug.cljs
Compiling src/datascript/impl/entity.cljs
Compiling src/datascript/js.cljs
Analyzing file:/Users/prokopov/Dropbox/ws/datascript/src/datascript.cljs
WARNING: datascript is a single segment namespace at line 1 /Users/prokopov/Dropbox/ws/datascript/src/datascript.cljs
Analyzing file:/Users/prokopov/Dropbox/ws/datascript/src/datascript/query.cljs
Analyzing file:/Users/prokopov/Dropbox/ws/datascript/src/datascript/parser.cljs
Analyzing jar:file:/Users/prokopov/.m2/repository/org/clojure/clojurescript/0.0-2985/clojurescript-0.0-2985.jar!/clojure/set.cljs
Analyzing file:/Users/prokopov/Dropbox/ws/datascript/src/datascript/pull_parser.cljs
Analyzing file:/Users/prokopov/Dropbox/ws/datascript/src/datascript/pull_api.cljs
Analyzing jar:file:/Users/prokopov/.m2/repository/org/clojure/clojurescript/0.0-2985/clojurescript-0.0-2985.jar!/cljs/reader.cljs
Analyzing jar:file:/Users/prokopov/.m2/repository/org/clojure/clojurescript/0.0-2985/clojurescript-0.0-2985.jar!/clojure/walk.cljs
Compiling src/datascript/parser.cljs
...

Note that

Compiling src/datascript/js.cljs
triggers
Analyzing file:/Users/prokopov/Dropbox/ws/datascript/src/datascript.cljs

And on 0.0-3030 and later versions I get this:

Compiling ClojureScript.
Retrieving org/clojure/clojurescript/0.0-3030/clojurescript-0.0-3030.pom from central
Retrieving org/clojure/clojurescript/0.0-3030/clojurescript-0.0-3030.jar from central
Compiling "target/datascript.js" from ["src" "test"]...
Reading analysis cache for jar:file:/Users/prokopov/.m2/repository/org/clojure/clojurescript/0.0-3030/clojurescript-0.0-3030.jar!/cljs/core.cljs
Compiling src/datascript/btset.cljs
Compiling src/datascript/core.cljs
Compiling src/datascript/debug.cljs
Compiling src/datascript/impl/entity.cljs
Compiling src/datascript/js.cljs
WARNING: Use of undeclared Var datascript/filter at line 11 src/datascript/js.cljs
Compiling src/datascript/parser.cljs
Analyzing jar:file:/Users/prokopov/.m2/repository/org/clojure/clojurescript/0.0-3030/clojurescript-0.0-3030.jar!/clojure/set.cljs
Compiling src/datascript/pull_api.cljs
Analyzing file:/Users/prokopov/Dropbox/ws/datascript/src/datascript/pull_parser.cljs
Compiling src/datascript/pull_parser.cljs
Compiling src/datascript/query.cljs
Analyzing jar:file:/Users/prokopov/.m2/repository/org/clojure/clojurescript/0.0-3030/clojurescript-0.0-3030.jar!/cljs/reader.cljs
Analyzing jar:file:/Users/prokopov/.m2/repository/org/clojure/clojurescript/0.0-3030/clojurescript-0.0-3030.jar!/clojure/walk.cljs
Compiling src/datascript/query_v3.cljs
Analyzing jar:file:/Users/prokopov/.m2/repository/com/cemerick/clojurescript.test/0.3.3/clojurescript.test-0.3.3.jar!/cemerick/cljs/test.cljs
Analyzing jar:file:/Users/prokopov/.m2/repository/org/clojure/clojurescript/0.0-3030/clojurescript-0.0-3030.jar!/clojure/string.cljs
Compiling src/datascript.cljs
WARNING: datascript is a single segment namespace at line 1 src/datascript.cljs
...

The problem is in this line:

WARNING: Use of undeclared Var datascript/filter at line 11 src/datascript/js.cljs

I have fully legit use of datascript/filter in datascript.js, and yet get this warning.

To reproduce, just lein cljsbuild once advanced on master of https://github.com/tonsky/datascript with 0.0-3030 or later



 Comments   
Comment by David Nolen [ 23/Mar/15 5:45 AM ]

In general we only consider minimal cases not complete projects as there are too many variables at play. We no longer consider anything involving cljsbuild. Please attempt to produce a minimal case first. Given the above you should be able produce something quite small and simple using the Quick Start and the standalone JAR. Thanks!

Comment by David Nolen [ 23/Mar/15 6:09 AM ]

I just tried the standalone 0.0-3126 JAR with the following:

src/alias_bug/core.cljs

(ns alias-bug.core)

(defn foo [a b]
  (+ a b))

src/alias_bug/js.cljs

(ns alias-bug.js
  (:require [alias-bug :as alias]))

alias/foo

src/alias_bug.cljs

(ns alias-bug
  (:require [alias-bug.core :as core]))

(def foo core/foo)

build.clj

(require '[cljs.closure :as cljsc])

(cljsc/build "src"
  {:output-to "out/main.js"
   :verbose true})

I compiled this with:

java -cp cljs.jar:src clojure.main build.clj

I did not see this issue. I tried touching one file then running build again one at a time, still did not see this issue. The implicit options here are :optimizations :none, :cache-analysis true.

Comment by Nikita Prokopov [ 23/Mar/15 6:37 AM ]

Sorry, for some reason I decided that’s something trivial that was just overlooked and is easy to spot without a minimal test case. Now I see it’s more deep/complex than that. Attaching a minimal use case. Looks like it has something to do with :require-macros

Comment by Nikita Prokopov [ 23/Mar/15 6:58 AM ]

Just for information: I also noted that compilation order is alphabetical, and naming files plays a role here: when it compiles a, then b, then c, bug reproduces, if we rename files to change that order, it vanishes.

Comment by Immo Heikkinen [ 04/Apr/15 10:02 AM ]

I ran into this as well. The source seems to be changes to `intern-macros` in commit https://github.com/clojure/clojurescript/commit/db2c4d04cb924da6f939c26ba36dcdad08ef7080
which causes analysis of the macro namespace to be skipped here:
https://github.com/clojure/clojurescript/blob/r3126/src/clj/cljs/analyzer.clj#L1240

Comment by David Nolen [ 04/Apr/15 10:36 AM ]

Thanks for the additional information. I think this should be enough for me to create a minimal case.

Comment by David Nolen [ 07/Apr/15 7:34 AM ]

fixed https://github.com/clojure/clojurescript/commit/0d0f50958c952db5281aaec5e7bf0c0f9954ccee

Comment by Nikita Prokopov [ 07/Apr/15 7:44 AM ]

Amazing — thanks David!

Comment by David Nolen [ 07/Apr/15 9:14 AM ]

Nikita & Immo I'm pretty sure this fixes the issue but you all should confirm with master. Thanks.

Comment by Immo Heikkinen [ 07/Apr/15 11:40 PM ]

Yes it fixes the issue. Thanks David!

Comment by Nikita Prokopov [ 09/Apr/15 1:32 PM ]

Confirming too — works both on minimal test case and on DataScript codebase, warning is gone





[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: 0.0-3196
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-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: 0.0-3196

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-1155] REPL :watch support does not play nicely with :cljs/quit Created: 20/Mar/15  Updated: 20/Mar/15  Resolved: 20/Mar/15

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

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


 Comments   
Comment by David Nolen [ 20/Mar/15 5:51 PM ]

fixed https://github.com/clojure/clojurescript/commit/501a922a2fd1412503638bedc78a1f5e18b0219c

Comment by Mike Fikes [ 20/Mar/15 6:00 PM ]

Confirmed fixed for me when using browser REPL from Quick Start with :watch "src".





[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: 0.0-3196

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





[CLJS-1153] Typed Array backed PersistentVector based on clojure.core/Vec Created: 19/Mar/15  Updated: 29/Apr/15

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

Type: Enhancement Priority: Minor
Reporter: Adrian Medina Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: enhancement

Attachments: Text File 1153.patch    
Patch: Code

 Description   

Goal is to add support for vectors based on clojure.core/Vec, built on top of JavaScript Typed Arrays.

My hope is that this would allow for both efficient creation of vectors from existing Typed Arrays without intermediate conversion to normal JavaScript arrays, as well as efficient concatenation of the composite arrays of the vector back into a Typed Array when necessary via an enhanced cljs.core/into-array.

Implementation is based heavily on clojure/core/gvec.clj, cljs.core/PersistentVector, and cljs.core/TransientVector.

Performance should be comparable to cljs.core/PersistentVector, although there is additional constant overhead with TypedArray instantiation compared to js/Array.

Adds cljs.core/Vec, cljs.core/TransientVec, cljs.core/vector-of, and updates cljs.core/into-array.



 Comments   
Comment by Adrian Medina [ 19/Mar/15 8:39 PM ]

I still have to test, I will update the issue when that is complete. I just wanted to get my first patch up for review as quickly as possible.

Comment by Francis Avila [ 19/Mar/15 11:59 PM ]

No mention of Uint8ClampedArray.

Should Vec type- or range-check assignments? In Clojure these fail (even with unchecked-math):

  • (vector-of :byte 128) returns [-128]
  • (vector-of :byte "1") returns [1]
  • (vector-of :byte (js-obj)) returns [0]

If we're going to expose host primitive arrays via cljs apis, should we also bring the various other array functions in line with Clojure (and ClojureCLR, which also has extra uint, ubyte, etc types) like you are doing with into-array? Some or all of these issues may warrant another ticket instead, or maybe even a design page:

  • make-array ignores type argument and lacks higher dimensions.
  • object-array, int-array, etc. maybe should return TypedArrays.
  • Missing ubyte-array, ushort-array, uint-array (like ClojureCLR)
  • Missing aset-* setters. (Meaningless in js unless we range-check.)
  • aclone and amap preserve type of input array in Clojure, but not in cljs.
  • missing array casters: bytes, shorts, chars, ints, etc.
  • While we're at it, primitive coercion functions (e.g. int, long, unchecked-int, etc) are either no-ops or differ from clojure. (e.g., int in cljs is like unchecked-int in clojure, but unchecked-int in cljs does nothing). Maybe these should be dropped or should match the javascript ToInt32, ToInt16, etc abstract operations (i.e. those used when assigning to TypedArrays). Maybe these match java semantics also?




[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: 0.0-3196

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-1151] Noisy errors when referring to symbol in undefined ns Created: 19/Mar/15  Updated: 22/Mar/15

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

Type: Defect Priority: Minor
Reporter: Mike Fikes Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Quick Start / OS X / Chrome



 Description   

Run through the Quick Start to the point where you have the browser REPL running.

If you refer to a symbol in an undefined ns you will get really noisy errors:

ClojureScript:cljs.user> foo.bar/a
WARNING: Use of undeclared Var foo.bar/a 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)

Now, define the namespace, but don't actually define the symbol. For example:

(ns foo.bar)

(def z 3)

Now, require the namespace and do the same. The noise will go away.

ClojureScript:cljs.user> (require 'foo.bar)
nil
ClojureScript:cljs.user> foo.bar/a
WARNING: Use of undeclared Var foo.bar/a at line 1 <cljs repl>
nil

Additional info: Now if you attempt to refer to other unknown symbols, you will get different kinds of "noise" depending on whether the ns simply starts with foo:

ClojureScript:cljs.user> foo.baz/a
WARNING: No such namespace: foo.baz, could not locate foo/baz.cljs at line 1 <cljs repl>
WARNING: Use of undeclared Var foo.baz/a at line 1 <cljs repl>
TypeError: Cannot read property 'a' of undefined
TypeError: Cannot read property 'a' of undefined
    at eval (eval at <anonymous> (http://localhost:9000/out/clojure/browser/repl.js:42:272), <anonymous>:1:96)
    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> goo.baz/a
WARNING: No such namespace: goo.baz, could not locate goo/baz.cljs at line 1 <cljs repl>
WARNING: Use of undeclared Var goo.baz/a at line 1 <cljs repl>
ReferenceError: goo is not defined
ReferenceError: goo 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)


 Comments   
Comment by Mike Fikes [ 19/Mar/15 3:47 PM ]

Clarification on the description: When defining the foo.bar ns, I actually created a source file src/foo/bar.cljs containing the ns declaration and the def z.

Comment by David Nolen [ 22/Mar/15 9:49 AM ]

I'm not sure what we can do about this or that suppressing the errors from the JavaScript evaluation environment is a good idea. Property access on something that doesn't exist is what causes the JS environment to emit the error. In the later cases the property access is on something that does exist but doesn't have the property so no error.





[CLJS-1150] lift cljs.repl/repl cljs.user ns form evalution into default init Created: 19/Mar/15  Updated: 19/Mar/15  Resolved: 19/Mar/15

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

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


 Comments   
Comment by David Nolen [ 19/Mar/15 7:40 AM ]

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





[CLJS-1149] cljs.repl/repl needs to support :compiler-env option Created: 19/Mar/15  Updated: 19/Mar/15  Resolved: 19/Mar/15

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

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


 Comments   
Comment by David Nolen [ 19/Mar/15 7:25 AM ]

fixed https://github.com/clojure/clojurescript/commit/1208fe565b27ec30ac315f3c237b0df3d30a629d





[CLJS-1148] ClojureScript REPL must maintain eval/print pairing Created: 19/Mar/15  Updated: 20/Mar/15  Resolved: 19/Mar/15

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

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


 Description   

Currently the behavior is fine for the standard command line REPLs but pretty broken for anything else. Instead we should adopt the approach of the coming socket REPLs, we should supply a bind-err option which can be set to false to force error printing and other forms of logging to be directed to *err* instead of *out*.

There also a couple of places around the default prompt that should also be fixed.



 Comments   
Comment by Mike Fikes [ 19/Mar/15 7:10 AM ]

One consideration for printed output (even if directed to *err*): it needs to be modeled after print (in contrast to the default of println for :print).

Rationale: this supports evaluating forms that essentially call either print or println, without presuming a newline should be sent to *err*.

The pattern I've used in Ambly is :print-no-newline followed by :flush; perhaps with *err* semantics the :flush isn't necessary.

Comment by David Nolen [ 19/Mar/15 8:09 AM ]

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

Comment by David Nolen [ 19/Mar/15 8:09 AM ]

Mike Fikes good point but I think we should surface that issue elsewhere now.





[CLJS-1147] reconnect logic for browser REPLs Created: 18/Mar/15  Updated: 10/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

Type: Enhancement Priority: Major
Reporter: David Nolen Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Instead of forcing users to refresh browser and lose application state, the browser REPL should poll once a second to connect if connection is unreachable for some reason.



 Comments  &nb