<< Back to previous view

[CLJS-856] On Node.js, (seq (array 1 2 3)) throws exception Created: 12/Sep/14  Updated: 15/Sep/14  Resolved: 15/Sep/14

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

Type: Defect Priority: Major
Reporter: Peter Schwarz Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: nodejs
Environment:

Os X
Node.js 0.10.31
Clojurescript 0.0-2311



 Description   

Calling (seq (array 1 2 3)) throws the following exception:

Error: 1,2, 3 is not ISeqable
    at seq (cljs/core.cljs:38:9)
    at <cljs repl>:1:79
    at <cljs repl>:5:3
    at Socket.eval (eval at <anonymous> ([eval]:1:20), <anonymous>:70:29)
    at Socket.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:764:14)
    at Socket.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:426:10)
    at emitReadable (_stream_readable.js:422:5)
    at readableAddChunk (_stream_readable.js:165:9)

However, calling (seq (aclone (array 1 2 3))) correctly results in (1 2 3)

Viewing it in a repl, one does see the following:

ClojureScript:cljs.user> (array 1 2 3)
#<1,2,3>
ClojureScript:cljs.user> (aclone (array 1 2 3))
#js [1 2 3]

Not sure if that is helpful, but the array created does seem to slightly different.



 Comments   
Comment by David Nolen [ 15/Sep/14 12:24 PM ]

In Node.js JS instances may be created in other VM contexts. The same is true for moving JS objects between frames in the browser. You need to handle this case yourself via extend-type.





[CLJS-687] error/warning when deftype/record constructor used as a function Created: 19/Nov/13  Updated: 19/Nov/13  Resolved: 19/Nov/13

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

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


 Comments   
Comment by David Nolen [ 19/Nov/13 5:11 PM ]

fixed,https://github.com/clojure/clojurescript/commit/792b2b87c9982a76093fcc3278dd246e8672627b





[CLJS-410] support ^:expose annotation Created: 28/Oct/12  Updated: 19/Nov/13  Resolved: 19/Nov/13

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

Type: Enhancement Priority: Minor
Reporter: David Nolen Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: None

Attachments: Text File CLJS-410.patch    

 Description   
(def ^:export m 1)
(defn foo [g]
  (g m))

Because of constant propagation GClosure may replace m in foo with 1. It may be better to for :export to implicitly :expose but we need to check the output.

http://developers.google.com/closure/compiler/docs/js-for-compiler



 Comments   
Comment by Olle Martensson [ 22/Jul/13 5:33 AM ]

def annotated with ^:export is now implicitly treated as an exposed property by the closure compiler.

The goog.exportSymbol part for def seemed to be redundant and thus removed.

Comment by David Nolen [ 19/Nov/13 9:20 PM ]

There are workaround for this.





[CLJS-735] Set literal and hash-set cleanup Created: 28/Dec/13  Updated: 30/Dec/13  Resolved: 30/Dec/13

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

Type: Defect Priority: Minor
Reporter: Logan Campbell Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: None
Environment:

Clojurescript 0.0-2127


Attachments: Text File cljs-735-dead-code-cleanup.patch    

 Description   

Some sets drop values, causing loss of data.

The smallest example I've been able to find is:

#{[1 4] [2 4] [3 4] [0 3] [1 3] [2 3] [3 3] [3 2] [4 2]}
Drops: [1 4] [3 4] [1 3] [3 3]

hash-set also drops values. Though they are different.

(hash-set [1 4] [2 4] [3 4] [0 3] [1 3] [2 3] [3 3] [3 2] [4 2])
Drops: [2 4] [0 3] [2 3] [3 2]

Re-ordering the values appears to make no difference.

I have found no instance where sorted-set drops values.



 Comments   
Comment by Francis Avila [ 29/Dec/13 6:04 PM ]

This is a bug in PersistentHashSet.fromArray that causes every other item to be skipped when the input is longer than the PersistentArrayMap.HASHMAP_THRESHOLD (which is 8). Demonstration:

ClojureScript:cljs.user> (hash-set [0] [1] [2] [3] [4] [5] [6] [7] [8])
#{[2] [4] [6] [8] [0]}
ClojureScript:cljs.user> (hash-set [0] [1] [2] [3] [4] [5] [6] [7])   
#{[1] [2] [3] [4] [5] [6] [7] [0]}

Working on a patch and test.

Comment by Francis Avila [ 29/Dec/13 6:11 PM ]

Nevermind, looks like David fixed this already.

Comment by Francis Avila [ 29/Dec/13 8:02 PM ]

Some dead code was left in PersistentHashSet.fromArray (no-clone arg and arr let-binding). Attached a patch that cleans this up.

Comment by David Nolen [ 30/Dec/13 8:51 AM ]

Thanks for the patch but remember we need CAs to apply them.

The current hash-set construction implementation misses an optimization opportunity. We could build hash-sets much faster if we know that we have only unique constants at compile time.

Comment by David Nolen [ 30/Dec/13 8:52 AM ]

Need to implement the hash-set construction optimization, the old removed approach is faster when we know we have a set literal containing only constants.





[CLJS-832] Cryptic error with macro loading Created: 03/Aug/14  Updated: 10/Sep/14  Resolved: 10/Sep/14

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

Type: Defect Priority: Minor
Reporter: Mike Anderson Assignee: Unassigned
Resolution: Not Reproducible Votes: 0
Labels: None
Environment:

Windows 7 64-bit



 Description   

I'm getting a very cryptic error with ClojureScript and can't track down the exact cause. It seems to be something to do with macro loading in cljs.core...

Probably this is something I'm doing wrong... but either way I think the error message needs improving!

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
..............
C:\Users\Mike\git\pinnacle>lein cljsbuild auto
Compiling ClojureScript.
Compiling "resources/public/js/app.js" from ["src/main/cljs"]...
←[31mCompiling "resources/public/js/app.js" failed.←[0m
←[31mclojure.lang.ExceptionInfo: ←[39m←[31m←[39m
←[35m core.clj:4327 clojure.core/ex-info←[39m
←[32m analyzer.clj:268 cljs.analyzer/error←[39m
←[32m analyzer.clj:1523 cljs.analyzer/analyze←[39m
←[32m analyzer.clj:1520 cljs.analyzer/analyze←[39m
←[32m compiler.clj:963 cljs.compiler/parse-ns[fn]←[39m
←[32m compiler.clj:963 cljs.compiler/parse-ns[fn]←[39m
←[32m compiler.clj:958 cljs.compiler/parse-ns←[39m
←[32m compiler.clj:953 cljs.compiler/parse-ns←[39m
←[32m compiler.clj:1041 cljs.compiler/to-target-file←[39m
←[32m compiler.clj:1073 cljs.compiler/compile-root←[39m
←[32m closure.clj:341 cljs.closure/compile-dir←[39m
←[32m closure.clj:381 cljs.closure/eval2990[fn]←[39m
←[32m closure.clj:292 cljs.closure/eval2927[fn]←[39m
←[32m closure.clj:395 cljs.closure/eval2977[fn]←[39m
←[32m closure.clj:292 cljs.closure/eval2927[fn]←[39m
←[32m compiler.clj:44 cljsbuild.compiler.SourcePaths/fn←[39m
←[35m core.clj:2485 clojure.core/map[fn]←[39m
←[36m LazySeq.java:42 clojure.lang.LazySeq.sval←[39m
←[36m LazySeq.java:60 clojure.lang.LazySeq.seq←[39m
←[36m RT.java:484 clojure.lang.RT.seq←[39m
←[35m core.clj:133 clojure.core/seq←[39m
←[35m core.clj:617 clojure.core/apply←[39m
←[35m core.clj:2514 clojure.core/mapcat←[39m
←[36m RestFn.java:423 clojure.lang.RestFn.invoke←[39m
←[32m compiler.clj:44 cljsbuild.compiler/cljsbuild.compiler.SourcePa
ths←[39m
←[32m closure.clj:955 cljs.closure/build←[39m
←[32m closure.clj:923 cljs.closure/build←[39m
←[32m compiler.clj:58 cljsbuild.compiler/compile-cljs[fn]←[39m
←[32m compiler.clj:57 cljsbuild.compiler/compile-cljs←[39m
←[32m compiler.clj:159 cljsbuild.compiler/run-compiler←[39m
←[33m NO_SOURCE_FILE:1 user/eval3325[fn]←[39m
←[33m NO_SOURCE_FILE:1 user/eval3325[fn]←[39m
←[36m LazySeq.java:42 clojure.lang.LazySeq.sval←[39m
←[36m LazySeq.java:60 clojure.lang.LazySeq.seq←[39m
←[36m RT.java:484 clojure.lang.RT.seq←[39m
←[35m core.clj:133 clojure.core/seq←[39m
←[35m core.clj:2780 clojure.core/dorun←[39m
←[35m core.clj:2796 clojure.core/doall←[39m
←[33m NO_SOURCE_FILE:1 user/eval3325←[39m
←[36m Compiler.java:6619 clojure.lang.Compiler.eval←[39m
←[36m Compiler.java:6609 clojure.lang.Compiler.eval←[39m
←[36m Compiler.java:6582 clojure.lang.Compiler.eval←[39m
←[35m core.clj:2852 clojure.core/eval←[39m
←[35m main.clj:308 clojure.main/eval-opt←[39m
←[35m main.clj:327 clojure.main/initialize←[39m
←[35m main.clj:362 clojure.main/null-opt←[39m
←[35m main.clj:440 clojure.main/main←[39m
←[36m RestFn.java:421 clojure.lang.RestFn.invoke←[39m
←[36m Var.java:419 clojure.lang.Var.invoke←[39m
←[36m AFn.java:163 clojure.lang.AFn.applyToHelper←[39m
←[36m Var.java:532 clojure.lang.Var.applyTo←[39m
←[36m main.java:37 clojure.main.main←[39m
←[31mCaused by: ←[39m←[31mjava.lang.NullPointerException: ←[39m←[31m←[39m
←[32m core.clj:49 cljs.core/import-macros[fn]←[39m
←[35m core.clj:2485 clojure.core/map[fn]←[39m
←[36m LazySeq.java:42 clojure.lang.LazySeq.sval←[39m
←[36m LazySeq.java:60 clojure.lang.LazySeq.seq←[39m
←[36m RT.java:484 clojure.lang.RT.seq←[39m
←[35m core.clj:133 clojure.core/seq←[39m
←[35m core.clj:2490 clojure.core/map[fn]←[39m
←[36m LazySeq.java:42 clojure.lang.LazySeq.sval←[39m
←[36m LazySeq.java:67 clojure.lang.LazySeq.seq←[39m
←[36m RT.java:484 clojure.lang.RT.seq←[39m
←[35m core.clj:133 clojure.core/seq←[39m
←[35m core.clj:687 clojure.core/concat[fn]←[39m
←[36m LazySeq.java:42 clojure.lang.LazySeq.sval←[39m
←[36m LazySeq.java:60 clojure.lang.LazySeq.seq←[39m
←[36m Cons.java:39 clojure.lang.Cons.next←[39m
←[36m RT.java:598 clojure.lang.RT.next←[39m
←[36m Compiler.java:6606 clojure.lang.Compiler.eval←[39m
←[36m Compiler.java:7064 clojure.lang.Compiler.load←[39m
←[36m RT.java:370 clojure.lang.RT.loadResourceScript←[39m
←[36m RT.java:361 clojure.lang.RT.loadResourceScript←[39m
←[36m RT.java:440 clojure.lang.RT.load←[39m
←[36m RT.java:411 clojure.lang.RT.load←[39m
←[35m core.clj:5530 clojure.core/load[fn]←[39m
←[35m core.clj:5529 clojure.core/load←[39m
←[36m RestFn.java:408 clojure.lang.RestFn.invoke←[39m
←[32m analyzer.clj:210 cljs.analyzer/load-core←[39m
←[32m analyzer.clj:1529 cljs.analyzer/analyze[fn]←[39m
←[32m analyzer.clj:1525 cljs.analyzer/analyze←[39m



 Comments   
Comment by Mike Anderson [ 03/Aug/14 10:26 PM ]

Here is the ns declaration in the app.cljs namespace:

(ns pinnacle.app
(:require-macros [cljs.core.async.macros :refer [go alt!]]
[secretary.core :refer [defroute]])
(:require [goog.events :as events]
[cljs.core.async :refer [put! <! >! chan timeout]]
[markdown.core :as md]
[om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[secretary.core :as secretary]
[cljs-http.client :as http]
[pinnacle.utils :refer [guid]])
(:import [goog History]
[goog.history EventType]))

Comment by Eldar Gabdullin [ 14/Aug/14 4:14 PM ]

Same for me.

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

Please produce a minimal reproducible case - no dependencies other than ClojureScript itself. Thanks.

Comment by Vadim Platonov [ 22/Aug/14 4:35 AM ]

Had the same error. This is due to Clojure version in the project not matching the Clojure version required by Clojurescript.

Please check your Clojure version. Clojurescript as of 0.0-2261 requires Clojure 1.6.0.





Generated at Mon Sep 15 19:57:01 CDT 2014 using JIRA 4.4#649-r158309.