[CLJS-509] Spurious warning about symbol not being a protocol Created: 21/May/13 Updated: 21/May/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Praki Prakash | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Clojure 1.5.1, ClojureScript, cljsbuild 0.3.2 |
||
| Attachments: |
|
| Description |
|
"lein cljsbuild" generates "Symbol X is not a protocol" warning. The following code snippet reproduces the issue. Renaming "my.foo" namespace to "foo" compiles with no warning. ;; file:: foo.cljs (defprotocol IFoo ;; file: fubar.cljs (deftype FuBar [] cljs output: |
[CLJS-508] Missing IReduce implementations and typo in clojure.core.reducers/append! Created: 21/May/13 Updated: 21/May/13 Resolved: 21/May/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Daniel Skarda | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Fresh CLJS checkout from github |
||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
1) IReduce protocol is missing implementation for array and List. Patch attached. Note: what is your experience with array.push performance? ClojureScript reducers/foldcat uses arrays for append! / cat implementation. My experience was that (into [] ...) using conj! and TransientVector was at least 5 times faster than reducers/foldcat using array and push. The reason is probably inefficient push implementation in Chrome/V8 |
| Comments |
| Comment by David Nolen [ 21/May/13 9:59 AM ] |
|
Thanks for the patch. I doubt that array push is inefficient, but I imagine the regularity of TransientVector operations is something that V8 likes. |
| Comment by David Nolen [ 21/May/13 10:03 AM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/30bb0b9e55fb77cdfe952fbf5df763a25c4a25c5 |
[CLJS-507] Persistent Data Structure Benchmark Created: 20/May/13 Updated: 20/May/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | David Nolen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Put together an easy to run series of persistent data structure benchmarks that can be easily run. For example we would like to submit to this Mozilla ticket http://bugzilla.mozilla.org/show_bug.cgi?id=874174 |
[CLJS-506] Flag to disable minification in advanced mode Created: 19/May/13 Updated: 19/May/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Problem: Proposal:
Attached patch implements this, as a result the compiled test suite is indeed quite readable. |
| Comments |
| Comment by Herwig Hochleitner [ 19/May/13 10:11 AM ] |
|
Patch 0001 depends on patches 0001 and 0002 from CLJS-480 because of changes to the test script. |
[CLJS-505] reduce-kv doesn't work on this dataset Created: 12/May/13 Updated: 12/May/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Ben Burdette | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Chromium browser on kde mint |
||
| Description |
|
reduce-kv seems to fail with certain datasets in clojurescript but works in clojure. plain reduce works in both. Test dataset and functions: (def tst '{0 (0.16245458703559382 0.16299961144753652), 1 (0.17095488518209803 0.1662484375243468), 2 (0.19709700082585824 0.1876248353737042 0.18162592547515274), 3 (0.21941419798490325 0.21807914100386067 0.21533585716040135 0.21307519864852958 0.20703453840254027 0.20459935129415552), 4 (0.2254558759699653 0.22553167887455705 0.2234426184638531), 5 (0.23427611508459756 0.2325434766605363 0.22990656317710662 0.22720478209110223), 6 (0.236386202300682 0.237142940385559 0.23819488667547528 0.23768692982616965 0.23701568705350426 0.2519226069678777), 7 (0.23496439825060444 0.2366135730772095 0.2358487071572212 0.2343505595436482 0.2339754113241729 0.23574632954272087 0.2342899279492302 0.23394402094793673 0.2253325456308313 0.23115349467838542 0.23764956541775945 0.24569178483873644 0.24935940319340053), 8 (0.20547261591662125 0.20726089154784122 0.21592818189465432 0.21750737743637422), 9 (0.18799738410585773 0.195400717149256 0.19631498833296726), 10 (0.1719302696659648 0.17805792401151166 0.18237267730425885), 11 (0.1623645568284537 0.16481390708298796 0.16716904262359314), 12 (0.16156804839942243 0.16211838120784386), 13 (0.16995648347966535 0.16559349825186068), 14 (0.19176771652550495 0.17696322624338934), 15 (0.23973485828855146 0.22420582245618542 0.2145975801770993 0.20208630026741867), 16 (0.2946896009888785 0.28676176338007714 0.28325454941805994 0.2716914099321759 0.26202250017945194 0.25452401319317824 0.2458771184353157), 17 (0.33300741045445653 0.3282046117335755 0.32330639472087175 0.3191873692036449 0.31290612056170736 0.30418343504691503 0.3004101566486822), 18 (0.341869650592079 0.34431149263906713 0.3457698150448536 0.34421452862514235 0.3429726966458358 0.3388988973880783 0.33579154357727864), 19 (0.2968748091051211 0.3023852506442652 0.3121637065261914 0.31141190562184173 0.32205821745972246 0.32898706631919056 0.33322752162957553 0.3396066565159988), 20 (0.2317683974879252 0.24538548478582375 0.2645130722935203 0.27362218406430894), 21 (0.20128274621982342 0.21819083560963268), 22 (0.1732991500114435 0.1811216605973363 0.19151484878018085), 23 (0.16575238432187128)}) ; this returns nil in clojurescript, returns a sorted dataset in clojure. (sortpi tst) ; this version works in both clojurescript and clojure: (sortpi2 tst) |
| Comments |
| Comment by Michał Marczyk [ 12/May/13 10:49 PM ] |
|
Works for me on master. Which version of ClojureScript are you using? |
[CLJS-504] Empty arrays and strings don't seq as nil Created: 06/May/13 Updated: 07/May/13 Resolved: 07/May/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Colin Jones | Assignee: | Colin Jones |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
This is in CLJS v. 0.0-1803 The original symptom was that these objects didn't round-trip properly: cljs.user=> (js->clj (clj->js {}))
{"" nil}
A little more digging shows the underlying issue: cljs.user=> (seq (array)) (nil) The same issue, with the same fix, exists for strings, so I'm including that here as well. |
| Comments |
| Comment by David Nolen [ 07/May/13 12:21 AM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/49144218321bf8c355642fb683f197b05d6d9f8a |
| Comment by Colin Jones [ 07/May/13 5:47 AM ] |
|
Nice, thanks for cleaning up that test. Sorry about that, still working on interpreting the test output. |
[CLJS-503] v8 penalizes coercive nil? Created: 04/May/13 Updated: 04/May/13 |
|
| 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 |
|
We check for nil coercively with != and = because we want to handle both JavaScript null and undefined. These operations are slower than !== and ==. We would like to fix this but we can't simply make nil? not be coercive. The persistent data structures rely on this because they reach into JS Arrays that been allocated with a certain size. However in JS the empty slots are filled with undefined and null requiring the more expensive coercive nil? check. Making nil? non-coercive seems to bring less of performance boost in WebKit/Firefox Nightlies, but v8 is still the king and everyone seems to be moving towards it performance wise. One issue with making nil? non-coercive is that undefined will then fall through many of the core library functions. This means that users will need to be more careful in interop scenarios. |
[CLJS-502] add with-redefs Created: 30/Apr/13 Updated: 08/May/13 Resolved: 08/May/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Colin Jones | Assignee: | Colin Jones |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
This is helpful in JVM Clojure for replacing vars for testing purposes (think mocks/stubs). adding per discussion w/ David Nolen in #clojure IRC |
| Comments |
| Comment by Colin Jones [ 30/Apr/13 11:24 PM ] |
|
This includes an update to binding to avoid ~18 lines of duplication. Happy to prepare a patch with all the duplication rolled back out if there's a good reason for it. |
| Comment by David Nolen [ 08/May/13 12:33 AM ] |
|
fixed http://github.com/clojure/clojurescript/commit/ad771a67df8d69792bb81c04da3ce18fd4837f2c |
[CLJS-501] add boolean coercion fn Created: 28/Apr/13 Updated: 28/Apr/13 Resolved: 28/Apr/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | David Nolen | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
we often type-hint return values as boolean when they are not, we should instead provide a boolean coercion fn like Clojure has. |
| Comments |
| Comment by David Nolen [ 28/Apr/13 10:59 PM ] |
|
this exists |
[CLJS-500] Code Size Issue - Constructors Created: 27/Apr/13 Updated: 04/May/13 Resolved: 04/May/13 |
|
| Status: | Resolved |
| 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 |
|
When compiling something like spectral norm http://github.com/swannodette/cljs-stl/blob/master/src/cljs_stl/spectral/demo.cljs where no ClojureScript data structures are used we still see many constructors in the advanced compiled output. The total KLOC of pretty printed advanced compiled code using master is ~3800. Quick testing shows that the following ctors are present in spectral norm: PersistentTreeMap RedNode BlackNode PersistentTreeMapSeq TransientHashMap PersistentHashMap ArrayNodeSeq NodeSeq HashCollisionNode ArrayNode BitmapIndexedNode TransientArrayMap PersistentArrayMap ObjMap NeverEquiv TransientVector ChunkedSeq PersistentVector VectorNode ChunkedCons ArrayChunk ChunkBuffer LazySeq Keyword Cons EmptyLIst List IndexedSeq We removed the runtime function dependency of cljs.core.PersistentTreeSet/EMPTY, all ctors related to PTSs disappeared. Removing the runtime constructions of the other EMPTY collections seems to have no further effect on code size, probably because we have avoided dependencies elsewhere. |
| Comments |
| Comment by David Nolen [ 27/Apr/13 8:41 PM ] |
|
Another issue looks like recursive relationships between constructors, this occurs with hash map upgrading as well as with transient. Getting ridding rid of the IEditableCollection implementations removes all the transient related constructors from appearing. With this change on master we around ~3580 KLOCs. Coupled with the pr code removed we're down to ~2700 KLOCs. Many constructors magically disappear if we remove the printing code. After some more investigation, it's only necessary to remove pr-str and that puts us at ~2700 KLOCs. It appears my speculation about the variadic functions is way off. Recursive relationships between the core types and functions seems to be the real source of the issue. |
| Comment by David Nolen [ 27/Apr/13 9:26 PM ] |
|
There are many complex dependencies between functions and types currently. For example when writing a type it's tempting to rely on the standard library, but this has repercussions. For example calling map from a deftype implementation means you need to pull in the chunked types! Another example is how PersistentArrayMap and ObjMap both call reduce, in this case reduce doesn't pull in dependencies but it shows a kind of thinking that should probably be avoided in the collections at the heart of ClojureScript. The reduce cases should be probably be replaced with a loop/recur. |
| Comment by David Nolen [ 27/Apr/13 9:51 PM ] |
|
Instead of guessing it might be useful to examine the call graph of the AST - there some instructions on how to do so here http://stackoverflow.com/questions/1385335/how-to-generate-function-call-graphs-for-javascript/12220307#12220307 |
| Comment by David Nolen [ 28/Apr/13 11:43 AM ] |
|
One way to control the amount of mutual reference, move that functionality out into a separate function, this way the usage of a specifc function triggers inclusions of data structures instead of it being implicit to using a particular data structure. A specific example is switching data structures based on size i.e. PAM -> PHM. |
| Comment by David Nolen [ 28/Apr/13 12:54 PM ] |
|
After attempting to limit the inclusion of transients collections in ClojureScript, Closure is indeed very accurate. The real problem is the reliance on convenience fns within deftypes this includes map/reduce/into/etc. for example map will bring in chunked types, into will bring in all transient collections. deftype should really only be written with the language primitives - this is better from a performance perspective anyhow. We should review the deftypes and eliminate the various conveniences where possible. |
| Comment by David Nolen [ 28/Apr/13 1:32 PM ] |
|
Other offenders are the top level extend-type/protocol on JS natives. extend-type nil calls hashcode, IPrintWithWriter includes all the printing machinery, string & array load primseq arrayseq. We should probably adopt the Clojure JVM and dispatch on the types where we can in the library fns themselves at not at the protocol level. |
| Comment by David Nolen [ 04/May/13 12:01 PM ] |
|
This has been addressed in master in a number of commits. (.log js/console "Hello world!") is now ~100 lines of code. There are more enhancements that need further investigation like removing the various transient data structures if unused but this needs more investigation. |
[CLJS-499] Reassess ObjectMap vs. PersistentArrayMap Created: 25/Apr/13 Updated: 20/May/13 Resolved: 20/May/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | David Nolen | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Here are some benchmarks after performance improvements have been applied to PersistentArrayMap in master:
For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.
Again we see nearly identical (or much better) performance at small sizes and much better performance for PAMs as we approach the PHM threshold. |
| Comments |
| Comment by Tyler Tallman [ 07/May/13 12:11 PM ] |
|
When I try to run the jsprefs I get "ReferenceError: cljs_perf is not defined." |
| Comment by David Nolen [ 20/May/13 7:59 AM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/08489f39060be1097fa23abc8d5042c86e68dd4d |
[CLJS-498] Reassess ObjectMap vs. PersistentArrayMap Created: 25/Apr/13 Updated: 25/Apr/13 |
|
| 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 |
|
On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases. |
[CLJS-497] Constant literal optimization Created: 25/Apr/13 Updated: 25/Apr/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | David Nolen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
We should optimize constant literals, in particular keywords. This optimization means that we will have to decide whether to make identical? slower by testing for keywords (this means it's probably a bad idea to continue to inline it) or to provide a special keyword-identical? that does the right thing. |
[CLJS-496] better implementation of char function Created: 20/Apr/13 Updated: 24/Apr/13 Resolved: 24/Apr/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Dave Sann | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
There are a number of compatibility functions that are currently defined as identity functions. Among these, char Suggested better implementation for char: (defn char [code] rather than current (defn char [x] x) (not sure of compatibility with node) |
| Comments |
| Comment by David Nolen [ 22/Apr/13 10:39 AM ] |
|
Good point, thanks for the feedback. |
| Comment by David Nolen [ 24/Apr/13 8:09 PM ] |
|
fixed http://github.com/clojure/clojurescript/commit/877a361da1c6904aa7f372aedf98b5fcf16e1e8d |
[CLJS-495] New undefined? macro that safely handles undeclared variables Created: 16/Apr/13 Updated: 18/Apr/13 Resolved: 18/Apr/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Kevin Lynagh | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The current `undefined?` function will blow up with a JavaScript reference error if you pass it an undeclared variable. It'd be nice to have a way to test if a JavaScript variable has been declared. (when-not (undefined? js/jQuery) ...) to extend-type jQuery when jQuery is around. |
| Comments |
| Comment by David Nolen [ 18/Apr/13 10:53 AM ] |
|
What about bound? as a name for this macro? |
| Comment by Kevin Lynagh [ 18/Apr/13 11:59 AM ] |
|
Yeah, `bound?` sounds like an appropriate name to me. |
| Comment by David Nolen [ 18/Apr/13 2:36 PM ] |
|
Stuart Sierra pointed out that `bound?` may have too many connotations already in Clojure. Maybe `exists?`? |
| Comment by David Nolen [ 18/Apr/13 5:15 PM ] |
|
fixed http://github.com/clojure/clojurescript/commit/3ee148acac436dd489396fc6783ba72bbd7ff79f |
[CLJS-494] -lookup method call inside get macro and keyword invoke Created: 10/Apr/13 Updated: 14/Apr/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Daniel Skarda | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
ClojureScript from githhub |
||
| Description |
|
I noticed that -lookup method is called incorrectly at two places There are two -lookup methods defined for ILookup: cljs/cljs/core.cljs:198 clj/cljs/core.clj:426 As you see, macro (get foo bar) never calls first method. In first case it supplies default argument (instead calling method with 2 arguments). Same for IFn and keywords: (deftype Keyword [k] |
| Comments |
| Comment by Jozef Wagner [ 12/Apr/13 3:37 AM ] |
|
Note that 2 argument get guarantees to return nil if the key is not found. This differs from e.g. 2 argument nth, which should throw if key is not found (index is out of bounds). If 2 argument -lookup does not guarantee to return nil when key is not found, we should keep it as it is. |
| Comment by Michał Marczyk [ 12/Apr/13 5:13 AM ] |
|
get insisting on nil is definitely by design, as explained by Jozef. So, there is no bug here. As a matter of style it might be good to have get-the-function and get-the-macro do exactly the same thing; the question remains whether we should add an explicit nil to the -lookup call in get-the-function or remove the nil from the macro and just rely on -lookup to do the right thing. I'd probably go for the former to eliminate one unnecessary indirection (described below). About -lookup "doing the right thing": it certainly seems to me that -lookup's contract is that of get, even if this is not explicitly documented; also, in almost all instances the binary -lookup delegates to ternary -lookup or ternary -nth (with nil supplied as the final argument), the exception being TransientHashMap's -lookup which basically has that call inlined. Note that the binary -lookup is called is also called in some other places in core.cljs. |
| Comment by David Nolen [ 14/Apr/13 5:57 PM ] |
|
Yes the main idea behind inlining get into -lookup was because they do essentially the same thing and we can remove a level of indirection. Similarly I'd prefer that we add the nil to -lookup to avoid the the indirection if not given a not-found value. |
[CLJS-493] get should accept any type the same way Clojure JVM does Created: 03/Apr/13 Updated: 05/Apr/13 Resolved: 05/Apr/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | David Nolen | Assignee: | Michał Marczyk |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
The following throws instead of returning nil: (get 42 :anything) |
| Comments |
| Comment by Michał Marczyk [ 03/Apr/13 4:50 PM ] |
|
clojure.lang.RT-style fix. From the commit message: The fix involves changes to both core.cljs and core.clj, since get is backed by a macro. Tests are introduced for both direct and higher-order calls. |
| Comment by Michał Marczyk [ 03/Apr/13 4:52 PM ] |
|
Incidentally, I've prepared the patch on top of patches for |
| Comment by David Nolen [ 04/Apr/13 6:57 PM ] |
|
I'd prefer that the macro not emit a conditional check. I think it's probably OK if we just provide a default case for ILookup. Thanks. |
| Comment by Michał Marczyk [ 04/Apr/13 7:14 PM ] |
|
Sure, here's a new patch, with a default case provided for ILookup and the tests from the previous patch. Both macro and function unchanged, since with this change everything satisfies? ILookup. Out of curiosity, why the preference? Do you think this sort of expansion jumping in at the wrong place could pose problems for GClosure? |
| Comment by David Nolen [ 04/Apr/13 7:17 PM ] |
|
Thanks get is just extremely common and likely to appear in expression cases - where the CLJS compiler will emit a function. If these get too nested GClosure won't handle them and it's a pretty big perf hit. |
| Comment by Michał Marczyk [ 04/Apr/13 7:27 PM ] |
|
Right, thanks. |
| Comment by David Nolen [ 05/Apr/13 9:30 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/7b9fccd9a2502c1984c1880176a6b0d310151520 |
[CLJS-492] avoid producing unnecessary calls to next in emit-apply-to Created: 01/Apr/13 Updated: 05/Apr/13 Resolved: 05/Apr/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Michał Marczyk | Assignee: | Michał Marczyk |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
A function like (defn bar [a b c d e f g h i j & more]) currently receives a cljs$lang$applyTo property of the following form: function (arglist__4466) {
var a = cljs.core.first(arglist__4466);
var b = cljs.core.first(cljs.core.next(arglist__4466));
var c = cljs.core.first(cljs.core.next(cljs.core.next(arglist__4466)));
var d = cljs.core.first(cljs.core.next(cljs.core.next(cljs.core.next(arglist__4466))));
var e = cljs.core.first(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(arglist__4466)))));
var f = cljs.core.first(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(arglist__4466))))));
var g = cljs.core.first(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(arglist__4466)))))));
var h = cljs.core.first(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(arglist__4466))))))));
var i = cljs.core.first(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(arglist__4466)))))))));
var j = cljs.core.first(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(arglist__4466))))))))));
var more = cljs.core.rest(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(cljs.core.next(arglist__4466))))))))));
return bar__delegate(a, b, c, d, e, f, g, h, i, j, more);
}
The forthcoming patch changes that to function (arglist__4460) {
var a = cljs.core.first(arglist__4460);
arglist__4460 = cljs.core.next(arglist__4460);
var b = cljs.core.first(arglist__4460);
arglist__4460 = cljs.core.next(arglist__4460);
var c = cljs.core.first(arglist__4460);
arglist__4460 = cljs.core.next(arglist__4460);
var d = cljs.core.first(arglist__4460);
arglist__4460 = cljs.core.next(arglist__4460);
var e = cljs.core.first(arglist__4460);
arglist__4460 = cljs.core.next(arglist__4460);
var f = cljs.core.first(arglist__4460);
arglist__4460 = cljs.core.next(arglist__4460);
var g = cljs.core.first(arglist__4460);
arglist__4460 = cljs.core.next(arglist__4460);
var h = cljs.core.first(arglist__4460);
arglist__4460 = cljs.core.next(arglist__4460);
var i = cljs.core.first(arglist__4460);
arglist__4460 = cljs.core.next(arglist__4460);
var j = cljs.core.first(arglist__4460);
var more = cljs.core.rest(arglist__4460);
return bar__delegate(a, b, c, d, e, f, g, h, i, j, more);
}
The included benchmark seems to demonstrate a substantial reduction in {apply} overhead on V8 for a function with 10 positional arguments preceding the rest arg and a less substantial reduction for a function with 2 positional arguments, as one would expect. The other benchmark entries for {apply} remain in the same ballpark ({list} actually produces the same compilation output with or without the patch; {+} is changed, but only slightly). |
| Comments |
| Comment by David Nolen [ 05/Apr/13 9:30 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/1a094e41ba482de1bc2e363874cdb29414bdac46 |
[CLJS-491] subvec should avoid creating layered Subvecs Created: 31/Mar/13 Updated: 05/Apr/13 Resolved: 05/Apr/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Michał Marczyk | Assignee: | Michał Marczyk |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
cljs.core/subvec (or rather build-subvec, the implementation detail behind it) currently fails to check whether its vector argument is already a Subvec and, if so, base the new Subvec off the original regular vector. The Clojure implementation does perform the unwrapping. The forthcoming patch fixes this and includes a basic test. |
| Comments |
| Comment by David Nolen [ 05/Apr/13 9:30 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/3ca249a5a3ad07586c91b143463374a89d1fcf25 |
[CLJS-490] cljs.closure/get-upstream-deps* should use RT/baseLoader instead of the TCCL Created: 25/Mar/13 Updated: 25/Mar/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Toby Crawley | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
get-upstream-deps* currently uses the context classloader for the current thread, which causes issues when called from within a clojure runtime that has the intended classloader bound to Compiler.LOADER. Is there a specific reason to use the TCCL directly, or would calling RT.baseLoader suffice here? I'm attaching a patch that uses baseLoader instead. |
| Comments |
| Comment by Toby Crawley [ 25/Mar/13 10:12 AM ] |
|
On further examination, this change may not make sense. Clojure itself uses the TCCL directly and ignores baseLoader when locating resources. |
[CLJS-489] Browser-REPL automation & usability enhancements Created: 22/Mar/13 Updated: 30/Mar/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Chas Emerick | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
The current implementation of browser-REPL yields a number of usability problems:
Attached is a patch that addresses these issues:
(cljs.repl/repl (cljs.repl.browser/exec-env
:exec-cmds ["open" "-ga" "/Applications/Google Chrome.app"]))
(This enhancement has been discussed previously {here|http://groups.google.com/group/clojurescript/browse_thread/thread/963d6b7334bdf61c}.) |
| Comments |
| Comment by Chas Emerick [ 22/Mar/13 3:24 AM ] |
|
Aside: if this is accepted, a fair bit of documentation on the github wiki (and maybe dev.clojure.org wiki?) will need to be updated (something I'm happy to do FWIW). |
| Comment by Chas Emerick [ 22/Mar/13 3:54 PM ] |
|
I just discovered that cljs.repl.reflect depends directly upon cljs.repl.server. I'll have to unroll that in order to be able to remove the latter... |
| Comment by Brenton Ashworth [ 29/Mar/13 5:24 PM ] |
|
Thanks for working on this Chas. This has been in need of improvement for a long time. Can't wait to take this for a spin. |
| Comment by Chas Emerick [ 30/Mar/13 8:43 AM ] |
|
I've never used cljs.repl.reflect, so I had to take a close look at what it supports, thus the delay. First, background: cljs.repl.reflect provides backing support for two operations:
These operations are exposed within the ClojureScript REPL via clojure.reflect/doc and clojure.reflect/macroexpand, respectively. I see a couple of issues here. First, aside from the problems in their current implementations (e.g. clojure.reflect/doc does not re-sugar arglists prior to printing them), both of these operations (doc and macroexpand) can simply be provided by macros, eliminating any dependence on a particular REPL environment/implementation. e.g., this does well for `doc`: (defmacro doc
[fq-sym]
(let [meta (get-meta fq-sym)]
`(do
(println "-------------------------")
(println ~(:name meta))
(println ~(pr-str (map (partial mapv :name) (read-string (:method-params meta)))))
(println " " ~(:doc meta)))))
A similar macro for macroexpand is trivial to produce. Second, doc and macroexpand just don't belong in clojure.reflect. AFAICT, clojure.* namespaces in ClojureScript should be maximally isomorphic to their Clojure namesakes. This means that doc should be in clojure.repl; placing macroexpand is a little trickier, but perhaps a default-referred macro in cljs.core would make sense? (clojure.core/macroexpand is obviously already taken.) So, my tl;dr plan (which I'll make concrete in a patch after circulating this comment on various mailing lists to get feedback) is: 1. reimplement doc and macroexpand as macros in more appropriate namespaces This should clear the way for the improved browser-REPL to land. |
[CLJS-488] aliased keywords do not work Created: 20/Mar/13 Updated: 21/Mar/13 Resolved: 21/Mar/13 |
|
| Status: | Resolved |
| 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 |
|
The folks from Pedestal encountered this. |
| Comments |
| Comment by David Nolen [ 21/Mar/13 10:05 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/69741f2af76035e4adf1e6333c502095581b2179 |
[CLJS-487] Make cljsc copy js sources to public directory Created: 16/Mar/13 Updated: 16/Mar/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | John Chijioke | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | cljs, cljsc, js | ||
| Environment: |
Linux jetty web server |
||
| Description |
|
I'll like cljsc to copy my js sources to the public directory as it does when compiling the cljs sources and make the correct entry in the generated deps.js so that the source can be retrievable with GET without extra configuration. |
[CLJS-486] Consider to export cljs.core.*print-fn* Created: 12/Mar/13 Updated: 17/Mar/13 Resolved: 17/Mar/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Roman Scherer | Assignee: | Roman Scherer |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
External tools often have the need to redefine ClojureScript's This works fine in whitespace and simple mode because the Since it looks like redefining cljs.core.print-fn is common References:
|
| Comments |
| Comment by Roman Scherer [ 12/Mar/13 3:20 PM ] |
Unfortunatly it's not that easy. Advanced compilation is quite a
beast. I added :export true to the meta data of *print-fn*, build a
ClojureScript release and put it into my local Maven repo. Changed the
ClojureScript version in clojurescript.test and recompiled. The var is
exported:
function s() {
d(Error("No *print-fn* fn set for evaluation environment"))
}
fa("cljs.core._STAR_print_fn_STAR_", s);
The fn "fa" is the goog/exportSymbol fn, which (i guess) builds up
some nested object and finally assigns "s" under the proper path.
function fa(a, b) {
var c = a.split("."), e = ba;
!(c[0] in e) && e.execScript && e.execScript("var " + c[0]);
for(var f;c.length && (f = c.shift());) {
!c.length && b !== g ? e[f] = b : e = e[f] ? e[f] : e[f] = {}
}
}
Assigning cljs.core._STAR_print_fn_STAR_ from the outside just points
anyone actually calling cljs.core._STAR_print_fn_STAR_ to the new
function. I tried this in clojurescript.test:
#!/usr/bin/env phantomjs
// reusable phantomjs script for running clojurescript.test tests
// see http://github.com/cemerick/clojurescript.test for more info
var p = require('webpage').create();
p.injectJs(require('system').args[1]);
p.onConsoleMessage = function (x) { console.log(x); };
// p.evaluate(function () {
// cemerick.cljs.test.set_print_fn();
// });
p.evaluate(function () {
// Try to redefine cljs.core._STAR_print_fn_STAR_
console.log(cljs.core._STAR_print_fn_STAR_);
cljs.core._STAR_print_fn_STAR_ = function (x) {
x = x.replace(/\n/g, "");
console.log(x);
};
// BUT THIS HAS TO BE REDEFINED
console.log(s);
s = function (x) {
x = x.replace(/\n/g, "");
console.log(x);
};
});
var success = p.evaluate(function () {
var results = cemerick.cljs.test.run_all_tests();
console.log(results);
return cemerick.cljs.test.successful_QMARK_(results);
});
phantom.exit(success ? 0 : 1);
Anyone else calling the renamed "s" still has a problem. We actually
need to reasign "s", which external tools still don't know by name.
In clojurescript.test I solved this dilemma by providing
something like this:
(defn ^:export set-print-fn! [f]
(set! cljs.core.*print-fn* f))
and pass the print fn as an argument
cemerick.cljs.test.set_print_fn_BANG_(function(x) {
x = x.replace(/\n/g, "");
console.log(x);
});
In summary, exporting *print-fn* does not help as I initially
thought. You have to get to the renamed var. We could provide the
mentioned set-print-fn! from above for tools to use. But then
this could be done by tools themself.
Any other thoughts?
|
| Comment by David Nolen [ 14/Mar/13 6:58 PM ] |
|
I'm fine with this change. Patch welcome. |
| Comment by Roman Scherer [ 14/Mar/13 7:26 PM ] |
|
Ok, here is the patch. |
| Comment by David Nolen [ 17/Mar/13 3:10 PM ] |
|
fixed, |
[CLJS-485] clojure.string/replace ignores regex flags Created: 12/Mar/13 Updated: 12/Mar/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Esa Virtanen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug, patch, test | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
The replace function in namespace clojure.string ignores regex flag provided in the match pattern. For example: CLJS clojure.string/replace "I am NOT matched" #"(?i)not " "") => "I am NOT matched" CLJ clojure.string/replace "I am NOT matched" #"(?i)not " "") => "I am matched" The attached patch fixes this by parsing the m and i flags, if set, from the match object, instead of explicitly setting only "g". |
[CLJS-484] defmulti compiler macro tries to throw a blank string in error case Created: 10/Mar/13 Updated: 12/Mar/13 Resolved: 12/Mar/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Test case > (defmulti foo bar {:hierarchy h}) with the attached patch this is |
| Comments |
| Comment by Herwig Hochleitner [ 10/Mar/13 10:22 PM ] |
|
Feels kind of stupid to open a ticket for this. |
| Comment by David Nolen [ 12/Mar/13 10:46 AM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/2e1ee414689547c65c0feafd157048ccecd5c3ad |
[CLJS-483] Wrap cljs.compiler/compile-file in try/catch to clarify which file failed compilation Created: 07/Mar/13 Updated: 12/Mar/13 Resolved: 12/Mar/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Thomas Heller | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
lein-cljsbuild compiles files via cljs.closure/compile-dir which in turn calls compile-file. If one file fails to compile it can be rather hard to find out which file caused the error since the reference to the file is lost. The patch ensures that the file is known and wraps the compile exception. See example confusing trace: And the more helpful version: |
| Comments |
| Comment by David Nolen [ 12/Mar/13 10:49 AM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/1ad0b8de131d529afee38c18334e129574985691 |
[CLJS-482] Rhino REPL env prints to System/out Created: 05/Mar/13 Updated: 14/Mar/13 Resolved: 14/Mar/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
All non-terminal REPLs bind *out*, so printing REPL output to System/out is unexpected (and sometimes black-holed depending on the environment). Attached patch binds *out* in place of System/out in the Rhino evaluation Context. |
| Comments |
| Comment by Chas Emerick [ 05/Mar/13 7:03 AM ] |
|
Attached wrong patch initially. |
| Comment by David Nolen [ 14/Mar/13 7:15 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/ab6325dc1619e1629d51a0f0a8bcb42dd380a39e |
[CLJS-481] doseq bindings with :let not properly scoped Created: 03/Mar/13 Updated: 11/Apr/13 Resolved: 09/Apr/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Gary Fredericks | Assignee: | David Nolen |
| Resolution: | Completed | Votes: | 1 |
| Labels: | None | ||
| Description |
|
This seems to be a subtler version of (let [fs (atom [])]
(doseq [x (range 4)
:let [y (inc x)
f (fn [] y)]]
(swap! fs conj f))
(map #(%) @fs))
;; => (4 4 4 4)
;; should be (1 2 3 4)
I think this example is minimal. The bug is not present if we use a proper let. |
| Comments |
| Comment by Michał Marczyk [ 06/Apr/13 4:49 PM ] |
|
It appears that this works correctly on current master. In fact, it worked correctly on r1576 – but not on r1552. Also, splitting the :let into two ("adjacent") :let's fixes this, whereas moving both the y and f bindings into a single regular let inside the doseq does not. That means it's probably an instance of |
| Comment by David Nolen [ 08/Apr/13 4:53 PM ] |
|
So I'm assuming we can just close this one? |
| Comment by Michał Marczyk [ 08/Apr/13 7:50 PM ] |
|
Yeah, seems so. |
| Comment by David Nolen [ 09/Apr/13 3:07 AM ] |
|
added test, this test passes on master, http://github.com/clojure/clojurescript/commit/a1b41bed8921dbd9ef9ee7d735b158ae71ed6132 |
| Comment by Gary Fredericks [ 11/Apr/13 9:34 PM ] |
|
Sounds good to me. Thanks! |
[CLJS-480] *cljs-data-readers* is bound to *data-readers* inconsistently Created: 01/Mar/13 Updated: 21/May/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
It looks like *cljs-data-readers* is not being bound to *data-readers* where it should be. At a minimum, cljs.repl/load-stream does not. The practical effect of this instance is that e.g. (load-file "some/cljs/file.cljs") will fail if that file or any other contains a user-defined literal tag. Similar behaviour exists elsewhere, e.g. (load-namespace 'some.cljs.ns) will not load a namespace that contains user-defined tags (I think that one is due to *cljs-data-readers* not being bound in the analyzer). This is related to CLJS-479 insofar as it's another symptom of ClojureScript loading code in subtly different ways in multiple places. I'm happy to do either of:
I'm somewhat hesitant re: (2) insofar as the specific requirements of the compiler and analyzer and REPL may be divergent in ways that I'm not yet aware of, but it seems like it's worth a shot. |
| Comments |
| Comment by Herwig Hochleitner [ 17/May/13 3:10 PM ] |
|
Attached patch 0001 binds data-readers in cljs.compiler/parse-ns. This allows the compiler to run, even if files with reader tags are already compiled. This in turn allows multiple test compilations to be brought back, which I'll submit as part of a patch for an additional debugging flag, if nobody beats me to it. I think this won't fix load-file |
| Comment by Herwig Hochleitner [ 17/May/13 5:25 PM ] |
|
Patch 0002 is my overhaul for the test script. Note: On my machine, with SpiderMonkey 185, the test case (not (integer? 1e+308)) fails. It probably doesn't have to do anything with the removed -n flag (there is no js -n omm), I just wanted to mention it. |
| Comment by David Nolen [ 21/May/13 10:06 AM ] |
|
Please move the test script patch to a different ticket. Thanks. |
[CLJS-479] load-file in REPL improperly qualifies current-namespace ::keywords Created: 28/Feb/13 Updated: 24/Apr/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
This can be seen by opening a REPL and: (load-file "cljs/ns_test/foo.cljs")
The ::foo keyword in that file is resolved improperly: ClojureScript:cljs.user> cljs.ns-test.foo/kw :user/foo cljs.repl/load-stream needs to force *ns* to track *cljs-ns* so that the Clojure reader will properly resolve auto-namespacing keywords. A patch is attached that does this, ensuring that any Clojure namespaces created solely for this purpose are removed. |
| Comments |
| Comment by Chas Emerick [ 28/Feb/13 4:53 AM ] |
|
Note that there are two other places where the Clojure reader is used in ClojureScript — one in the analyzer, one in the compiler — where a similar fix may be required. Perhaps cljs.compiler/forms-seq should be the sole place where the Clojure reader is used with *ns* properly tracked therein... |
| Comment by David Nolen [ 24/Apr/13 9:49 PM ] |
|
Is this fixed in master? |
[CLJS-478] ClojureScript js->clj not converting Created: 26/Feb/13 Updated: 26/Feb/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Mike Longworth | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
ClojureScript 0.0-1586 build #22, Chrome, OSX |
||
| Description |
|
I've updated to 0.0-1586 build #22 from a much older release: 0.0-1450 I'm now geting a problem with (js->clj token) not converting token to a map; this worked before I upgraded. token is generated by the google OAuth 2 process: "gapi.auth.authorize" I don't think the problem is with js->clj rather something about token so it isn't recognised as a js/Object. (println (expose token true)) gives: access_token = ya29.AHES6ZSgnk3Ws5bB-2aDx41Bbr335hKugjZJfcNAs83d121S306fxy64 This looks ok. however gives: "Error evaluating:" token :as "esef.client.evidence.token" > (type token) gives a blank line. I think this is why js->clj isn't converting. > (alength token) gives a blank line. (.-token_type token) Correctly gives ya29.AHES6ZSgnk3Ws5bB-2aDx41Bbr335hKugjZJfcNAs83d121S306fxy64 I haven't managed to recreate 'token' with a minimal test case but I'm fairly new to javascript. It's impractical to to include my OAuth 2 code because its tied into all my google security. As a work-around I manually create the MAP by explicitly reading each property, I couldn't get a list of properties. |
| Comments |
| Comment by David Nolen [ 26/Feb/13 11:00 AM ] |
|
type just returns the constructor property of an Object. For some reason this is returning undefined instead of value. It's likely that this has nothing to do with ClojureScript and more to do with Google Closure. Have you investigated whether the OAuth token constructor has changed in Closure itself? |
| Comment by Mike Longworth [ 26/Feb/13 11:21 AM ] |
|
I don't think the token object or the apis have any significant relationship with closure, they are loaded dynamically from google (gapi.client.load): |
| Comment by David Nolen [ 26/Feb/13 11:25 AM ] |
|
Did type return something for you instead of undefined in 1450? |
| Comment by Mike Longworth [ 26/Feb/13 11:40 AM ] |
|
Sorry I can't answer that; js->clj just worked so I didn't probe too deeply but looking at the code in js->clj It looks like it must have. I tried the original implementation of js->clj before the recent changes but confirmed this still suffers from the same problem (type x) js/Object): (defn js->clj |
[CLJS-477] Variable argument functions break when first vararg is undefined Created: 23/Feb/13 Updated: 26/Feb/13 Resolved: 26/Feb/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Matjaz Gregoric | Assignee: | Matjaz Gregoric |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
If the first of the variable arguments to a vararg function is the javascript value undefined, the function behaves as though it didn't receive any variable arguments at all: (defn f [& rest] rest) (f 1 2 3) ;; => (1 2 3) ; correct (f 1 js/undefined 3) ;; => (1 nil 3) ; correct (f js/undefined 2 3) ;; => nil ; wrong |
| Comments |
| Comment by Matjaz Gregoric [ 23/Feb/13 11:11 PM ] |
|
Attaching a patch that determines whether varargs were passed to the function by examining arguments.length rather than checking the first argument in the vararg position with goog.isDef(arg). |
| Comment by David Nolen [ 25/Feb/13 3:40 PM ] |
|
This looks good, thanks! |
| Comment by David Nolen [ 26/Feb/13 7:45 AM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/17f9c53e2c10f8565a1070df492d0b06028cdeec |
[CLJS-476] Reading a value from a module does not work if the module is def'ed Created: 22/Feb/13 Updated: 22/Feb/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Paul Gearon | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | Compiler, bug, scope | ||
| Environment: |
Clojure 1.5.0-RC16 |
||
| Description |
|
Referring to a value in a module can have a scoping issue when using the "static accessor" operator of module/VALUE_NAME. The static accessor works if the module is loaded into a local value but not if def'ed. This example uses the mmap module for Node.js, and successfully reads the PROT_READ value: (ns stat.core) This correctly prints "value: 1" However, if the value for m is def'ed instead, then the compiler assumes that the reference to m is local to the function and therefore not defined: (ns stat.core) /Users/pag/src/test/clj/stat/target/stat.js:12836 In this case, the value of m.PROT_READ should have been stat.core.m.PROT_READ. On the other hand, using . syntax fixes the scoping issue: |
[CLJS-475] Node.js target fails with optimizations set to :none or :whitespace Created: 21/Feb/13 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Paul Gearon | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | Compiler, bug | ||
| Environment: |
Clojure 1.5.0-RC16 |
||
| Attachments: |
|
| Description |
|
Compiling a hello world program for Node.js works fine if using optimizations of :advanced or :simple, but if using :none or :whitespace then an error will be reported for either "goog undefined" or "goog.string" undefined respectively. The program is shown here: (ns pr.core) This program is in src/cljs/pr/core.cljs. The repl line used to compile is: When compiled with optimizations of :none, the output is: $ node src/js/pr.js /Users/pag/src/test/clj/pr/src/js/pr.js:1 — $ node src/js/pr.js /Users/pag/src/test/clj/pr/src/js/pr.js:493 — $ node src/js/pr.js — |
| Comments |
| Comment by Paul Gearon [ 21/Feb/13 4:40 PM ] |
|
Remaining generated files |
| Comment by David Nolen [ 25/Feb/13 3:46 PM ] |
|
This is a known bug. We need goog.require/provide to actually mean something to Node.js. I'm not sure how this can be made to work. I've been hoping for a patch for this since ClojureScript was first announced, but I haven't seen anything yet. |
[CLJS-474] Name every fn in CLJS sources (for debugging purposes) Created: 18/Feb/13 Updated: 18/Feb/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Thomas Heller | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
As mentioned here: https://groups.google.com/forum/?fromgroups=#!topic/clojurescript/ZX6M4KXx8I8 Naming every fn in the compiled javascript functions makes it a little easier to find out whats going on when looking at a stacktrace. This patch names every function generated as fn_<ns>/<orig-name>_<line>. See example stacktrace in the discussion above. The optional cljs snippet (https://gist.github.com/thheller/4972200) then also transforms this data and prints functions as (pr-str name) instead of dumping the javascript source on you. The .patch has the drawback that the generated source size grows a bit (about 10% on my codebase), but advanced compilation takes care of that (although even that is still a bit larger, the closure compiler doesnt seem to strip unused function names). One could make this a compiler option if the size differences are too big. |
[CLJS-473] cljs.closure/add-dep-string calls wrong munge Created: 18/Feb/13 Updated: 19/Feb/13 Resolved: 19/Feb/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Jozef Wagner | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
latest CLJS |
||
| Attachments: |
|
| Description |
|
cljs.closure/add-dep-string calls wrong munge (Clojure one), while it should be calling cljs.compiler/munge. The problem shows up when namespace contains a reserved js name and incremental dev build is performed. |
| Comments |
| Comment by David Nolen [ 19/Feb/13 8:50 AM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/896a1421ed720628f8d1a58c9a97050f2885d4bb |
[CLJS-471] Empty regexp causes Closure Compiler error Created: 13/Feb/13 Updated: 25/Apr/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Bodil Stokke | Assignee: | Michał Marczyk |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
An empty regexp of the form #"" compiles to //, which is not an empty regexp but a comment, causing the code following the supposed regexp on the affected line to be commented out. This tends to cause compiler errors when Closure Compiler tries to parse it. #"" should instead produce either /(?:)/ or new RegExp(""). |
| Comments |
| Comment by Michał Marczyk [ 06/Apr/13 6:50 PM ] |
|
Commit message: CLJS-471: prevent empty regexps from causing compiler errors
This patch chooses to emit
(new RegExp(""))
rather than
/(?:)/
so that (pr-str #"") returns
"#\"\""
rather than
"#\"(?:)\""
A test for the above is included.
|
| Comment by David Nolen [ 24/Apr/13 9:52 PM ] |
|
I tried applying this in master, the included test fails. |
| Comment by Michał Marczyk [ 25/Apr/13 5:57 AM ] |
|
Thanks for letting me know. I've checked the value of new RegExp("").source in a Node.js REPL (0.10.3) and it turns out to be '(? |
[CLJS-470] defprotocol warnings in REPL outside of cljs.user Created: 13/Feb/13 Updated: 13/Feb/13 Resolved: 13/Feb/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Nicola Mometto | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Comments |
| Comment by Jonas Enlund [ 13/Feb/13 11:12 AM ] |
|
What is the point of this line? It seems to be a primitive kind of resolve-var? If this line is removed (and also the calls to fqn a few lines below) the errors are gone. The effect of removing fqn is that (defprotocol Foo (f [x])) expands to (cljs.core/defn f ([x] (if (cljs.core/and x (. x -foo$Foo$f$arity$1)) (. x foo$Foo$f$arity$1 x) (cljs.core/let [x__2284__auto__ (if (cljs.core/nil? x) nil x)] ((cljs.core/or (cljs.core/aget f (goog.typeOf x__2284__auto__)) (cljs.core/aget f "_") (throw (cljs.core/missing-protocol "Foo.f" x))) x))))) instead of (cljs.core/defn f ([x] (if (cljs.core/and x (. x -foo$Foo$f$arity$1)) (. x foo$Foo$f$arity$1 x) (cljs.core/let [x__2284__auto__ (if (cljs.core/nil? x) nil x)] ((cljs.core/or (cljs.core/aget foo.f (goog.typeOf x__2284__auto__)) (cljs.core/aget foo.f "_") (throw (cljs.core/missing-protocol "Foo.f" x))) x))))) Note the missing "foo." in (cljs.core/get ...) |
| Comment by David Nolen [ 13/Feb/13 11:32 AM ] |
|
Can we please get a patch that doesn't change whitespace, thanks! Also a comment on the patch explaining precisely how this addresses issues at the REPL would be nice. |
| Comment by David Nolen [ 13/Feb/13 12:19 PM ] |
|
I believe the issue is really the following: user>(ns foo) foo>(fn [] foo.-woz) Will trigger a resolution warning even tho foo.-woz is an interop/implementation form, not a real way to specify Clojure vars. We should probably change to resolve-var in analyzer to not warn on cases like this. |
| Comment by David Nolen [ 13/Feb/13 12:36 PM ] |
|
Fixed in master http://github.com/clojure/clojurescript/commit/e33a6ba9c4b6e8d744e1ac2f3e784822459a5530 |
[CLJS-469] Bad Exception message when multimethod has no dispatch-fn Created: 12/Feb/13 Updated: 20/Feb/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Thomas Heller | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
When a multi-fn has no dispatch method for a given value the current exception string prints the cljs.core/name function instead of the actual name of the mf. Minor bug but makes it kinda hard to track down which multi-fn actually failed to dispatch. The attached patch fixes that but directly accessing the name property of the multi-fn which is not very clean but better than the current error. AFAICT cljs doesnt have the clojure.lang.Named protocol, which would probably be cleaner. |
| Comments |
| Comment by Thomas Heller [ 12/Feb/13 6:12 AM ] |
|
Corrected the .patch |
| Comment by David Nolen [ 19/Feb/13 8:54 AM ] |
|
ClojureScript now has an INamed protocol |
| Comment by Thomas Heller [ 20/Feb/13 3:42 PM ] |
|
Updated the .patch to implement INamed for cljs.core/MultiFn, turning its name into a real symbol. Tests pass but I dont know if that part of the code is actually tested. |
| Comment by Thomas Heller [ 20/Feb/13 3:43 PM ] |
|
Oh, I'm not quite sure that the way I resolved the namespace for the symbol is totally correct. It works but I had to dig a bit. |
[CLJS-468] Extend CollFold and IKVReduce to nil Created: 12/Feb/13 Updated: 01/Mar/13 Resolved: 01/Mar/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Minor |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
This has been accepted and fixed for Clojure in |
| Comments |
| Comment by David Nolen [ 19/Feb/13 8:55 AM ] |
|
Is there a patch for this? |
| Comment by Herwig Hochleitner [ 27/Feb/13 9:10 PM ] |
|
Attached patches test and implement |
| Comment by David Nolen [ 01/Mar/13 1:24 PM ] |
|
fixed http://github.com/clojure/clojurescript/commit/e1e14cb2e0437fae2ba5e5c194b1b3e8d2f23b59 |
[CLJS-467] ArrayNode's kv-reduce skips certain nodes Created: 07/Feb/13 Updated: 19/Feb/13 Resolved: 19/Feb/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Moritz Heidkamp | Assignee: | Michał Marczyk |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
When gaps are present in an ArrayNode's array, kv-reduce would skip nodes after the first gap due to a missing else branch. |
| Comments |
| Comment by David Nolen [ 07/Feb/13 6:46 PM ] |
|
Michal, does this seem correct to you? |
| Comment by Michał Marczyk [ 07/Feb/13 7:21 PM ] |
|
Yes, it does! Good catch. |
| Comment by David Nolen [ 19/Feb/13 9:02 AM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/6dc1cafba44fb137ded63f106da694daf93c9621 |
[CLJS-466] Records are printed without namespace Created: 05/Feb/13 Updated: 26/Feb/13 Resolved: 26/Feb/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Thomas Heller | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Any |
||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
When printing a Record it is currently printed without the proper namespace. (ns dummy) will print as "#dummy.Foo{..." in CLJ but "#Foo{..." in CLJS. The attached patch fixes the implementation as well as the "incorrect" test. |
| Comments |
| Comment by David Nolen [ 06/Feb/13 11:39 AM ] |
|
Thanks, have you submitted your CA? |
| Comment by Thomas Heller [ 06/Feb/13 3:57 PM ] |
|
Will do ASAP, I'm in Germany so its probably gonna take a week or so. |
| Comment by David Nolen [ 26/Feb/13 10:52 AM ] |
|
This patch was not properly created. Please follow the example demonstrated here - http://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git |
| Comment by Thomas Heller [ 26/Feb/13 12:14 PM ] |
|
Patch updated. I sent me CA over 2 weeks ago, should I assume it was lost and try again or does it usually take this long? |
| Comment by David Nolen [ 26/Feb/13 12:18 PM ] |
|
Fixed, http://github.com/clojure/clojurescript/commit/8aa0cd7a0ba3f8466fcde83558ce83f275b61b32 It looks like your CA made it just fine, thank you very much for the contribution! |
| Comment by Thomas Heller [ 26/Feb/13 12:23 PM ] |
|
Ah, awesome. Thanks. |
[CLJS-465] Point to ClojureScript instead of Clojure mailing list in README.md Created: 05/Feb/13 Updated: 06/Feb/13 Resolved: 06/Feb/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Minor |
| Reporter: | Kanwei Li | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Summary self explanatory |
| Comments |
| Comment by David Nolen [ 06/Feb/13 11:35 AM ] |
|
The ClojureScript mailing list is a community run user list. I've added a link. There is no good reason to only direct people interested in ClojureScript there. |
[CLJS-464] `get-in` not behaving like Clojure when accessing non-existing inner maps Created: 26/Jan/13 Updated: 28/Jan/13 Resolved: 28/Jan/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Roman Gonzalez | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | bug | ||
| Environment: |
Gentoo 64, oracle-jvm |
||
| Attachments: |
|
| Description |
|
In Clojurescript: In Clojure: |
| Comments |
| Comment by Roman Gonzalez [ 26/Jan/13 11:01 PM ] |
|
Code and Test patch v1 |
| Comment by David Nolen [ 27/Jan/13 5:25 PM ] |
|
Isn't this a duplicate of |
| Comment by Roman Gonzalez [ 28/Jan/13 10:06 PM ] |
|
Hey David, Thanks for your prompt reply, I tested latest version of github's master with the test-case I added and got this error. ```shell SPIDERMONKEY_HOME not set, skipping SpiderMonkey tests The test case is: ```gitdiff ;; arrays In case github's master is not the latest one, and test works on master, please discard this message. Cheers. |
| Comment by David Nolen [ 28/Jan/13 10:39 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/2b21e9d5b09cdd09f2831d11810fa2c5ae4f14b1 |
[CLJS-463] Google Closure Class interop form (genclass) Created: 26/Jan/13 Updated: 11/May/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | David Nolen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Description |
|
Currently it's not really possible to use to the existing deftype/record to construct "classes" that interop well with Google Closure. It seems odd to ship Closure and then provide no tools for writing ClojureScript against it, especially the UI component parts. Several people have asked for this now so perhaps we really should offer the ClojureScript equivalent of genclass. |
| Comments |
| Comment by Tyler Tallman [ 11/May/13 3:06 PM ] |
|
What do you think of this approach based on While it may not preserve enough of gen-class's semantics. This would be enough for us to start gradually porting our large GClosure code base to Clojurescript. The code size reduction would be enormous. sample_use (ns com.example (:require [goog.ui.tree.TreeControl :as TreeControl])) (gen-class :name DemoTree :extends goog/ui.tree.TreeControl :constructor ([name config] (goog/base (js* "this") name config)) :methods [[handleKeyEvent [e] (goog/base (js* "this") "handleKeyEvent" e) ;; my special code to handle the key event ]]) here is a untested mock implementation modified from http://www.50ply.com/blog/2012/07/08/extending-closure-from-clojurescript/ I changed constructors to constructor because there can be only one in js This unfortunately has different semantics from gen-class because the original did not include the definition of the methods and constructor inline. It tried to read the Clojure gen-class source,but I still do not yet understand how the :prefix grabbing of functions from the current namespace works from within a macro. For Google Closure interop each class should have its own provide dryrun_for_gen-class (defmacro gen-class [{new-type :name base-type :extends ctor :constructor methods :methods}]
`(do
;(goog/provide ~@(str *ns* "." new-type))
(defn ~new-type ~@ctor)
(goog/inherits ~type ~base-type)
~@(map
(fn [method]
`(set! (.. ~type -prototype ~(to-property (first method)))
(fn ~@(rest method))))
methods)))
|
[CLJS-462] cljs.reader/read-string keyword parsing is inconsistent with clojure.core/read-string Created: 23/Jan/13 Updated: 20/Feb/13 Resolved: 20/Feb/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Stephen Nelson | Assignee: | Unassigned |
| Resolution: | Declined | Votes: | 0 |
| Labels: | None | ||
| Description |
|
cljs/reader.cljs:120 (def symbol-pattern (re-pattern "[:]?([^0-9/].*/)?([^0-9/][^/]*)")) symbol-pattern is not consistent with clojure's interpretation of valid keywords, e.g. the following are valid keywords in clojure that are not allowed by this regex: :0foo |
| Comments |
| Comment by David Nolen [ 26/Jan/13 10:59 AM ] |
|
Just because they are accepted by the reader doesn't make them valid - http://clojure.org/reader. Unless there's some stronger evidence that this is meant to be allowed I'm inclined to close this. |
[CLJS-461] repeated assoc into map eventually drops meta data Created: 22/Jan/13 Updated: 27/Jan/13 Resolved: 27/Jan/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Michael van Acken | Assignee: | Michał Marczyk |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
[org.clojure/clojurescript "0.0-1552"] |
||
| Attachments: |
|
| Description |
|
When running this loop, then the map's meta is lost after 32 assocs: (loop [i 0, m (with-meta {} {:foo :bar})]
(when (<= i 34)
(.log js/console i (pr-str (meta m)))
(recur (inc i) (assoc m (str i) i))))
The last 4 lines of output read 31 {:foo :bar}
32 {:foo :bar}
33 nil
34 nil
cljs.core.ObjMap/HASHMAP_THRESHOLD happens to be 32, so I guess |
| Comments |
| Comment by Michał Marczyk [ 24/Jan/13 12:51 AM ] |
|
obj-map->hash-map failed to take into account the fact that transients don't support metadata. The attached patch fixes this. |
| Comment by Michał Marczyk [ 25/Jan/13 6:11 AM ] |
|
Just realized that this also happens with PAMs. New patch addresses the issue in both places. (Also tweaks the PAM->PHM conversion – no more transient creation for a single assoc.) |
| Comment by David Nolen [ 26/Jan/13 11:06 AM ] |
|
I tried the patch and it did not seem to resolve the case above. Could we get a patch that includes a test case? Thanks! |
| Comment by Michał Marczyk [ 26/Jan/13 10:13 PM ] |
|
I tried it again at a Rhino REPL and for me it resolves both problems (OM and PAM). New patch with test cases based on the form from the ticket attached. (The tests do fail on master.) |
| Comment by Michał Marczyk [ 26/Jan/13 10:20 PM ] |
|
Tweaked patch with ticket number mentioned in a comment above the new test cases. |
| Comment by David Nolen [ 27/Jan/13 5:31 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/3ed16f32c6532d30eccd76ed41f90c956051ac58 |
[CLJS-460] defmulti ignores optional :hierarchy argument Created: 21/Jan/13 Updated: 26/Jan/13 Resolved: 26/Jan/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Stephen Nelson | Assignee: | Michał Marczyk |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
clojurescript 1552 |
||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
When an alternative hierarchy is provided to a defmulti declaration it should be used in place of the global hierarchy for isa?-based method dispatch. However, clojurescript multimethods seem to ignore this hierarchy and always use the global hierarchy. Test case provided. |
| Comments |
| Comment by Michał Marczyk [ 24/Jan/13 12:19 AM ] |
|
The attached patch fixes the issue and introduces a very basic, directly relevant test. |
| Comment by David Nolen [ 26/Jan/13 11:09 AM ] |
|
fixed http://github.com/clojure/clojurescript/commit/ad3ffece4af0fdbcf809e92a070440cfc7b2c500 |
[CLJS-459] Make order in which sorted map nodes are visited by reduce-kv consistent with entry order Created: 20/Jan/13 Updated: 27/Jan/13 Resolved: 27/Jan/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Michał Marczyk | Assignee: | Michał Marczyk |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
On master, (reduce-kv prn nil (sorted-map :foo 1 :bar 2)) prints :foo before :bar. With the forthcoming patch applied, :bar comes first. |
| Comments |
| Comment by David Nolen [ 26/Jan/13 11:08 AM ] |
|
Can we add test case via pr-str? Thanks! |
| Comment by Michał Marczyk [ 26/Jan/13 10:39 PM ] |
|
Sure, here's same patch plus a test case based on conjing onto a vector. I just noticed that Clojure 1.4's kvreduce on tree maps has funky visit order. Current RC of 1.5 is fixed (thanks to a patch by Alan Malloy, see 3c22b53f94f583bfda6b59c97310de82595e993c). |
| Comment by David Nolen [ 27/Jan/13 5:28 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/306ff2282a7415a0e3e4822b61fb6151761f98a2 |
[CLJS-458] get-in throws exception when key-list contains key that doesn't satisfy ILookup Created: 15/Jan/13 Updated: 26/Jan/13 Resolved: 26/Jan/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Frank Siebenlist | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
clojurescript r1552 |
||
| Description |
|
(get-in {:a {:b 1}} [:a :b :c] :nothing-there) cljs throws exception "Error: No protocol method ILookup.-lookup defined for type number: 1" Following snippet contains an additional (satisfies? ILookup m) test to end iteration and return no-value. -------- (defn get-in* "Returns the value in a nested associative structure, where ks is a sequence of keys. Returns nil if the key is not present, or the not-found value if supplied." {:added "1.2" :static true} ([m ks] (reduce get m ks)) ([m ks not-found] (loop [sentinel lookup-sentinel m m ks (seq ks)] (if ks (if-not (satisfies? ILookup m) not-found (let [m (get m (first ks) sentinel)] (if (identical? sentinel m) not-found (recur sentinel m (next ks))))) m)))) |
| Comments |
| Comment by David Nolen [ 18/Jan/13 3:26 PM ] |
|
Yes patch welcome. |
| Comment by David Nolen [ 26/Jan/13 11:15 AM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/e8d20229ee87747e3012ac97b5b7006d3703a305 |
[CLJS-457] Implement notion of "unbound", i.e. uninitialized variables, in ClojureScript to mimic Clojure's behaviour Created: 15/Jan/13 Updated: 15/Jan/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Frank Siebenlist | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
clojurescript r1552 |
||
| Description |
|
The following REPL snippets show different behavior for "unbound" vars in cljs and clj: -------- ClojureScript:cljs.user> (= a b) As a possible solution, D. Nolen suggested that we could "simulate this by creating a Unbound type and initializing def'ed vars without init expressions to instances of it." |
[CLJS-456] Function named same as ns fails Created: 13/Jan/13 Updated: 14/Jan/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Jonas Enlund | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In a fresh script/repljs on clojurescript master I see the following behaviour: ClojureScript:cljs.user> (ns foo.bar)
ClojureScript:foo.bar> (defn id [x] x)
#<
function id(x) {
return x;
}
>
ClojureScript:foo.bar> (defn foo [] (id 42))
#<
function foo() {
return foo.bar.id.call(null, 42);
}
>
ClojureScript:foo.bar> (foo)
"Error evaluating:" (foo) :as "foo.bar.foo.call(null)"
org.mozilla.javascript.EcmaError: TypeError: Cannot read property "id" from undefined (<cljs repl>#4)
at <cljs repl>:4 (foo)
at <cljs repl>:4 (anonymous)
at <cljs repl>:4
nil
ClojureScript:foo.bar>
(https://www.refheap.com/paste/8494 in case formatting fails) |
[CLJS-455] Warn on invalid js forms Created: 12/Jan/13 Updated: 20/Feb/13 Resolved: 20/Feb/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Jonas Enlund | Assignee: | Jonas Enlund |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
The ClojureScript compiler happily accepts forms like js/Math.MAX_NUMBER and (js/Math.ceil 3.14) which is not valid Clojure code. The correct way to write these expressions in ClojureScript is (.-MAX_NUMBER js/Math) and (.ceil js/Math 3.14). The ClojureScript analyzer should at least emit a warning when these bad forms are encountered. Preferably compilation should fail but that would probably break lots of existing code. |
| Comments |
| Comment by Jonas Enlund [ 12/Jan/13 6:13 AM ] |
|
Mailing list discussion here: https://groups.google.com/d/topic/clojure/rtmPtmpo4qA/discussion |
| Comment by Jonas Enlund [ 12/Jan/13 6:21 AM ] |
|
patch-cljs-455.diff adds a warning message and updates cljs.core and twitterbuzz to use correct js/ syntax. |
| Comment by David Nolen [ 13/Jan/13 10:44 AM ] |
|
Fixed, http://github.com/clojure/clojurescript/commit/b2df2c2a69a4f1c9be8d698b74122c98b1e22491 |
| Comment by Jonas Enlund [ 02/Feb/13 3:28 PM ] |
|
I'm having second thoughts about this. Looking at the commit when the js namespace was introduced[1] you can see that, for example (goog.global.Math/exp x) was changed to (js/Math.exp x). I'm thinking maybe the js magic namespace is meant to support these kinds of calls? Another issue I ran into was when using a js library (paper.js) and I was supposed to translate var x = new paper.Path() into ClojureScript. I could not find any way to achieve this except (let [x (js/paper.Path.)] ...) There is an assertion[2] in the analyzer that prohibits the following alternative: (let [x (new (.-Path js/paper))]
...)
Removing the assertion (and the call to 'resolve-existing-var') the above expression seems to work just fine. [1] https://github.com/clojure/clojurescript/commit/954e8529b1ec814f40af77d6035f90e93a9126ea |
| Comment by David Nolen [ 03/Feb/13 3:12 PM ] |
|
This patch creates issues around using constructors provided by libraries outside ClojureScript and GClosure. Also from Rich's original commit support js prefix, it seems like JS style access after the / was actually intended. |
| Comment by Jonas Enlund [ 03/Feb/13 10:25 PM ] |
|
The patch revert455 removes the warnings on js/Foo.bar forms. |
| Comment by David Nolen [ 04/Feb/13 10:40 AM ] |
|
Patch applied to master |
| Comment by David Nolen [ 20/Feb/13 8:35 AM ] |
|
closing this one |
[CLJS-454] Instance Reader to Support Micro/Nanoseconds Created: 04/Jan/13 Updated: 21/Feb/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Anatoly Polinsky | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | reader, timestamp | ||
| Environment: |
N/A |
||
| Attachments: |
|
| Description |
|
Any timestamps with a greater than millisecond precision cannot be handled by the ClouseScript reader: > cljs.reader.read_date("2012-12-30T23:20:05.066980000-00:00")
> Error: Assert failed: timestamp millisecond field must be in range 0..999 Failed: 0<=66980000<=999 (<= low n high)
Here "2012-12-30T23:20:05.066980000-00:00" is an example of an ordinary timestamp that is returned from Postgres. ClojureScript reader interprets the nanosecond portion "066980000" as milliseconds and the check here fails: def parse-and-validate-timestamp
...
(check 0 ms 999 "timestamp millisecond field must be in range 0..999")
|
| Comments |
| Comment by David Nolen [ 04/Jan/13 4:55 PM ] |
|
Is this behavior supported in Clojure? |
| Comment by Jozef Wagner [ 05/Jan/13 6:48 AM ] |
|
It seems it is |
| Comment by Anatoly Polinsky [ 06/Jan/13 2:18 AM ] |
|
@David, Yep, it is supported. Enhancing Jozef's response: user=> (use 'clojure.instant) nil user=> (read-instant-date "2012-12-30T23:20:05.066980000-00:00") #inst "2012-12-30T23:20:05.066-00:00" /Anatoly |
| Comment by David Nolen [ 09/Jan/13 10:59 PM ] |
|
Ok, do you all have a good idea about what a patch would look like? |
| Comment by Thomas Heller [ 05/Feb/13 3:28 PM ] |
|
Since JavaScript has no support for nanoseconds in Date, I'd vote for dropping the nanoseconds. Currently the reader just blows up when reading a String with java.sql.Timestamp printed in CLJ, since that is printed in nanosecond precision. While probably not the best solution, I attached a patch for cljs.reader/parse-and-validate-timestamp fn that just drops the nanoseconds from the millisecond portion. Would be easier to just strip the ms string to 3 digits but that would cause "2012-12-30T23:20:05.066980000012312312123121-00:00" to validate. |
| Comment by Thomas Heller [ 05/Feb/13 3:35 PM ] |
|
Well, Math. Just realized that this is not really correct, since 1000 is closer to 999 than it is to 100. |
| Comment by Thomas Heller [ 05/Feb/13 3:37 PM ] |
|
Sorry, for that brainfart. |
| Comment by David Nolen [ 06/Feb/13 11:39 AM ] |
|
Or we could return a custom ClojureScript Date type that provides the same api as js/Date but adds support for nanoseconds. |
| Comment by Thomas Heller [ 20/Feb/13 5:20 PM ] |
|
One could extend the js/Date prototype with a setNanos/getNanos method and call them accordingly. I'd offer to implement that but the cljs.reader/parse-and-validate-timestamp function scares me, any objections to rewriting that? As for the js/Date extension, thats easy enough: (set! (.. js/Date -prototype -setNanos) (fn [ns] (this-as self (set! (.-nanos self) ns)))) Not sure if its a good idea though, messing with otherwise native code might not be "stable". Not convinced that keeping the nanos around is "required" since javascript cannot construct Dates with nanos, but its probably better not to lose the nanos in case of round tripping from clj -> cljs -> clj. |
| Comment by David Nolen [ 21/Feb/13 12:25 AM ] |
|
We definitely don't want to mutate Date's prototype without namespacing. I'm not sure we want to mutate Date's prototype at all. That's why I suggested a ClojureScript type with the same interface as Date just as Google has done in Closure. |
[CLJS-453] ArrayVector for small vectors Created: 04/Jan/13 Updated: 04/Jan/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Jozef Wagner | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
master cljs, chrome |
||
| Attachments: |
|
| Description |
|
Just like we have an ArrayMap for small maps, I propose to have an ArrayVector for small vectors. Use cases:
ArrayVector has 100x faster vector creation compared to PersistentVector. Example of such destructuring: (defn foo [a b]
[(+ a b) (- a b) (* a b)])
(defn bar []
(let [[plus minus times] ^ArrayVector (foo 1 2)]
(str "bla bla" plus "blaah" minus)))
I've attached a patch with complete implementation of such vector, supporting all basic functionalities as well as transients. This patch also replaces default vector implementation with ArrayVector, falling back to PersistentVector for large vectors. ArrayVector implementation can also be found at array-vec branch at https://github.com/wagjo/clojurescript/tree/array-vec |
| Comments |
| Comment by David Nolen [ 04/Jan/13 4:54 PM ] |
|
Thanks! This interesting, it would be helpful to see a more comprehensive set of benchmarks on jsperf.com. |
[CLJS-452] clojure.browser.net: enable WebSockets? Created: 31/Dec/12 Updated: 20/Jan/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Linus Ericsson | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | enhancement | ||
| Environment: |
clojurescript in browsers, wrapper for Google Closures WebSocket. |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
In https://github.com/clojure/clojurescript/blob/master/src/cljs/clojure/browser/net.cljs there's a nicely prepared support for WebSockets with the note ;; WebSocket is not supported in the 3/23/11 release of Google is there anything preventing us from enable the support for WebSockets with the next release of ClojureScript? patch 0001-enable-websockets.patch do just enable the functionality. No test-cases included. |
| Comments |
| Comment by David Nolen [ 20/Jan/13 12:51 AM ] |
|
Have you verified that this doesn't break browser REPL? Thanks! |
[CLJS-451] keywords should be implemented as JavaScript functions Created: 30/Dec/12 Updated: 04/Jan/13 Resolved: 04/Jan/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | tom white | Assignee: | Unassigned |
| Resolution: | Declined | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Keywords are currently implemented as JavaScript strings. This makes certain JavaScript interop situations awkward: to provide a javascript api a function that can pull data from a map, one must use #(:foo %) instead of the more natural :foo. This is confusing because ClojureScript functions are otherwise fully usable in contexts expecting JavaScript functions. The proposed alternative is to have keywords instead be implemented as JavaScript functions that accept a map and optional default value, assuming this doesn't otherwise screw up their core functionality of providing fast equality tests, etc. |
| Comments |
| Comment by David Nolen [ 04/Jan/13 4:52 PM ] |
|
Keywords & Symbols are likely to become a proper ClojureScript datatypes. The benefit of keywords & symbols as implemented as functions is small. |
[CLJS-450] (ns) within (do) inconsistent with Clojure behaviour Created: 27/Dec/12 Updated: 05/Jan/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Stuart Campbell | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
An (ns) within a (do) doesn't quite work as expected at the REPL: ClojureScript:cljs.user> (do (ns foo) (def x 42))
nil
ClojureScript:foo> x
nil
ClojureScript:cljs.user> cljs.user/x
42
The Clojure equivalent: user=> (do (ns foo) (def x 42))
#'foo/x
foo=> x
42
|
| Comments |
| Comment by David Nolen [ 05/Jan/13 2:05 PM ] |
|
Looks like we need to do something similar to what is done in Clojure with top level do - http://github.com/frenchy64/typed-clojure/pull/4 |
[CLJS-449] stack traces for ex-info Created: 23/Dec/12 Updated: 23/Dec/12 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Tom Jack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Currently, ex-info exceptions have no stack traces, which makes them.. much less useful. Attached patch (0001-hack-ex-info-stacktraces.patch) is one hackish way of getting stack traces back when Error.captureStackTrace is available (at least in Chrome, presumably in Node as well). But this seems unacceptable — all the stuff emitted for the deftype (making the constructor print as a type) gets overwritten. Is there a better way? Will this maybe be made irrelevant by source maps? |
| Comments |
| Comment by David Nolen [ 23/Dec/12 11:51 AM ] |
|
Isn't the stack trace recoverable from the original exception? |
| Comment by Tom Jack [ 23/Dec/12 4:01 PM ] |
|
I hadn't considered that. If a cause is provided, that seems reasonable. The only trouble is that you still have to know where the ExceptionInfo is being thrown, so that you can catch it and throw the cause. Chrome's debugger would make it easy to at least find where the ExceptionInfo is thrown, but it's still more trouble than having the appropriate stack trace directly on the ExceptionInfo. If no cause is provided, of course that won't work. But I suppose one could write (ex-info msg data (js/Error.)) instead of (ex-info msg data)? Personally, I don't expect to pass a cause very often — I expect the binary arity to be much more common in my cljs libraries. If we rely on the cause for the stack trace, maybe we could have the cause default to a new Error if not supplied? It seems sort of conceivable that we could also wire up the ExceptionInfo to proxy .stack to that Error so that the stacktrace will come through, without needing to override the ExceptionInfo constructor. |
[CLJS-448] Support for runtime reading of tagged elements Created: 21/Dec/12 Updated: 25/Dec/12 Resolved: 22/Dec/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Tom Hickey | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
We ned the abilty to supply custom and default tag parsers when using cljs.reader/read-string (found in src/cljs/cljs/reader.cljs) in running ClojureScript applications. ns prefixed tagsAs per the edn specification "user tags must contain a prefix component". Currently, because (name tag) is being called, the ns prefix component is dropped when looking up the tag in *tag-table* default reader fnCurrently, there is no support for supplying a default reader fn (akin to *default-data-reader-fn* in Clojure proper). 2 issues rolled into one?I know this may be bad practice rolling 2 issues into one, but I do not know how to formulate the separate patches that affect the same lines of code and have the apply correctly regardless of order. If I need to correct this, please advise. Already reported?I know this issue was already raised in CLJS-335, but from my experience with making these modifications for a running ClojureScript app, I did not come across the fns in the files mentioned in that task. I assume this is because that had more to do with compiling cljs code, but please correct me if I'm wrong. Along those lines, is this patch not acceptable if it doesn't fix both places at once? Approach & NamingI followed the approach that was already in place for tag parsers, supplying register and deregister helper fns. I was a bit torn on naming because in Clojure *default-data-reader-fn* is used, but in the existing ClojureScript code they are called tag-parser. Should the "reader" vs "parser" nomenclature be unified between Clojure and ClojureScript, or are they named differently because they are fundamentally different in some way that I am missing? |
| Comments |
| Comment by David Nolen [ 21/Dec/12 5:03 PM ] |
|
I don't think we can have a unified solution without a reader that is shared both at compile time and run time and I think the benefits today of run time support trumps the possible future convenience of compile time support. I don't think there is any good reason for the difference in naming - I'm inclined to keep things in line with Clojure as much as possible. Happy to move forward with this one unless there are objections from others. |
| Comment by David Nolen [ 22/Dec/12 1:40 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/19d265dfc262ae93b9d6b1be5bf13905ef5445c6 |
| Comment by kovas boguta [ 25/Dec/12 1:42 PM ] |
|
My problem in CLJS-335 was that you couldn't compile cljs code with embedded user-defined tagged literals. The code in this ticket is also great. But it would be even better if there was a generic function for reading tagged literals, known or unknown, that had the exact same argument structure as the the tag reader functions. My solution for CLJS-335 is to read the TL into code that resolves and invokes the tag reader function on the CLJS side. However it will fail for unknown tags, and will not fall back on the default reader functionality defined in the solution for this ticket. It would be trivial to fix this, if there was a single function that my solution can use that handled both known and unknown tags. Otherwise, my solution can be extended with more code, to first check for a specific reader, and then fall back on the default reader. |
[CLJS-447] Throw exception if multiple namespaces are required with the same alias Created: 21/Dec/12 Updated: 23/Dec/12 Resolved: 22/Dec/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Benjamin Teuber | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Take for example this code: (ns foo
(:require [views.bar :as bar]
[model.bar :as bar]))
;; this is meant to use views.bar
(bar/update-view)
The call to update-view fails with a "Cannot call method call of undefined", which is quite confusing if you have a big list of requires at the beginning. The expected behavior would be a compile-time error. |
| Comments |
| Comment by David Nolen [ 22/Dec/12 4:15 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/7be30517f9204098bd193baa6c8241f8016f2eed |
| Comment by Tom Jack [ 23/Dec/12 1:11 AM ] |
|
I had found it convenient to be able to do (:require [foo :as f]) (:require-macros [foo :as f]) Would you be interested in a patch which preserves this behavior, or will we have to use separate aliases for fn/macro ns's from now on? |
| Comment by David Nolen [ 23/Dec/12 11:52 AM ] |
|
A patch to allow macro dependencies to reuse a namespace alias is welcome. |
| Comment by Tom Jack [ 23/Dec/12 4:10 PM ] |
|
Here's a patch that does that (macro-realias.patch, 23 Dec 2012). |
[CLJS-446] Rhino REPL emits warnings twice Created: 18/Dec/12 Updated: 18/Dec/12 Resolved: 18/Dec/12 |
|
| Status: | Resolved |
| 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 |
|
This only affects functions - functions get a second pass from the compiler in order to leverage arity information for self call optimization. |
| Comments |
| Comment by David Nolen [ 18/Dec/12 3:38 PM ] |
|
fixed http://github.com/clojure/clojurescript/commit/cd89461082c74c9b7d3429dfa34ee9344531690d |
[CLJS-445] declare stopped working in the REPL Created: 18/Dec/12 Updated: 18/Dec/12 Resolved: 18/Dec/12 |
|
| Status: | Resolved |
| 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 |
|
Typing a declare statement in the REPL gives an error |
| Comments |
| Comment by David Nolen [ 18/Dec/12 12:36 PM ] |
|
duplicate |
[CLJS-444] def issues in REPL Created: 18/Dec/12 Updated: 18/Dec/12 Resolved: 18/Dec/12 |
|
| Status: | Resolved |
| 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 |
|
(def x) now fails in the REPL, this is very likely a result of |
| Comments |
| Comment by David Nolen [ 18/Dec/12 1:06 PM ] |
|
This may be related to dead code elimination optimizations introduced in |
| Comment by David Nolen [ 18/Dec/12 2:49 PM ] |
|
http://github.com/clojure/clojurescript/commit/ab868f2121b64e31c7206e3d17f209f63e8e6a51 Issue was not related to other mentioned tickets. No code was emitted if init not provided was the issue. |
[CLJS-443] protocol dispatch performance enhancement & extend-type to nil Created: 17/Dec/12 Updated: 20/Feb/13 |
|
| 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 |
|
Currently we extend to nil to a bunch of protocols, while this was convenient for the initial implementation this has many unfortunate performance consequences. We should probably not extend nil to anything and deal with the nil value directly as is done in Clojure on the JVM. In addition we can add a special ^not-native type-hint. In critical paths this would allow us to inline calls directly to protocol implementations. Perhaps this could also allow us to hint with ^native to inline calls to the native tables. |
| Comments |
| Comment by David Nolen [ 20/Feb/13 8:40 AM ] |
|
^not-native support is already in master and does deliver performance benefits in the cases where native types need not be considered. |
[CLJS-442] Lazy seqs fails to close over local vars Created: 14/Dec/12 Updated: 19/Dec/12 Resolved: 18/Dec/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Critical |
| Reporter: | Jozef Wagner | Assignee: | Michał Marczyk |
| Resolution: | Completed | Votes: | 1 |
| Labels: | None | ||
| Environment: |
master clojurescript, commit 9abeb143f6 |
||
| Attachments: |
|
| Description |
|
When executing following code (loop [i 10
v [0]
v2 [0]]
(if (pos? i)
(let [j i
x (map #(+ j %) v)]
(recur (dec i) x (map #(+ j %) v2)))
(concat v v2)))
Clojure produces (55 55) (10 55) Forcing realization of lazy seqs produces correct output (55 55) on both environments. (loop [i 10
v [0]
v2 [0]]
(if (pos? i)
(let [j i
x (doall (map #(+ j %) v))]
(recur (dec i) x (doall (map #(+ j %) v2))))
(concat v v2)))
|
| Comments |
| Comment by Michał Marczyk [ 14/Dec/12 11:28 PM ] |
|
This is actually due to a bug in analyze-let whereby functions involved in init-exprs would not close over earlier bindings. The attached patch fixes this. |
| Comment by Michał Marczyk [ 14/Dec/12 11:30 PM ] |
|
Incidentally, I wonder whether *loop-lets* is still an appropriate name for this Var... |
| Comment by David Nolen [ 18/Dec/12 3:04 PM ] |
|
Do you have a better name in mind? |
| Comment by David Nolen [ 18/Dec/12 3:08 PM ] |
|
fixed http://github.com/clojure/clojurescript/commit/84e9488f49bcfea4b4037a562f8f797c7ddd79f0 |
| Comment by Jozef Wagner [ 19/Dec/12 7:46 AM ] |
|
Thank you, you guys are great! |
[CLJS-441] Require implicit 'do nodes for all blocks in AST Created: 12/Dec/12 Updated: 21/Dec/12 Resolved: 21/Dec/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | patch, patch, | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Discussion here: https://groups.google.com/d/topic/clojure-dev/6CVTsW1EQn4/discussion |
| Comments |
| Comment by Brandon Bloom [ 12/Dec/12 1:18 PM ] |
|
This patch depends on the patch at http://dev.clojure.org/jira/browse/CLJS-440 |
| Comment by Brandon Bloom [ 12/Dec/12 3:18 PM ] |
|
This patch would also address http://dev.clojure.org/jira/browse/CLJS-416 |
| Comment by David Nolen [ 21/Dec/12 5:36 PM ] |
|
Fixed http://github.com/clojure/clojurescript/commit/764565e9e7696379ada5ac8168b20ee5f9cde6a2 |
[CLJS-440] Replace :is-loop flag in AST with distinct :loop op Created: 12/Dec/12 Updated: 21/Dec/12 Resolved: 21/Dec/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | patch, patch, | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Discussion here: https://groups.google.com/d/topic/clojure-dev/6CVTsW1EQn4/discussion |
| Comments |
| Comment by Brandon Bloom [ 12/Dec/12 1:14 PM ] |
|
Whoops. Accidentally made a Clojure issue instead of a ClojureScript issue. Moved the ticket and reuploaded patch with correct ticket # |
| Comment by David Nolen [ 21/Dec/12 5:12 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/26b2541cd66d3139eca354434a56137218b17d09 |
[CLJS-439] IEncodeClojure only works on same-context Objects Created: 11/Dec/12 Updated: 20/Jan/13 Resolved: 20/Jan/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Tom Jack | Assignee: | Unassigned |
| Resolution: | Declined | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The default impl uses (identical? (type x) js/Object), but objects created in another JS context (e.g. another frame) will fail this test, since their constructor is a different js/Object. Thus js->clj is the identity on such objects. I wonder if there are any related problems anywhere else, e.g. with protocols? This seems to be the only occurrence of js/Object. Maybe this can be fixed by extending IEncodeClojure to object? I don't immediately see how to do that without incurring the option destructuring overhead recursively. |
| Comments |
| Comment by David Nolen [ 13/Dec/12 7:55 AM ] |
|
I don't think this is something that ClojureScript should try to address at all. To me it seems similar to various classloader issues in JVM land. |
| Comment by Tom Jack [ 15/Dec/12 2:31 AM ] |
|
OK, I don't disagree. |
| Comment by Sean Grove [ 17/Dec/12 12:33 AM ] |
|
This is causing some unpleasantness, and I'm not aware of the classloader issues. Why check (identical? js/object x) instead of (goog.isObject x) on https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L6948 ? |
| Comment by Chris Granger [ 17/Dec/12 1:26 AM ] |
|
this bit me as well and I can't see a downside to using goog.isObject. I agree with David about not going down a rabbit hole here, but I think we can do the "right thing" for free. EDIT: I spoke too soon. Looks like native objects, like dom nodes would blow up in this scenario. Also, goog.isObject returns true on functions, but that would be easy enough to deal with. |
| Comment by Tom Jack [ 17/Dec/12 2:31 AM ] |
|
I suppose extending to object would similarly cause trouble for dom nodes etc? If you can get ahold of the js/Object from another frame, is it possible to extend IEncodeClojure to it? |
| Comment by David Nolen [ 21/Dec/12 5:50 PM ] |
|
I have some experience with this stuff - it's a rabbit hole. There are many objects that can cross contexts for which we can provide no sensible equality guarantees. If you need to move data between JS contexts then use GClosure and stick to the basic JS data types. I'm inclined to close this one unless someone has a brilliant comprehensive solution that I'm not seeing right now. |
| Comment by David Nolen [ 20/Jan/13 12:52 AM ] |
|
This one is tricky. Closing for now. |
[CLJS-438] copy cond-> etc from 1.5 Created: 11/Dec/12 Updated: 17/Mar/13 Resolved: 17/Mar/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Tom Jack | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Attached patch (cljs-438-condetc.patch, 11 Dec 2012) copies cond->, cond->>, as->, some->, and some->> from 1.5 master. This lets ClojureScript users use these macros without requiring Clojure 1.5. I suppose this maybe should wait until 1.5.0 is out, in case another renaming occurs. Another way to do this would be to have import-macros ignore missing macros and add these there. Then the macros would only be available for users requiring Clojure 1.5 (which.. makes sense), and we wouldn't have to copy them. |
| Comments |
| Comment by David Nolen [ 22/Dec/12 2:32 PM ] |
|
I'm inclined to hold off on this one since 1.5 is so close. As soon as 1.5 becomes official I'd like to make it a requirement for ClojureScript - as then I can merge the source-map branch and hopefully get some help on that work. |
| Comment by Tom Jack [ 22/Dec/12 11:25 PM ] |
|
Sounds good. |
| Comment by David Nolen [ 20/Feb/13 8:42 AM ] |
|
Is this patch up-to-date? Seems like 1.5 is just around the corner. |
| Comment by David Nolen [ 01/Mar/13 1:28 PM ] |
|
Can we get an updated version of this patch that applies to master? Thanks! |
| Comment by Tom Jack [ 03/Mar/13 12:28 PM ] |
|
You want the patch as is, copying the macros from 1.5? I assumed we'd move to 1.5 and then we can just add cond-> etc to the import-macros call. |
| Comment by Tom Jack [ 16/Mar/13 2:10 PM ] |
|
Here's the patch I think you want. It applies to master and assumes 1.5. ( |
| Comment by David Nolen [ 17/Mar/13 3:01 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/f311159889e66f7029e41ae5f61fda9ac3779643 |
[CLJS-437] Missing "Too few arguments to if" check Created: 06/Dec/12 Updated: 07/Dec/12 Resolved: 07/Dec/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | patch, patch, | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
(if) and (if 1) both return nil. JVM clojure throws "Too few arguments to if". |
| Comments |
| Comment by David Nolen [ 07/Dec/12 12:03 AM ] |
|
fixed, https://github.com/clojure/clojurescript/commit/9abeb143f66ad6d92756c2dd702966f63ae76c27 |
[CLJS-436] defn missing arg vector gives error about max Created: 06/Dec/12 Updated: 08/Dec/12 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | David Nolen | Assignee: | Michał Marczyk |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Comments |
| Comment by David Nolen [ 06/Dec/12 10:09 AM ] |
|
The issue is actually a bit subtle for example: (defn foo "name")
is valid Clojure - however this doesn't work in ClojureScript. In this case ClojureScript generates the following: function () {
switch (arguments.length) {
}
throw (new Error("Invalid arity: " + arguments.length));
}
|
| Comment by David Nolen [ 06/Dec/12 10:19 AM ] |
|
After talking to Rich the above really should not compile. |
| Comment by Michał Marczyk [ 08/Dec/12 6:09 PM ] |
|
Here's a patch with the fn* validations I could think of. It seems to cause the compilation time to increase by a measurable amount, which I find quite surprising (even though it's to be expected that there will be quite of few fn* forms in CLJS sources). I'd love to know if it's just on my box (let's hope so). If validations really have that sort of effect, I'm thinking about refactoring the analyser so that they can be turned on (which should also be the default) and off (for particularly fast compilations). |
| Comment by Michał Marczyk [ 08/Dec/12 6:11 PM ] |
|
Ah, wait, there's a minor typo in the commit message, I'll fix it in a second... |
| Comment by Michał Marczyk [ 08/Dec/12 6:13 PM ] |
|
...um, no there isn't. Sorry for the confusion. |
[CLJS-435] Stack overflow error when adding large numerical keys to maps Created: 05/Dec/12 Updated: 22/Dec/12 Resolved: 22/Dec/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Praki Prakash | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux 2.6.32-44-generic #98-Ubuntu SMP i686 GNU/Linux, java version "1.6.0_26", just bootstrapped clojurescript. |
||
| Description |
|
The following code causes a stack overflow in Google Chrome browser and repljs. Transcript follows. ~/tools/clojurescript$ script/repljs "Type: " :cljs/quit " to quit" ClojureScript:cljs.user> (assoc {} 154618822656 1 261993005056 1) "Error evaluating:" (assoc {} 154618822656 1 261993005056 1) :as "cljs.core.assoc.call(null,cljs.core.ObjMap.EMPTY,154618822656,1,261993005056,1);\n" java.lang.StackOverflowError org.mozilla.javascript.NativeCall.<init>(NativeCall.java:65) org.mozilla.javascript.ScriptRuntime.createFunctionActivation(ScriptRuntime.java:3273) org.mozilla.javascript.gen.cljs_core_cljs_834._c__hash_1(cljs/core.cljs) org.mozilla.javascript.gen.cljs_core_cljs_834.call(cljs/core.cljs) org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2521) org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:300) org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:129) org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76) org.mozilla.javascript.gen.cljs_core_cljs_909._c_anonymous_3(cljs/core.cljs:905) org.mozilla.javascript.gen.cljs_core_cljs_909.call(cljs/core.cljs) org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2521) org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:300) org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:129) org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86) org.mozilla.javascript.gen.cljs_core_cljs_909._c_anonymous_5(cljs/core.cljs:913) org.mozilla.javascript.gen.cljs_core_cljs_909.call(cljs/core.cljs) org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2521) org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:300) org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:129) org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86) org.mozilla.javascript.gen.cljs_core_cljs_909._c_anonymous_2(cljs/core.cljs:893) org.mozilla.javascript.gen.cljs_core_cljs_909.call(cljs/core.cljs) org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2521) org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:300) org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:129) org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76) org.mozilla.javascript.gen.cljs_core_cljs_909._c_anonymous_5(cljs/core.cljs:911) org.mozilla.javascript.gen.cljs_core_cljs_909.call(cljs/core.cljs) org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2521) org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:300) org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:129) org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76) org.mozilla.javascript.gen.cljs_core_cljs_1175._c_anonymous_2(cljs/core.cljs:4481) org.mozilla.javascript.gen.cljs_core_cljs_1175.call(cljs/core.cljs) org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2521) org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:300) org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:129) org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86) org.mozilla.javascript.gen.cljs_core_cljs_1175._c_anonymous_4(cljs/core.cljs:4501) org.mozilla.javascript.gen.cljs_core_cljs_1175.call(cljs/core.cljs) org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2521) org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:300) org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:129) org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86) org.mozilla.javascript.gen.cljs_core_cljs_1169._c_anonymous_12(cljs/core.cljs:4388) org.mozilla.javascript.gen.cljs_core_cljs_1169.call(cljs/core.cljs) org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86) org.mozilla.javascript.gen.cljs_core_cljs_1175._c_anonymous_2(cljs/core.cljs:4486) org.mozilla.javascript.gen.cljs_core_cljs_1175.call(cljs/core.cljs) org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2521) org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:300) org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:129) |
| Comments |
| Comment by David Nolen [ 22/Dec/12 2:01 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/61455e64f58a07706c9b5ecebc9247bf085f7df1 |
[CLJS-434] ClojureScript compiler prepends "self__" to defmulti forms when metadata in form of ^:field. Created: 01/Dec/12 Updated: 20/Jan/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Andrew Mcveigh | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug | ||
| Environment: |
Mac OS X (10.7), java version "1.6.0_37", leiningen 2 preview 10, cljsbuild 0.2.9. |
||
| Description |
|
Using the def form, with the specific metadata ^:field causes the cljs compiler The browser (latest chrome/firefox) does not recognize "self__". Test Case: Tested against master: 5ac1503 ------------- (ns test-def) (def ^:foo e identity) e ; test_def.e = cljs.core.identity; ; test_def.e; (def ^:field f identity) f ; test_def.f = cljs.core.identity; ; self__.test_def.f; ; Uncaught ReferenceError: self__ is not defined https://gist.github.com/4185793 |
| Comments |
| Comment by Brandon Bloom [ 01/Dec/12 5:37 PM ] |
|
code tags |
| Comment by David Nolen [ 20/Jan/13 12:54 AM ] |
|
This one is a bit annoying. We should probably use namespaced keywords internally. |
[CLJS-433] Throw error when user tries to use wrong syntax for multiple arity functions in extend-type Created: 29/Nov/12 Updated: 29/Nov/12 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Max Penet | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Right now it allows to mix declarations, sometimes allowing an illegal syntax (-nth shouldn't be allowed in the following example) example from jayq: (extend-type js/jQuery IIndexed (-nth [this n] ...) (-nth [this n not-found] ...) ILookup (-lookup ([this k] ...) ([this k not-found] ...)) It already throws an error with some protocols such as IFn, but not for all of them. |
[CLJS-432] Include line and file information in error messages Created: 28/Nov/12 Updated: 30/Nov/12 Resolved: 30/Nov/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | patch, patch, | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Just as the ana/warning function did, now errors and assertions include line and file source information. I needed this sorely. |
| Comments |
| Comment by Brandon Bloom [ 28/Nov/12 6:13 PM ] |
|
Added v2 of patch that will handle any exception during parsing. Similar could be done during code generation. This approach seems much more robust and less invasive. |
| Comment by Brandon Bloom [ 28/Nov/12 11:15 PM ] |
|
That v2 was made hastily. Upon further thought, it seems broken in the face of recursive analysis. I think the right thing, if we prefer the exception catching approach, is to rethrow as a custom exception type, which would be allowed through un-re-wrapped. For example: (try (parse-form ...) (catch AnalysisError e throw e) (catch Throwable e (throw (AnalysisError. env e)))) |
| Comment by David Nolen [ 29/Nov/12 11:32 AM ] |
|
I don't have a problem with the approach in the first patch. I don't really see how a less invasive patch is even possible - you still need to pass the environment to some assertion check if you are going to throw a custom exception as well. |
| Comment by Brandon Bloom [ 29/Nov/12 2:28 PM ] |
|
v3 of patch fixes issue with v2 |
| Comment by Brandon Bloom [ 29/Nov/12 2:50 PM ] |
|
v4 of patch as discussed in irc |
| Comment by Brandon Bloom [ 29/Nov/12 2:57 PM ] |
|
v5 also catches error from parse-invoke |
| Comment by Brandon Bloom [ 29/Nov/12 5:05 PM ] |
|
v6 improves errors in repl as discussed in IRC |
| Comment by David Nolen [ 30/Nov/12 11:25 AM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/af4ab91754d30f082b117b40c07ea94d0063c0d6 |
[CLJS-431] namespace and name fail on '/ Created: 27/Nov/12 Updated: 30/Nov/12 Resolved: 30/Nov/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | patch, patch, | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Both the 'namespace and the 'name functions use .lastIndexOf to search for "/". This fails on the division symbol if you don't provide a starting index to search from. |
| Comments |
| Comment by David Nolen [ 30/Nov/12 11:56 AM ] |
|
fixed in commit 5ac15039c685af19810dc5b35f06a496be1f3369 |
[CLJS-430] cljsc hangs for ~ 1 minute after code is generated Created: 26/Nov/12 Updated: 02/Dec/12 Resolved: 02/Dec/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Brandon Harvey | Assignee: | Unassigned |
| Resolution: | Declined | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Mac OS X 10.8.2 |
||
| Description |
|
Running the Clojurescript compiler via command line hangs for ~1 minute after the compile is done. (By done I mean that complete code has been sent to stdout.) I've observed this for a number of different options so I don't think it's related to options: optimization simple/advanced, pretty-print on/off, output-as used/not used. I've tried using bin/cljsc and doing the command manually, a la: $ cd bin I've only tested against one version of Clojurescript: today's master branch (0bfa1eac3599b55f3). |
| Comments |
| Comment by Brandon Harvey [ 26/Nov/12 1:52 PM ] |
|
Tried a slightly older commit, e83204a9ad4002b1e from Oct 20. Saw issue there as well. |
| Comment by Brandon Harvey [ 26/Nov/12 2:08 PM ] |
|
Calling (build) in a REPL does not show the issue. $ ./script/repl |
| Comment by David Nolen [ 26/Nov/12 3:02 PM ] |
|
Thanks for the details, will look into it. |
| Comment by David Nolen [ 30/Nov/12 4:28 PM ] |
|
It looks like the problem occurs when passing in any optimization level besides :none to cljsc. |
| Comment by David Nolen [ 30/Nov/12 6:45 PM ] |
|
As far as I can tell this issue has affected ClojureScript for quite some time and has gone unnoticed because most users rely on lein-cljsbuild or they call into the compiler directly. And by quite some time I believe this may actually have something to do w/ the environment (JDK version, OS, etc). So lowering the priority on this. Brandon, can you give more details on your Java environment? |
| Comment by Brandon Harvey [ 01/Dec/12 3:28 PM ] |
|
$ java -version Does that help? |
| Comment by Herwig Hochleitner [ 02/Dec/12 4:13 AM ] |
|
Please have a look at |
| Comment by David Nolen [ 02/Dec/12 11:25 AM ] |
|
duplicate |
[CLJS-429] Data Conveying Exception: ex-data and ex-info Created: 26/Nov/12 Updated: 06/Dec/12 Resolved: 06/Dec/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Dave Sann | Assignee: | Michał Marczyk |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
equivalent of http://dev.clojure.org/jira/browse/CLJ-733 as per https://groups.google.com/d/topic/clojure/vlTR_161WNc/discussion see also: http://dev.clojure.org/display/design/Error+Handling |
| Comments |
| Comment by Michał Marczyk [ 05/Dec/12 5:47 PM ] |
|
The attached patch introduces ex-info, ex-data and ExceptionInfo to cljs.core. ExceptionInfo has its prototype set to Error.prototype (apparently necessary for good behaviour across browsers; this is marked as a special case in a comment). The version of ex-info introduced by the patch does support a cause argument, but I have to say that it's not clear to me how user code should go about extracting it. Direct property access feels icky; a new fn would be possible, but should perhaps be shared with Clojure; Clojure code would say (.getCause ex), but hanging a method on ExceptionInfo somehow feels icky to me too. My first cut at the patch actually did not include the cause field in ExceptionInfo and the ternary variant of ex-info; that could actually be a reasonable approach for now, especially if introducing a new fn might be a possibility (since that would presumably require coordination with Clojure). |
| Comment by Michał Marczyk [ 06/Dec/12 6:17 AM ] |
|
An improved patch. Firstly, it correctly makes ExceptionInfo into a custom error type (the original patch was broken on this point). Secondly, it introduces ex-message and ex-cause for dealing with ExceptionInfo in a platform-agnostic manner (got the go-ahead from Rich @ ClojureX; I'll be submitting a patch for this to Clojure). |
| Comment by Michał Marczyk [ 06/Dec/12 6:23 AM ] |
|
Clojure patch @ CLJ-1120. |
| Comment by David Nolen [ 06/Dec/12 10:18 AM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/7ccb67e040d32b2c0112d2c73dd2e28d5e13c50a |
[CLJS-428] Using */ inside of a docstring causes compiler to produce invalid JavaScript Created: 25/Nov/12 Updated: 22/Dec/12 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Murphy McMahon | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux, lein-cljsbuild |
||
| Description |
|
Due to how function docstrings are output by the ClojureScript compiler, the use of */ |
| Comments |
| Comment by Murphy McMahon [ 25/Nov/12 12:32 PM ] |
|
I didn't realize JIRA treats asterisks as markup, so just for clarification: the characters that produce the defect are slash asterisk, ie JavaScript's block comment closing syntax. |
| Comment by David Nolen [ 22/Dec/12 3:30 PM ] |
|
Do you have a suggested fix for this? |
[CLJS-427] Unqualified use of excluded/re-assigned set! symbol causes compilation error Created: 25/Nov/12 Updated: 20/Feb/13 Resolved: 20/Feb/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Murphy McMahon | Assignee: | Unassigned |
| Resolution: | Declined | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux, using lein-cljsbuild with clojurescript 0.0-1513 |
||
| Description |
|
Compilation (with :optimizations :whitespace) fails when using an unqualified, re-assigned set! symbol, producing the following exception: java.lang.AssertionError: Assert failed: set! target must be a field or a symbol naming a var targetexpr (This only occurs when using set! without qualification.) |
| Comments |
| Comment by David Nolen [ 21/Dec/12 5:53 PM ] |
|
Can we get a code example please? Thanks. |
| Comment by Murphy McMahon [ 22/Dec/12 8:59 AM ] |
|
Sure, given something like this: (ns store.local (:refer-clojure :exclude [set!])) (defn set! [k x] (.setItem js/localStorage k x)) ...The following code breaks during compilation for me (tested just now with r1552): (ns app.core
(:require [store.local :refer [set!]])
(:refer-clojure :exclude [set!])
(defn store-items! [xs]
(set! "data" xs))
...Whereas this code does not: (ns app.core
(:require [store.local :as store]))
(defn store-items! [xs]
(store/set! "data" xs))
|
| Comment by David Nolen [ 22/Dec/12 3:42 PM ] |
|
I looked a bit into the Clojure behavior, set! is a special form, one of the few things that can't be overridden. This behavior is the same as Clojure's and thus is unlikely to change. Unless you have some other argument for supporting this behavior I am inclined to close this ticket. |
| Comment by Murphy McMahon [ 23/Dec/12 2:44 AM ] |
|
No other argument, David; just that the behavior was unexpected since I was unaware set! is a special form. (Would it be helpful if the compiler warned against re-assignment then?) Anyhow, thanks for looking into it. |
[CLJS-426] subvec function not behaving consitently with invalid subranges Created: 22/Nov/12 Updated: 23/Nov/12 Resolved: 23/Nov/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Roman Gonzalez | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | bug, patch | ||
| Environment: |
Ubuntu precise 64 bits, Mac OS X Lion |
||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
When using the subvec function with a as a parameter vector and a range that is not in the original vector, the function returns a value: (subvec [1 2 3] 0 4) => [1 2 3 nil] However, when using with seqs, it works as it supposed to: (subvec (range 3) 0 4) => ERROR: Index out of bounds This is because the validation of ranges is not happening at build time of the subvec type, this bug contains a patch that adds a new private `build-subvec` function into cljs.core. |
| Comments |
| Comment by Roman Gonzalez [ 22/Nov/12 5:05 PM ] |
|
Patch for bug |
| Comment by David Nolen [ 23/Nov/12 2:51 PM ] |
|
This mostly looks good but there is a typo in the patch: (build-subvec. meta (-assoc v v-pos val) ... |
| Comment by Roman Gonzalez [ 23/Nov/12 3:09 PM ] |
|
Revised patch, removing small typo |
| Comment by Roman Gonzalez [ 23/Nov/12 3:18 PM ] |
|
Removing useless ^:mutable meta on function parameter |
| Comment by David Nolen [ 23/Nov/12 3:25 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/ee25599abb214074cbeefe37b399038d70c6ab89 |
[CLJS-425] JavaScriptCore advanced compilation tests fail with StackOverflow Created: 21/Nov/12 Updated: 20/Jan/13 Resolved: 20/Jan/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | David Nolen | Assignee: | Unassigned |
| Resolution: | Declined | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Regression - we need to git bisect to determine the commit. |
| Comments |
| Comment by David Nolen [ 20/Jan/13 12:47 AM ] |
|
Haven't been able to repro |
[CLJS-424] Internal representation of keywords can not be differentiated by printable characters Created: 19/Nov/12 Updated: 22/Dec/12 Resolved: 22/Dec/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | patch, patch, | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Currently, Symbols are represented by (str \uFDD1 \' name) and keywords are represented by (str \uFDD0 \' name) The \uFDDX character is not printable, so it appears as a little box when printed in a javascript repl such as the browser's console. The following character is always a \' regardless of whether the object is a symbol or a keyword. This has bitten me during debugging on several occasions. The attached patch changes keywords to be represented internally by (str \uFFD1 \: name) |
| Comments |
| Comment by David Nolen [ 22/Dec/12 3:45 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/21eab986826bd7a9e852712aaeda647a5de59b3b |
[CLJS-423] ClojureScript REPL should take analyze-path as an option Created: 18/Nov/12 Updated: 21/Nov/12 Resolved: 21/Nov/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | David Nolen | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
This way the REPL can be started with warnings enabled. This is for REPLs where evaluation environment is persistent and remote (Browser, Node.js, etc) |
| Comments |
| Comment by David Nolen [ 21/Nov/12 9:07 AM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/51ed707ca6956b7442427a26fcc3955f98615791 |
[CLJS-422] circular dependencies triggers infinite loop Created: 18/Nov/12 Updated: 21/Nov/12 Resolved: 21/Nov/12 |
|
| Status: | Resolved |
| 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 |
|
I believe this is because analysis follows dependencies naively. |
| Comments |
| Comment by David Nolen [ 21/Nov/12 9:05 AM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/698123fb25abf9c55ebf1c9bfddc87580a46ecb9 |
[CLJS-421] add clj->js Created: 18/Nov/12 Updated: 20/Nov/12 Resolved: 19/Nov/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | David Nolen | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
For complex keys in maps pr-str should be sufficient and sets could just become JS arrays. |
| Comments |
| Comment by Max Penet [ 18/Nov/12 7:30 PM ] |
|
Here is a first version. https://github.com/mpenet/clojurescript/commit/d10b08fa147374118e98e98fdffd9c61f95f9747.patch It would also be helpful if someone could run the tests against JSCore for me. Thanks! edit: I changed the patch to do whitelisting instead of blacklisting of types in |
| Comment by David Nolen [ 18/Nov/12 7:44 PM ] |
|
Thanks much. I will check it out tomorrow morning. |
| Comment by David Nolen [ 19/Nov/12 9:46 AM ] |
|
This patch looks good, can we get a proper patch attached to this ticket? Thanks! |
| Comment by Nicola Mometto [ 19/Nov/12 10:31 AM ] |
|
what's the point of doing eg (extend-protocol proto
default
(proto-fn [x]
(cond x
(string? x) do-a
(vector? x) do-b
:else do-c)))
rather than using extend-protocol on the specific types (extend-protocol proto string (proto-fn [x] do-a) IPersistentVector (proto-fn [x] do-b) default (proto-fn [x] do-c))) |
| Comment by David Nolen [ 19/Nov/12 11:11 AM ] |
|
The second approach will require considerably more code as extend-type to IPersistentVector doesn't work in ClojureScript, you have to enumerate all IPersistentVector types. Also enumerating all those types explicitly closes the door for people to override the default behavior if that's desired. I think the patch is sufficient to cover common usage - I'm inclined to let more sophisticated solutions get sorted out in a contrib if people don't find this implementation sufficiently customizable. |
| Comment by Max Penet [ 19/Nov/12 12:03 PM ] |
|
I just added the patch file. |
| Comment by David Nolen [ 19/Nov/12 12:10 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/cd66e6b9e63ad5ef1896a9c7a117148beb04301d |
| Comment by Wilkes Joiner [ 19/Nov/12 12:43 PM ] |
|
Do we want symbols and keywords to drop their unicode prefixes? |
| Comment by David Nolen [ 19/Nov/12 12:51 PM ] |
|
I don't see why they should retain them, I'm leaning towards Keyword & Symbols being proper datatypes - necessary for bootstrapping CLJS. |
| Comment by Wilkes Joiner [ 20/Nov/12 8:16 AM ] |
|
It triggered my information loss button. Since keywords and symbols are compiled to special strings, would retaining the indicators allow for easier mapping back from a js library into our cljs code? |
| Comment by Max Penet [ 20/Nov/12 8:26 AM ] |
|
Wilkes, I am not sure it would be a good idea, JSON libraries (cheshire, data.json etc) are a good example of this, you just fallback to the closest format that makes sense with the host/format. Nothing prevents your to create new Types and extend these protocols if you want to retain more information though. |
[CLJS-420] Unexpected behavior with dispatch on Keyword via protocols Created: 18/Nov/12 Updated: 18/Nov/12 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Max Penet | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug, enhancement | ||
| Description |
|
At the moment if you create a protocol and expect it to be able to dispatch on keywords you need to do it in js/String, trying to extend on cljs.core.Keyword doesn't work as keywords are just Strings. See https://gist.github.com/4104635 |
| Comments |
| Comment by David Nolen [ 18/Nov/12 3:14 PM ] |
|
This is a known issue which will have to wait for if and when Keywords and Symbols become proper types in ClojureScript. Extending js/Object is not recommended, if you actually need to add functionality to the base JS native types the convention is different from Clojure: default instead of Object, string instead of js/String. Please refer to core.cljs if you want more examples. |
| Comment by Max Penet [ 18/Nov/12 3:27 PM ] |
|
Thanks for the pointer about default and string, I didn't know about that. I reported the issue at the demand of bbloom. It does seem to be difficult to address without taking a (major) performance hit unfortunately. |
[CLJS-419] Exclude cljs source file from compilation Created: 17/Nov/12 Updated: 18/Dec/12 Resolved: 18/Dec/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Mimmo Cosenza | Assignee: | Unassigned |
| Resolution: | Declined | Votes: | 0 |
| Labels: | enhancement | ||
| Environment: |
every environment |
||
| Attachments: |
|
| Description |
|
Scenario:
Given this scenario, you need to duplicate all the cljs source files but the one that enable the connection. This mean you have to manually maintain two code bases. It could be useful to have a way to :exclude some files from :source-path. |
| Comments |
| Comment by David Nolen [ 18/Nov/12 3:16 PM ] |
|
This could easily be done by adding support for this in closure.clj - patch welcome! |
| Comment by Mimmo Cosenza [ 20/Nov/12 6:11 AM ] |
|
I propose to add a new keyword/value in the optimization option map, namely :exclude-path. the value of this option should be a subdir of the source-dir. Top level scenario: 1. you use lein-cljsbuild to define your cljs project 3. lein-cljsbuild plugin will instruct CLJ compiler by passing it the soruce-dir (e.g. "src/cljs") and the options map which now can contain also an optional :exclude-path keyword. 4. During compilation the compiler will exclude from source-dir any cljs source which is contained in the named excluded directory. I'll start bottom-up from 4. then I'll try to patch lein-cljsbuild too. Mimmo |
| Comment by Mimmo Cosenza [ 07/Dec/12 10:30 AM ] |
|
Hi David, here is the flattened patch relative. The two guys which worked on the patch under my direction are interns in my own company. Next monday we'll send their signed CA. My best |
| Comment by Brenton Ashworth [ 07/Dec/12 11:13 AM ] |
|
In general, we should not complicate the compiler with additional options when functionality can be provided by external tools. I think this feature can be provided by external tools. The compiler will only automatically pull in things that are actually dependencies of the sources that we provide to the compiler. External tools should provide ways to limit what is handed to the compiler. I would first attempt to modify lein-cljsbuild to do what you want. When using the compiler directly, you can provide your own implementation of Compilable which, when given a directory, will filter out sources based on some criteria you provide. In my projects I have custom implementations of Compilable that do just this. You should be able to do the same thing in lein-cljsbuild. -Brenton |
| Comment by Mimmo Cosenza [ 07/Dec/12 12:30 PM ] |
|
Thanks for the advice Brenton. I'll try to understand from the maintainer of `lein-cljsbuild` where to start from. I agree with you about keeping the compiler clean from options that can be implemented by the tools. But I'm no so sure that patching lein-cljsbuild we'll be as easy as adding `:exclude` option to the compiler. Mimmo |
| Comment by Brenton Ashworth [ 07/Dec/12 1:04 PM ] |
|
It doesn't matter which one is easier to do. Every new option and special case that we add to the compiler makes it more difficult to understand how changes will impact users. |
| Comment by David Nolen [ 07/Dec/12 5:40 PM ] |
|
I agree that anything that can be solved at higher level tools is better - it wasn't clear to me from the implementation that Compilable could be used to control this - but I see now. Mimmo, cljs.closure/build takes a Compilable and a map of options. So lein-cljsbuild could construct the custom Compilable that understands :excludes and pass it along. |
| Comment by Evan Mezeske [ 09/Dec/12 9:48 PM ] |
|
FWIW, I agree with Brenton that this should be in lein-cljsbuild. I didn't know that cljs.closure/build was flexible enough to do this already. I always thought that it needed to be extended so that a vector of files could be passed in, or something, but it sounds like the Compilable approach should work just fine. I will happily accept a patch for this. One thing to keep in mind, though, is that the :exclude entry should not be in the :compiler map if lein-cljsbuild is handling it. The :compiler map is passed straight through as options to cljs.closure/build. So, the :exclude entry should be a neighbor of the :compiler entry. |
| Comment by Mimmo Cosenza [ 10/Dec/12 4:20 AM ] |
|
Hi all, Mimmo |
| Comment by Mimmo Cosenza [ 10/Dec/12 4:37 AM ] |
|
Hi all, My best Mimmo |
| Comment by David Nolen [ 18/Dec/12 3:09 PM ] |
|
Should be resolved by tools that use the compiler. |
[CLJS-418] Unspecified dependency on google-closure-library-third-party Created: 16/Nov/12 Updated: 16/Feb/13 Resolved: 16/Feb/13 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Stuart Sierra | Assignee: | Stuart Sierra |
| Resolution: | Completed | Votes: | 3 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Temporary fix to this issue: Add the G.Closure Library third-party extensions as a project dependency. ;; In :dependencies vector of Leiningen's project.clj
[org.clojure/google-closure-library-third-party "0.0-2029"]
We currently distribute the Google Closure Library in two separate JARs: the main library and the third-party extensions. We do this because the third-party extensions are covered by different licenses. But, as it turns out, various classes in the main library have explicit dependencies on things in the third-party extensions. See See also this G.Closure mailing list discussion. As a result, the ClojureScript browser-connected REPL has a transitive dependency on the Google Closure Library third-party extensions. This manifests as an error in script/cljsc and a NullPointerException in lein-cljsbuild. See the initial Clojure-dev mailing list discussion and discussion of this ticket. See also lein-cljsbuild issue #155. It seems that the dependency on third-party extensions is unavoidable. There are several possible fixes: 1. Release a new G.Closure Library JAR with a declared dependency on the third-party extensions JAR. This best reflects the actual dependency relationships. 2. Release a new G.Closure Library JAR with the third-party extensions included in the JAR. This would make it harder to exclude the third-party-licensed code from projects which do not actually require it. 3. Release a new version of ClojureScript with a declared dependency on the third-party extensions JAR. This makes the dependency more visible to ClojureScript developers. Regardless of the approach taken, developers can always use explicit dependencies/exclusions to choose which version of the G.Closure library to include in their projects. |
| Comments |
| Comment by Herwig Hochleitner [ 04/Dec/12 7:10 PM ] |
|
Attached patch implements option 1 The generated closure-library depends on the old clojure-library-third-party. |
| Comment by Evan Mezeske [ 16/Dec/12 8:29 PM ] |
|
I added a workaround for this so that I can release lein-cljsbuild without breaking every single project that uses it: https://github.com/emezeske/lein-cljsbuild/issues/163 . I would like to revert this workaround ASAP. I'm going to do a bad job of maintaining the right version of the third party libraries, and it will cause problems down the road. |
| Comment by Chas Emerick [ 27/Jan/13 5:37 PM ] |
|
Option 1 is proper, 3 is acceptable. Any solution will do though; drove myself nuts with this today for longer than I'd like to admit before I discovered this ticket. |
| Comment by David Nolen [ 27/Jan/13 5:41 PM ] |
|
Is everyone cool with option 1? It would be nice to resolve this one soon as people are running into non-working browser REPLs. |
| Comment by Michał Marczyk [ 27/Jan/13 7:29 PM ] |
|
+1 for option 1. |
| Comment by Stuart Sierra [ 03/Feb/13 3:50 PM ] |
|
Deployed new version of Google Closure library to Sonatype OSS today. Please try it out. [org.clojure/google-closure-library "0.0-2029-2"]
This release declares an explicit dependency from google-closure-library on google-closure-library-third-party (Option 1 in the ticket description). It will be available in the Maven Central repository within 24 hours. Until then, you can get it from the Sonatype repository with these instructions: If it works, we can update the ClojureScript POM to depend on it. -S |
| Comment by Stuart Sierra [ 16/Feb/13 2:59 PM ] |
|
pom.template updated in commit f2e0d9050a1b |
[CLJS-417] cljs.core/mod incorrect for negative numbers Created: 12/Nov/12 Updated: 21/Nov/12 Resolved: 21/Nov/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
JavaScript's % (modulo) operator gives incorrect answers for negative numbers, e.g. -2 % 5 => -2 which carries over to cljs.core/mod This blog: http://javascript.about.com/od/problemsolving/a/modulobug.htm suggests defining modulo as: Number.prototype.mod = function(n) { return ((this%n)+n)%n; } ClojureScript's mod should use this workaround |
| Comments |
| Comment by Herwig Hochleitner [ 12/Nov/12 4:41 AM ] |
|
Attached patch renames cljs.core/mod to cljs.core/js-mod, along with occurrences in cljs.core. cljs.core/mod is redefined with fix for negative numbers. |
| Comment by David Nolen [ 21/Nov/12 9:11 AM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/14bd16ef5894458a3709ebfee3e78a876938bfa6 |
[CLJS-416] emit-block doesn't use context argument Created: 09/Nov/12 Updated: 21/Dec/12 Resolved: 21/Dec/12 |
|
| Status: | Closed |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Declined | Votes: | 0 |
| Labels: | patch, patch, | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
emit-block currently has arguments [context statements ret] but the context argument is never used and all call sites always draw statements and ret from the same block AST node. The attach patch simplifies emit-block and all call sites to use arguments [{:keys [statement ret]}] |
| Comments |
| Comment by Brandon Bloom [ 21/Dec/12 5:30 PM ] |
|
Obsoleted by http://dev.clojure.org/jira/browse/CLJS-441 |
[CLJS-415] Speed up cljsc by exiting when work is done. Created: 02/Nov/12 Updated: 02/Dec/12 Resolved: 02/Dec/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
When following cljsc output with tail -f test.js you can see that even after the ouput is printed, the compiler waits a long time before exiting. |
| Comments |
| Comment by David Nolen [ 02/Dec/12 11:24 AM ] |
|
fixed http://github.com/clojure/clojurescript/commit/3842d3f9e0d68853077117a9192222e93e169079 |
[CLJS-414] Implement specify, allowing instances to implement protocols Created: 30/Oct/12 Updated: 03/May/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Herwig Hochleitner | Assignee: | Herwig Hochleitner |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Javascript objects are fully dynamic. Currently, ClojureScript has no mechanism to exploit that for protocol implementation.
extend-type can be implemented in terms of specify (by specifying the .prototype), but extend-type has grown from its humble beginnings
and all that in a single macro body. So this is also a good opportunity to do some refactoring. specify should have an interface similar to extend-type. Additionally a lower level operation is needed to attach existing lambdas as protocol methods. It's called specify* in my current implementation. It takes a lambda for every specified protocol-method-arity, with a syntax loosely based on clojure.core/extend. |
| Comments |
| Comment by Herwig Hochleitner [ 30/Oct/12 11:21 PM ] |
|
First patch implements specify, second switches extend-type to use it. |
| Comment by David Nolen [ 31/Oct/12 9:30 AM ] |
|
This is a big patch so it's going to take time to review. First question, if we're going to follow the footsteps of extend what's the purpose of changing the syntax like having to specify a map of arities? |
| Comment by Herwig Hochleitner [ 31/Oct/12 10:32 AM ] |
|
The reason is that I wanted specify* to do as little as possible. It's basically just an abstraction over the name mangling for protocol methods, which was completely hidden till now. One of the purported use cases is: (def methA-1 [this] ...) (def methA-2 [this x] ...) (def methB-1 [this] ...) (defn specify-to-P [o] (specify* o P {methA {1 methA-1 2 methA-2} methB {1 methB-1}})) Here the method bodies are not allocated every time specify-to-P is called, as opposed to what the more high-level specify would do. If we didn't know which arities are to be generated, there would be simply no way to infer it:
EDIT: As for using symbols instead of keywords: I could do this, since specify* is a macro, not a function. |
| Comment by Herwig Hochleitner [ 31/Oct/12 12:59 PM ] |
|
That way we could support consumers that want to determine the set of implemented protocols at runtime, similar to extend. This can be a separate ticket where we work out whether it's :method 'method or "method". As for specify* using symbols: My gut feeling tells me that since it will always be a compiler macro (or builtin) and takes the arities, there is no merit in making it superficially more similar to extend. OTOH, it occurs to me that given specify-method, we could leave out specify* completely. I think I'll try that when I get home from work. Thoughts on that approach? |
| Comment by Herwig Hochleitner [ 31/Oct/12 7:59 PM ] |
|
Actually, I had a rationale for using symbols in specify*, which I just now rediscovered while trying to implement aforementioned specify-method. This is also the real reason specify* (or specify-method) can't be a function: It would need a reflective layer to go from [proto method arity] to the gclosure minified version of $proto$method$arity$a. We don't have that in clojurescript, since it would considerably add to the output size. Considering that all, I think specify* in the current form is appropriate after all. Nevertheless I found an unrelated issue in the patch where 'Object would be resolved (with an unused result), triggering a warning. I added the 0001_1 patch, which supersedes 0001 and is functionally equivalent modulo the warning issue. 0002 still applies. |
| Comment by Herwig Hochleitner [ 01/Nov/12 12:09 AM ] |
|
Attached patch set 01** supersedes patch set 00** The differences are
|
| Comment by Herwig Hochleitner [ 03/Nov/12 12:53 AM ] |
|
Set up a design page http://dev.clojure.org/display/design/specify+i.e.+reify+for+instances |
| Comment by Herwig Hochleitner [ 04/Nov/12 10:06 PM ] |
|
Attached patch 0104, applies on top of other 01* patches. |
| Comment by Herwig Hochleitner [ 03/May/13 7:30 PM ] |
|
rebased to current master |
[CLJS-413] Using 'null' as a var name leads to illegal code Created: 30/Oct/12 Updated: 21/Dec/12 Resolved: 21/Dec/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Description |
(ns pkg) (def null "abc") compiles to the following javascript pkg.null = "abc"; which is not legal. Other reserved javascript keywords may have the same issue. |
| Comments |
| Comment by David Nolen [ 21/Dec/12 5:58 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/9219dacfefc6e90012eedd89487747e10f013372 |
[CLJS-412] Undeclared warning when defining protocols Created: 29/Oct/12 Updated: 21/Dec/12 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Evaluate the following in a ./script/repl session (require '[cljs.compiler :as comp])
(require '[cljs.analyzer :as ana])
;; This trickery seems to be the minimum logic to prepare a top level namespace
(def repl-env
(binding [ana/*cljs-ns* 'cljs.user]
(-> (ana/empty-env)
(ana/analyze '(ns some-ns))
:env
(assoc :ns (ana/get-namespace ana/*cljs-ns*)))))
(defn analyze [form]
(binding [ana/*cljs-warn-on-undeclared* true]
(ana/analyze repl-env form)))
(-> '(defprotocol P
(f [_ x]))
analyze
keys) ; keys is just so the output isn't huge
The first time you evaluate that last form, you get an error like this one: WARNING: Use of undeclared Var some-ns/f at line 45 You'll get similar errors each time you rename f and re-evaluate the form. |
| Comments |
| Comment by Brandon Bloom [ 29/Oct/12 3:57 PM ] |
|
Seems like the underlying issue is referring to a var while it is being defined. This form exhibits the same issue: (def f [x] (aget f "prototype"))
|
| Comment by Brandon Bloom [ 29/Oct/12 7:09 PM ] |
|
The more I study this, the more I'm convinced that cljs-warn-on-undeclared is broken badly. Recursive functions (not using recur) generate this warning. As do certain parameters, locals, or other variable references that are actually defined. The issue seems to stem from a conflation between symbol definition and resolution. resolve-var, resolve-existing-var, and (parse 'def ...) are all tangled in a crazy mutually recursive way. A lot of that stems from a recursive analyze call to yield init-expr and ultimately fn-var? inside of the def parse code. |
| Comment by David Nolen [ 21/Dec/12 6:02 PM ] |
|
Your first comment isn't valid code so I'm not sure what you mean. When I enter it correctly into the REPL I get no warnings. I also get no warnings when defining at a protocol at the REPL. Do you have a specific minimal CLJS project that exhibits the issue? |
[CLJS-411] broken let cases Created: 28/Oct/12 Updated: 02/Nov/12 Resolved: 02/Nov/12 |
|
| Status: | Resolved |
| 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 | ||
| Attachments: |
|
| Description |
(assert (= "original" (let [x "original" oce (fn [] x) x "overwritten"] (oce)))) (letfn [(x [] "original") (y [] (x))] (let [x (fn [] "overwritten")] (assert (= "original" (y))))) |
| Comments |
| Comment by Brandon Bloom [ 28/Oct/12 5:13 PM ] |
|
What's the problem? This output seems fine to me: $ rlwrap ./script/repljs "Type: " :cljs/quit " to quit" #(assert (= "original" (let [x "original" oce (fn [] x) x "overwritten"] (oce)))) #< function () { if (cljs.core._EQ_.call(null, "original", (function () { var x = "original"; var oce = (function () { return x; }); var x__$1 = "overwritten"; return oce.call(null); })())) { return null; } else { throw (new Error([cljs.core.str("Assert failed: "), cljs.core.str(cljs.core.pr_str.call(null, cljs.core.with_meta(cljs.core.list("\ufdd1'=", "original", cljs.core.with_meta(cljs.core.list("\ufdd1'let", cljs.core.vec(["\ufdd1'x", "original", "\ufdd1'oce", cljs.core.with_meta(cljs.core.list("\ufdd1'fn", cljs.core.vec([]), "\ufdd1'x"), cljs.core.hash_map("\ufdd0'line", 14)), "\ufdd1'x", "overwritten"]), cljs.core.with_meta(cljs.core.list("\ufdd1'oce"), cljs.core.hash_map("\ufdd0'line", 16))), cljs.core.hash_map("\ufdd0'line", 13))), cljs.core.hash_map("\ufdd0'line", 13))))].join(""))); } } > #(letfn [(x [] "original") (y [] (x))] (let [x (fn [] "overwritten")] (assert (= "original" (y))))) #< function () { var x = (function x() { return "original"; }); var y = (function y() { return x.call(null); }); var x__$1 = (function () { return "overwritten"; }); if (cljs.core._EQ_.call(null, "original", y.call(null))) { return null; } else { throw (new Error([cljs.core.str("Assert failed: "), cljs.core.str(cljs.core.pr_str.call(null, cljs.core.with_meta(cljs.core.list("\ufdd1'=", "original", cljs.core.with_meta(cljs.core.list("\ufdd1'y"), cljs.core.hash_map("\ufdd0'line", 12))), cljs.core.hash_map("\ufdd0'line", 12))))].join(""))); } } > As an aside. The less-mangled names in the output are much more pleasant to look at |
| Comment by David Nolen [ 28/Oct/12 5:40 PM ] |
|
nothing is broken, added test cases, http://github.com/clojure/clojurescript/commit/a3d2270480d5d4774ba20b587cdb7544546f4200 |
| Comment by Herwig Hochleitner [ 28/Oct/12 6:41 PM ] |
(do (let [x "original"] (defn original-closure-stmt [] x)) (let [x "overwritten"] (assert (= "original" (original-closure-stmt)))) is still broken, patch forthcoming |
| Comment by Herwig Hochleitner [ 28/Oct/12 6:41 PM ] |
|
should i make a new ticket? |
| Comment by Herwig Hochleitner [ 28/Oct/12 7:05 PM ] |
|
OK, I tried to patch the issue by wrapping every statement let in a function.
|
| Comment by David Nolen [ 28/Oct/12 7:37 PM ] |
|
I think we can probably make the current approach work with some more thought. |
| Comment by David Nolen [ 28/Oct/12 7:40 PM ] |
|
Reopening |
| Comment by Herwig Hochleitner [ 28/Oct/12 7:57 PM ] |
|
The problem are recurs across a nested let, so wrapping with fns isn't an option, unless we want to special case lets containing a recur form. |
| Comment by Herwig Hochleitner [ 28/Oct/12 8:13 PM ] |
|
Tracking let vars in the lexical scope won't solve it, the shadowing patch already does that. IMO that leaves globally tracking or gensyming let vars. A design for compilation units would encompass global transformations like that. For now we can implement el-cheapo gensyming in the emitter, which I have done in previous ticket. For reference, my considerations on compilation units here: http://dev.clojure.org/display/~bendlas/Design+for+compilation+units+in+ClojureScript |
| Comment by David Nolen [ 02/Nov/12 9:21 AM ] |
|
subsumed by |
[CLJS-410] support ^:expose annotation Created: 28/Oct/12 Updated: 28/Oct/12 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | David Nolen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| 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 |
[CLJS-409] Small code cleanup for emitting goog.provide statements Created: 27/Oct/12 Updated: 27/Oct/12 Resolved: 27/Oct/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | patch, patch, | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Just abstracts out a duplicated piece of code. |
| Comments |
| Comment by David Nolen [ 27/Oct/12 4:52 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/d8f490e9b958a43e97b34808e76d977f29fee8c9 |
[CLJS-408] Include :form on fn :methods in AST Created: 24/Oct/12 Updated: 27/Oct/12 Resolved: 27/Oct/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | patch, patch, | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
All core CLJS AST nodes include a :form key. Several quasi-nodes similarly include their originating code forms. Although :fn nodes include their :form, it varies between single and multiple arity functions. I've found it easier to assume multiple arities and always analyze :methods directly. Unfortunately, the methods lack :form keys. This simple patch exposes the form of each method, simplifying function transformations. |
| Comments |
| Comment by David Nolen [ 27/Oct/12 4:52 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/3ea4a9309346a2a2d0983dc535b9b00531bfc90f |
[CLJS-407] cljs.import-test not run in test suite / ordering problem in the compiler Created: 24/Oct/12 Updated: 21/Dec/12 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
The test code from Hooking up the test, however reveals a deeper problem (besides that it has a failing assumption): Presumably due to the goog.provides later in the files, the compiler orders the output wrong, which results in not provided errors. |
| Comments |
| Comment by Herwig Hochleitner [ 24/Oct/12 3:23 AM ] |
|
Patch hooks up the tests into the test suite. If you want to see the provide error, delete out before compiling. If you want to see the failing assertion from the original test, compile a second time. |
| Comment by David Nolen [ 24/Oct/12 11:01 AM ] |
|
In order to better understand tickets it best not to complect different issues I assume the patch fixes one thing, but reveals an unresolved issue, am I correct? |
| Comment by Herwig Hochleitner [ 24/Oct/12 11:26 AM ] |
|
You're right, the ordering problem could be a different ticket. Sorry for that. To clarify, there are three issues at play: 1) Part of the testsuite not executed (fixed by the patch) The reason I decided to roll it into one ticket is that only addressing one of 2) and 3) leaves the test suite failing. I almost wanted to reopen |
| Comment by David Nolen [ 21/Dec/12 6:07 PM ] |
|
I fixed some dependency ordering issue in another patch, would be nice to know if the ordering issues are addressed. What part of this ticket is still relevant? This is why tickets that only address one thing at a time are nice |
[CLJS-406] reduce-kv doesn't work for all data structures Created: 24/Oct/12 Updated: 21/Nov/12 Resolved: 21/Nov/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Right now reduce-kv is not implemented for ObjMap and broken for ArrayMap. |
| Comments |
| Comment by Herwig Hochleitner [ 24/Oct/12 2:48 AM ] |
|
Patch contains fixes and tests |
| Comment by Herwig Hochleitner [ 24/Oct/12 3:33 AM ] |
|
Please note, that this patch was based on my local version for |
| Comment by David Nolen [ 26/Oct/12 7:33 PM ] |
|
Patch no longer applies can you make a new one? Thanks! |
| Comment by Herwig Hochleitner [ 28/Oct/12 6:13 PM ] |
|
Patch 0002 replaces 0001 |
| Comment by David Nolen [ 21/Nov/12 9:13 AM ] |
|
Looks like the second patch doesn't apply either. |
| Comment by Herwig Hochleitner [ 21/Nov/12 9:52 AM ] |
|
Patch 0003 applies to current master |
| Comment by David Nolen [ 21/Nov/12 10:37 AM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/bac7bdb65f255baca167ac10479e279397a979cb |
[CLJS-405] reify regression Created: 23/Oct/12 Updated: 23/Oct/12 Resolved: 23/Oct/12 |
|
| Status: | Resolved |
| 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 |
(defprotocol IFoo (-foo [this x])) (defn bar [f] (reify IFoo (-foo [_ x] (f x)))) ((bar inc) 1) ;; throws This fails because f in the -foo implementation while correctly identified as a field gets renamed via shadow analysis. Looks like it may have been caused by |
| Comments |
| Comment by David Nolen [ 23/Oct/12 6:28 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/a6fa901adfb0125e78eadea90bccd6faa5e4124a |
[CLJS-404] Automate Browser REPL testing Created: 23/Oct/12 Updated: 23/Oct/12 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | David Nolen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
It's worth investigating Selenium, PhantomJS, etc. as solutions to sanity check the Browser REPL when we run the other tests. |
[CLJS-403] Printed JS code on REPL stack trace inconsistent with what got evaluated Created: 22/Oct/12 Updated: 23/Oct/12 Resolved: 23/Oct/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
This issue arose from http://dev.clojure.org/jira/browse/CLJS-397 The REPL uses a statement context to compile the code printed out as part of a stack trace. The code that runs, however, actually gets compiled in an :expr context, in a wrapper form. Several ops (fn, constant, var) don't get emitted in a statement context. Thus a form a form like (if (> 0.5 (Math/random)) gets compiled to if (Math.random() > 0.5) {
throw "";
}else{ according to the stack trace, while still returning :value half of the time. |
| Comments |
| Comment by Herwig Hochleitner [ 22/Oct/12 2:55 PM ] |
|
Attached patch updates REPL to analyze in an expression context. |
| Comment by David Nolen [ 23/Oct/12 6:50 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/72e55315c6973caa74af39b66052424f73872033 |
[CLJS-402] Add a facility to obtain the version information of the clojurescript build that is in use Created: 21/Oct/12 Updated: 26/Feb/13 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Frank Siebenlist | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | enhancement | ||
| Attachments: |
|
| Description |
|
Currently there is no function or var defined in the clojurescript library that can be used to easily obtain the version information of the build that is in use. Without that version information, debugging and reporting of errors is more cumbersome than needed, wastes time, causes confusion discussing issues... A simple function and/or var like the ones used for clojure would be very helpful: user=> (clojure-version) |
| Comments |
| Comment by Frank Siebenlist [ 21/Oct/12 2:16 PM ] |
|
Auto-generation from the build script of version_autogen.clj and version_autogen.cljs files |
| Comment by David Nolen [ 21/Oct/12 3:43 PM ] |
|
Why a separate namespace for this? |
| Comment by Frank Siebenlist [ 21/Oct/12 9:15 PM ] |
|
Good point - probably better to add the clojurescript-version var to the cljs.core namespace. New patch change the build script to auto-generates the clojurescript-version assignment statements in both cljs/core.clj and cljs/core.cljs to reflect the correct version info. In that way it resembles more the clojure.core use of clojure-version. Note that the two separate assignments for clj and cljs are needed to detect out-of-sync of repl-compiler version with the compiler used to generate the js-code that was downloaded thru the webpage. Difficult to write a test-script, but it seems to work in my repl: — |
| Comment by Frank Siebenlist [ 21/Oct/12 9:16 PM ] |
|
CLJS-402: build script auto-generates the clojurescript-version assignment statements in both cljs/core.clj and cljs/core.cljs to reflect the correct version info |
| Comment by Frank Siebenlist [ 22/Oct/12 12:00 AM ] |
|
When I tried to implement a "clojurescript-version" function like the "clojure-version" one, I (re)discovered that cljs/core.clj is not your average cli-file but some funky file used by the clojurescript compiler to bootstrap - in other words it's not a good file to require and run normal functions from your clj-environment. So I moved the *clojurescript-version* var to cljs/compiler.clj as it seemed to make sense to associate the version with the compiler. On the cljs site, I left the *clojurescript-version* in cljs/core.cljs, although I was tempted to create a cljs.compiler namespace to store that var on the cljs side to make it symmetric Also added a (clojurescript-version) function to both the clj and cljs sides, with an added special-fn in the cljs/repl.clj such that you can ask for the compiler version of the repl-server from the cljs-repl. Updated 3rd patch file replaces the previous one. Just wanted to record an example of a mismatch in compilers: user=> (run-repl-listen) This happens when you generate the javascript from your cljs with a "lein cljsbuild once" command with compiler version "0.0.1515", |
| Comment by Frank Siebenlist [ 22/Oct/12 12:03 AM ] |
|
build script auto-generates the clojurescript-version assignment statements in both cljs/compiler.clj and cljs/core.cljs to reflect the correct version info |
| Comment by David Nolen [ 22/Oct/12 7:06 AM ] |
|
The patch uses sed, I'm not sure this is such a great idea since whatever the patch does should probably work with whatever build setup we have on Hudson. |
| Comment by Chouser [ 22/Oct/12 8:05 AM ] |
|
Would it make sense to call this 'clojure-version' as well, instead of clojurescript-version? It's a map, and so various flags could be added to differentiate jvm, js, python, c, etc. runtimes. What does ClojureCLR do? |
| Comment by Frank Siebenlist [ 22/Oct/12 10:52 AM ] |
|
sed was already used in the build script... a few lines down, the pom file is transformed with: sed -e s/CLOJURESCRIPT_VERSION/0.0-$REVISION/ < "$POM_TEMPLATE" > "$POM_FILE" |
| Comment by Frank Siebenlist [ 22/Oct/12 11:15 AM ] |
|
A quick scan of the src-code showed that ClojureCRL uses clojure-version and *clojure-version*. However, there is less chance for confusion as you are supposedly running on the CLR already. With ClojureScript you can have these three intertwined "clojure" environments that are all live at the same time: the clojure version, the repl clojurescript version, and the clojurescript version used to compile the initially loaded js. Not sure if overloading the clojure-version fn-name and relying on namespaces to differentiate will be helpful... but it's not that big of a deal and I'm easily persuaded otherwise - somebody should make the call and I'll change it. |
| Comment by David Nolen [ 26/Feb/13 7:51 AM ] |
|
Sorry just now coming back to this ticket. I think it's probably preferable that the map of properties be called the same thing everywhere. I would apply the patch with this change. I note it no longer applies to master. |
[CLJS-401] top level let emits vars without namespace Created: 20/Oct/12 Updated: 02/Nov/12 Resolved: 02/Nov/12 |
|
| Status: | Resolved |
| 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 | ||
| Attachments: |
|
| Comments |
| Comment by Herwig Hochleitner [ 24/Oct/12 2:00 AM ] |
|
I've created test cases for lexical scoping, which include this issue. The fix is a rather ugly hotfix in the emitter, which uses a dynamic var to keep track of renamed locals. I'm also working on a solution with an AST walker, but that's not ready yet. |
| Comment by David Nolen [ 24/Oct/12 11:04 AM ] |
|
I'd rather see a proper patch. BTW, did you try just making `let` always wrap its body in a function regardless of :statement or :expr context? GClosure may optimize these away for us if there are no name clashes. We should run the benchmarks to make sure this approach doesn't cause a global performance regression. |
| Comment by Brandon Bloom [ 27/Oct/12 3:58 PM ] |
|
I uploaded the 0003 patch with an alternative approach. This one wraps each top-level form (except 'ns) in a function scope. |
| Comment by David Nolen [ 27/Oct/12 4:50 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/aea65a69384b05b0b79b94fdd9daee936ab68d5e |
| Comment by Herwig Hochleitner [ 28/Oct/12 4:51 PM ] |
|
Are we going to fix the issue for non-toplevel lets too, like demonstrated in the 0001 test case? |
| Comment by David Nolen [ 28/Oct/12 4:57 PM ] |
|
I'm surprised the letfn case is not covered by the shadowing patch. The overwriting in the expression case does seem problematic. |
| Comment by David Nolen [ 28/Oct/12 5:00 PM ] |
|
I've created a separate ticket for the other let cases - http://dev.clojure.org/jira/browse/CLJS-411 |
| Comment by Herwig Hochleitner [ 28/Oct/12 6:37 PM ] |
|
Actually, the letfn case and the expression case are covered by the shadowing patch, so no fault there. |
| Comment by David Nolen [ 30/Oct/12 1:23 PM ] |
|
Reopening. Will review Herwig's patch and likely revert Brandon's and apply Herwig's. |
| Comment by David Nolen [ 02/Nov/12 8:50 AM ] |
|
Can we get a new version of your patch Herwig that applies to master. I've reverted Brandon's patch http://github.com/clojure/clojurescript/commit/3acacf73dce7b3961b2ea38f593df5df66eec3ff. It would be nice to cut a new ClojureScript release today. Thanks! |
| Comment by Herwig Hochleitner [ 02/Nov/12 1:32 PM ] |
|
Attached 0101 Patch, which supersedes 0001 and 0002 |
| Comment by David Nolen [ 02/Nov/12 1:51 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/234bd3a85213d98595090b3a6625f0aeae7ea6ed |
[CLJS-400] Stop using goog.string.quote to escape strings for printing Created: 19/Oct/12 Updated: 22/Oct/12 Resolved: 22/Oct/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
The contract of goog.string.quote is to produce a "valid JavaScript string", which can end up being quite different from what is expected by e.g. the Clojure reader and other edn-compatible readers. This has been discussed in a variety of threads/issues:
The most significant issue is that characters > 127 and < 256 are outputted with an \x.. escape sequence, which no other reader supports. Further, other Unicode characters are always escaped using the \u.... notation; this is not a functional difference, but can be a stumbling block, e.g. when viewing data that had been pr-str'd that contains high codepoint characters. The most straightforward fix is to take control of printed string escaping to ensure the results conform first to the expectations of existing readers (primarily Clojure's and ClojureScript's), and to the formal [edn specification](https://github.com/edn-format/edn/) as that matures. This ticket supersedes http://dev.clojure.org/jira/browse/CLJ-1025. |
| Comments |
| Comment by Chas Emerick [ 19/Oct/12 7:50 PM ] |
|
Patch attached |
| Comment by David Nolen [ 19/Oct/12 8:13 PM ] |
|
Thanks. Performance things - can we avoid instantiating the RegExp everytime, can we switch char-escapes to a JS object and use aget? |
| Comment by Chas Emerick [ 19/Oct/12 9:11 PM ] |
|
Patch |
| Comment by David Nolen [ 20/Oct/12 9:42 AM ] |
|
Using the let won't work here. That will be emit top-levels that are not namespaced. Edge case in the compiler that should be sorted out on another ticket. Just define top levels for these thanks. |
| Comment by Chas Emerick [ 22/Oct/12 2:03 PM ] |
|
New patch attached with requested changes, |
| Comment by David Nolen [ 22/Oct/12 6:06 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/3b32345966a65f66e49563a3a40a2877d0435c5d |
[CLJS-399] Lazy initialize global-hierarchy Created: 19/Oct/12 Updated: 23/Oct/12 |
|
| Status: | Open |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Depends on extend-instance http://dev.clojure.org/jira/browse/CLJS-398 First patch backs atoms by a protocol IPlace and implements reset! and swap! and compare-and-set! only with protocols Second patch uses extend-instance to implement global-hierarchy a custom lazy atom In effect, multimethods and hierarchies can be omitted by gclosure, taking 1K off of hello world https://groups.google.com/d/topic/clojure/LNfJRw07u8I/discussion |
| Comments |
| Comment by David Nolen [ 19/Oct/12 5:18 PM ] |
|
The protocol should probably just be called IAtom. A note, changing atoms to go through protocols has performance implications - generally protocol fns are about twice as slow as regular fns. I'll take a closer look. |
[CLJS-398] new macro cljs.core/extend-instance Created: 19/Oct/12 Updated: 19/Oct/12 Resolved: 19/Oct/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Declined | Votes: | 0 |
| Labels: | enhancement, patch | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Patch introduces an extend-instance macro, similar to extend-type. This is useful to let existing instances, e.g. parsed JSON directly implement a protocol. |
| Comments |
| Comment by David Nolen [ 19/Oct/12 5:13 PM ] |
|
Rich Hickey already had a good name for an operation like this - specify. |
| Comment by Herwig Hochleitner [ 19/Oct/12 6:10 PM ] |
|
OK, I've declined the ticket, since not only the name but also the patches should be disregarded. The problem with above impl is that the generated implementing fns get instantiated, every time extend-instance is evaluated. That is not acceptable on a per-instance basis. I will work on a new macro called specify, which allows passing implementing fns. Is a syntax similar to clojure.core/extend right for specify? |
| Comment by David Nolen [ 19/Oct/12 7:51 PM ] |
|
As far as I understand it the interface for specify should be the same as extend-type. |
[CLJS-397] Omit var reads in statement context Created: 19/Oct/12 Updated: 23/Oct/12 Resolved: 23/Oct/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | enhancement, patch, size | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Attached patch updates cljs emitter to not emit var references in statement context. cljs helloworld shrinks from ~90K to ~69K https://groups.google.com/d/topic/clojure/LNfJRw07u8I/discussion |
| Comments |
| Comment by David Nolen [ 19/Oct/12 5:15 PM ] |
|
Can we get the ticket # in the commit message? Thanks! |
| Comment by Herwig Hochleitner [ 19/Oct/12 5:42 PM ] |
|
Of course, sorry! Here is a new patch, if you please. |
| Comment by David Nolen [ 19/Oct/12 7:32 PM ] |
|
Thanks. I'm confused about the second aspect of the patch, what do you mean by bogus error messages? |
| Comment by Herwig Hochleitner [ 19/Oct/12 11:23 PM ] |
|
Well, the repl uses a :statement context to generate the javascript which gets printed out as part of a stack trace. When setting :expr back to :statement in the repl, you can try the following scenario:
With the full patch, the printout will be smth like '(function(){ns.val = ":worked"; if (Math.rand() > 0.5){return ns.val}{throw ""}})()', which is noisier, but more like what actually got evaluated by the repl client. ##EDIT#APPEND## The reason the repl still works, even when analyzing in a statement context with the patch is, that in order to get the return value, the repl statement has to be evaluated in an :expr context anyway. |
| Comment by David Nolen [ 20/Oct/12 9:33 AM ] |
|
I'm still confused. Does this additional modification have anything to do with the ticket? By that I mean does the patch require the second modification? If it does can you explain a further? Thanks. |
| Comment by Herwig Hochleitner [ 20/Oct/12 1:17 PM ] |
|
The patch doesn't require the second modification in the sense that everything still works if it's left out. The patch requires the modification in the sense that it would break stack traces on the REPL otherwise + the two changes should be reverted together if and when we move such optimizations out of the emitter into an optimization pass. So the trade off is in always having the correct code in a REPL stacktrace in exchange for making it more verbose. Again, this doesn't influence behavior, so it's a matter of prioritizing requirements. |
| Comment by David Nolen [ 21/Oct/12 3:48 PM ] |
|
I still don't understand why/how the part of the patch that addresses the ticket breaks stack traces. Can you explain? |
| Comment by Herwig Hochleitner [ 22/Oct/12 10:06 AM ] |
|
1) var read statements get omitted |
| Comment by David Nolen [ 22/Oct/12 10:16 AM ] |
|
Ok I understand now, I don't think the second part of the patch is relevant. The user entered two statements, not one combined in an implicit do which is what the other part of the patch does. Can we get a new patch that only includes the part that addresses the ticket? Thanks! |
| Comment by Herwig Hochleitner [ 22/Oct/12 2:58 PM ] |
|
For the record: There was some talk in the chat, where I laid down my rationale for changing the repl specifically: "Technically repl inputs have to be in an expr context, to capture the return val. And they are, by virtue of the wrapping form. The change makes that fact explicit, thereby keeping stack traces sane." I also discovered, that two other ops, beside a var read, don't emit in a statement context either and therefore have same issue. I created http://dev.clojure.org/jira/browse/CLJS-403 for the REPL change. Updated attached patch contains just the optimization. |
| Comment by David Nolen [ 23/Oct/12 6:49 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/97e5fbd1e1597d58be35fd8320c8044ccc9d3a3d |
[CLJS-396] "Simplify" lower-case and upper-case functions in cljs.string Created: 16/Oct/12 Updated: 22/Dec/12 Resolved: 22/Dec/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Trivial |
| Reporter: | Edward Tsech | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Comments |
| Comment by David Nolen [ 22/Dec/12 3:26 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/00952e6c2c85fdc7dd2f97285fb8c142822444ac |
[CLJS-395] nodejs target no longer works Created: 15/Oct/12 Updated: 23/Oct/12 Resolved: 23/Oct/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | James Long | Assignee: | Paul deGrandis |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
OS X |
||
| Attachments: |
|
| Description |
|
If you target nodejs by adding {:target :nodejs} to the options (and set main-cli-fn) , you get this error: https://gist.github.com/3892983 This appears to have been introduced with this commit: https://github.com/clojure/clojurescript/commit/d6f7d0b193de22378e06298fa543ca57d570c001 It spits out that error and nothing else. Any versions before that works fine. Related: |
| Comments |
| Comment by Tom Jack [ 17/Oct/12 12:50 AM ] |
|
A workaround that doesn't need a patch is to just require cljs.nodejs somewhere in your project. Here is a workaround patch :/ (work-around-cljs-395.patch, 16 Oct 2012). The patch just removes the dependency on cljs.nodejs from cljs.nodejscli. Since all it uses is (js* "process"), it didn't seem worth the work to figure out how to do the dependency resolution while ensuring nodejscli ends up at the bottom. |
| Comment by David Nolen [ 17/Oct/12 10:50 AM ] |
|
We'll have to ask Paul degGrandis (ohpauleez on IRC) about this one. |
| Comment by Paul deGrandis [ 17/Oct/12 1:09 PM ] |
|
I can't recreate this on master or on my personal branch (where I maintain my own set of patches and changes). Could someone link to a git repo that has code that can produce this for me? |
| Comment by James Long [ 17/Oct/12 1:50 PM ] |
|
That's surprising. Does Tom's comment help at all? This deterministically reproduces it for me. I forked the clojurescript repo today and added a test file: git clone git@github.com:jlongster/clojurescript.git && \
cd clojurescript && \
./script/bootstrap && \
./bin/cljsc hello.cljs '{:optimizations :advanced :target :nodejs}' > hello-output.js
|
| Comment by Paul deGrandis [ 17/Oct/12 1:54 PM ] |
|
James, I'll take a look at that and start tracing things through. I'll have this all patched up ASAP. I'm actually in the middle of working on two Node.js CLJS apps. I'd really like to see CLJS's system scripting story come alive |
| Comment by James Long [ 17/Oct/12 2:23 PM ] |
|
Awesome, thanks! I agree, I'd love to use CLJS to interact with node stuff. |
| Comment by Paul deGrandis [ 19/Oct/12 11:27 AM ] |
|
That still doesn't recreate it for me: http://www.pauldee.org/StillNoBug.png I'm running: ======= I get the same result with and without CLOJURESCRIPT_HOME set. |
| Comment by James Long [ 19/Oct/12 12:57 PM ] |
|
Wow, that is weird. I guess you can close this bug if nobody else can reproduce it. It'd be great if at least one other person could try on a different computer. Otherwise, maybe I have some weird environment var set that's messing up things. I'll come back to it at some point and see if I can dig into it more. Until then, feel free to close this bug. |
| Comment by Paul deGrandis [ 19/Oct/12 1:07 PM ] |
|
I'm going to leave it open and reduce it to minor. I want more environments to try it out - it definitely seems like something buried deep within |
| Comment by Tom Jack [ 19/Oct/12 6:20 PM ] |
|
I can't reproduce with hello.cljs either. But I get "No print-fn fn set for evaluation environment". Why don't you? I can, however, reproduce with mori: $ GIT_DIR=$CLOJURESCRIPT_HOME/.git git rev-parse HEAD e3ed0e7b69f9522e8759d0a6567afabb2a98d949 $ git clone https://github.com/swannodette/mori.git && cd mori ... $ $CLOJURESCRIPT_HOME/bin/cljsc src '{:optimizations :advanced :target :nodejs}' > mori.js Oct 19, 2012 4:18:13 PM com.google.javascript.jscomp.LoggerErrorManager println SEVERE: cljs.nodejscli:3: ERROR - required "cljs.nodejs" namespace never provided goog.require('cljs.nodejs'); ^ Oct 19, 2012 4:18:13 PM com.google.javascript.jscomp.LoggerErrorManager printSummary WARNING: 1 error(s), 0 warning(s) $ cat mori.js ERROR: JSC_MISSING_PROVIDE_ERROR. required "cljs.nodejs" namespace never provided at cljs.nodejscli line 3 : 0 #!/usr/bin/env node My workaround patch fixes it. EDIT: actually, my workaround patch was applied in CLOJURESCRIPT_HOME when I tried hello.cljs. Without the patch, I get the same error. |
| Comment by Paul deGrandis [ 19/Oct/12 6:32 PM ] |
|
Can you provide the environment this is happening in? EDIT: Seems like the commit cited above should always do that? |
| Comment by Tom Jack [ 19/Oct/12 6:38 PM ] |
|
cljs.nodejscli is being shoved into the end, but it is not analyzed for dependencies. So unless you require cljs.nodejs somewhere in your project, it is never pulled in. No clue why it works for you... My environment: |
| Comment by Paul deGrandis [ 19/Oct/12 6:52 PM ] |
|
Ahh I see the problem - I'll apply an appropriate patch. It needs to be added to the end, but before the add-dependencies call. |
| Comment by Tom Jack [ 19/Oct/12 7:03 PM ] |
|
But wasn't that what we had before, and the problem was that add-dependencies didn't necessarily keep nodejscli at the bottom? |
| Comment by David Nolen [ 20/Oct/12 9:34 AM ] |
|
Other people on the mailing list are experiencing this. |
| Comment by Paul deGrandis [ 20/Oct/12 11:12 AM ] |
|
Can someone experiencing the problem screen the patch I attached: cljs-395-nodetarget.diff The patch is to hand include the nodejs ns before the nodejscli namespace (essentially what add-dependencies would do). The reason for hand including at the end is to prevent the stomping of main-cli-fn - as was fixed in ===== Nvm - that won't work. On projects that DO require nodejs, you'll get a "required twice" error. SEVERE: cljs.nodejs:1: ERROR - namespace "cljs.nodejs" cannot be provided twice
goog.provide('cljs.nodejs');
New patch to try adding nodejs to the add-dependencies call and tacks on the nodejscli at the end, outside of the call to prevent main-cli-fn from getting stomped. I'll refactor the code - just want to see if this fixes the issue for people first. |
| Comment by Tom Jack [ 20/Oct/12 3:22 PM ] |
|
Looks like your patch makes mori build correctly, thanks. But since mori doesn't set main-cli-fn, it's still broken. But that seems like a separate issue. |
| Comment by Paul deGrandis [ 21/Oct/12 1:33 PM ] |
|
David, do you want me to clean up the code or does it look fine to you? Sort of sucks to see the double concat and double when - but I can't think of cleaner refactor that doesn't involve just breaking some of it into the let bindings |
| Comment by David Nolen [ 21/Oct/12 3:45 PM ] |
|
I'm mostly interested in something that works at this point. We can clean it up later if that's possible. Would like to get feedback from the original ticket creator as well. |
| Comment by James Long [ 23/Oct/12 8:55 AM ] |
|
The patch does indeed work. Sorry for being distant from this bug, I've been consumed with a project at work. I can't give feedback on the patch because I'm not familiar with the compiler. james:~/projects/clojurescript(master)% ./bin/cljsc hello.cljs '{:optimizations :advanced :target :nodejs}' > hello-output.js
Oct 23, 2012 9:48:59 AM com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: cljs.nodejscli:3: ERROR - required "cljs.nodejs" namespace never provided
goog.require('cljs.nodejs');
^
Oct 23, 2012 9:48:59 AM com.google.javascript.jscomp.LoggerErrorManager printSummary
WARNING: 1 error(s), 0 warning(s)
james:~/projects/clojurescript(master)% patch -p1 < ~/tmp/cljs-395-nodetarget-2.diff
patching file src/clj/cljs/closure.clj
patching file src/clj/cljs/closure.clj
james:~/projects/clojurescript(master)% ./bin/cljsc hello.cljs '{:optimizations :advanced :target :nodejs}' > hello-output.js
james:~/projects/clojurescript(master)% node hello-output.js
hello world
|
| Comment by David Nolen [ 23/Oct/12 10:42 AM ] |
|
Great, thanks James - Paul, could we get a patch that is a single commit? Thanks. |
| Comment by Paul deGrandis [ 23/Oct/12 10:43 AM ] |
|
np, I'll squash it down right now. |
| Comment by Paul deGrandis [ 23/Oct/12 10:51 AM ] |
|
Let me know how that looks. |
| Comment by David Nolen [ 23/Oct/12 6:31 PM ] |
|
Looks good! |
| Comment by David Nolen [ 23/Oct/12 6:33 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/e83204a9ad4002b1e33532189f826f20a22b9608 |
[CLJS-394] PersistentTreeSet lookup bug Created: 15/Oct/12 Updated: 15/Oct/12 Resolved: 15/Oct/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Erik Ouchterlony | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | bug, patch | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
The lookup function in PersistentTreeSet behaves differently in clojurescript than in clojure when a custom comparison function is used. If two elements are evaluated as equal, one of then is in the set and we do a lookup on the other, clojure returns the element in the set, whereas clojurescript returns the lookup element. (let [compare-quot-2 #(compare (quot %1 2) (quot %2 2)) Should return: 1 |
| Comments |
| Comment by David Nolen [ 15/Oct/12 10:02 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/409fcc9a824668207953b2bc47d40aaab85191d3 |
[CLJS-393] sebseq and sorted-set-by Created: 13/Oct/12 Updated: 18/Oct/12 Resolved: 18/Oct/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Erik Ouchterlony | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | bug | ||
| Attachments: |
|
| Description |
|
ClojureScript:cljs.user> (subseq (sorted-set-by <= 1 2 3 4 5) >= 2 <= 4) |
| Comments |
| Comment by Erik Ouchterlony [ 17/Oct/12 5:23 PM ] |
|
I've done some further analysis on this problem and found three different issues:
|
| Comment by David Nolen [ 17/Oct/12 9:25 PM ] |
|
So does the patch address both 1 & 3 or only 3? |
| Comment by Erik Ouchterlony [ 18/Oct/12 2:48 AM ] |
|
Only 3. |
| Comment by Erik Ouchterlony [ 18/Oct/12 6:04 AM ] |
|
Here is a patch for the third issue. |
| Comment by Erik Ouchterlony [ 18/Oct/12 4:21 PM ] |
|
I found a small bug in the last patch, so I attached a new one. This patch handles both the remaining issues. |
| Comment by David Nolen [ 18/Oct/12 5:44 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/e3ed0e7b69f9522e8759d0a6567afabb2a98d949 |
[CLJS-392] Documentation says CLJS can open connections to the REPL server from a "file://" source, and you can't Created: 09/Oct/12 Updated: 24/Oct/12 Resolved: 24/Oct/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Nahuel Greco | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | bug, docs, documentation | ||
| Environment: |
ClojureScript 0.0-1450 |
||
| Description |
|
At https://github.com/clojure/clojurescript/wiki/The-REPL-and-Evaluation-Environments there is the following paragraph: "This is a problem for the browser-connected REPL because FireFox and Chrome both view opening a file from the file system and connecting to localhost:9000 as different domains. From what I tested, you CANT connect to the REPL server at "http://localhost:9000/repl" if you initially loaded the page using the "file://" protocol. But you can if you loaded it from the same hostname on another port using "http://". The documentation is wrong, and also it needs to be clarified on what you really can change from the initial domain, like the port, without broking the REPL connection (or link to a CrossPageChannel documentation page with the details on what same-origin policy checks it can overcome). |
| Comments |
| Comment by David Nolen [ 23/Oct/12 7:00 PM ] |
|
Are you unable to edit the wiki? |
| Comment by Nahuel Greco [ 24/Oct/12 9:27 AM ] |
|
I didn't know the wiki had public write permissions. Also I don't know the exact CrossPageChannel limitations. |
| Comment by David Nolen [ 24/Oct/12 10:37 AM ] |
|
The limitation is that it won't work with file://. We now provide a simple webserver that will serve the files present in the directory where you started browser REPL. If you goto http://localhost:9000/ we will serve index.html if it is present. |
| Comment by Nahuel Greco [ 24/Oct/12 10:47 AM ] |
|
So CrossPageChannel overcomes the "same origin policy" for different ports, but not for different protocols. Thanks for the clarification. |
| Comment by David Nolen [ 24/Oct/12 2:48 PM ] |
|
No problem, closing this one. |
[CLJS-391] IndexedSeq, RSeq, ChunkedCons, and PersistentTreeMapSeq do not satisfy IEmptyableCollection Created: 08/Oct/12 Updated: 09/Oct/12 Resolved: 09/Oct/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Tom Jack | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Fixed |
| Description |
|
Attached patch (add-some-missing-IEmptyableCollection-impls.patch, 8 Oct 2012) fixes this. I checked that each of the corresponding types in Clojure is emptyable. |
| Comments |
| Comment by Tom Jack [ 08/Oct/12 4:02 PM ] |
|
Slight problem with the original patch — with-meta isn't defined when RSeq is defined, so it generated a warning. In this patch I use -with-meta instead for RSeq. |
| Comment by David Nolen [ 08/Oct/12 9:31 PM ] |
|
just declare with-meta. Thanks! |
| Comment by Tom Jack [ 08/Oct/12 9:41 PM ] |
|
Ah, of course. New patch does that. |
| Comment by David Nolen [ 09/Oct/12 5:49 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/b0a397f65c7e4faf1c6816d2b188c7b367029294 |
[CLJS-390] analyzer tries to descend on macro files Created: 08/Oct/12 Updated: 15/Oct/12 Resolved: 15/Oct/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Tom Jack | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
master (6da149d8) |
||
| Attachments: |
|
| Patch: | Fixed |
| Description |
|
Macro deps are added to the set of deps to be analyzed. Normally this would be harmless, since if a corresponding cljs file isn't found, analyze-deps just skips it. But consider the following case: (ns foo.bar (:require-macros [foo.bar :as b])) In this case the analyzer overflows the stack, recursively trying to analyze foo/bar.cljs over and over. The attached patch (exclude-macro-files-from-analysis.patch, 8 Oct 2012) seems to fix this. I am not sure whether it causes any new problems. |
| Comments |
| Comment by David Nolen [ 15/Oct/12 11:05 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/4defcbcf19112b9be6a4a27b5d8855552bf94948 |
[CLJS-389] Compiler emits throw string Created: 07/Oct/12 Updated: 15/Oct/12 Resolved: 15/Oct/12 |
|
| Status: | Resolved |
| 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 |
|
http://github.com/clojure/clojurescript/blob/master/src/clj/cljs/compiler.clj#L468 |
| Comments |
| Comment by David Nolen [ 15/Oct/12 9:59 PM ] |
|
fixed http://github.com/clojure/clojurescript/commit/ddcb192be4c34a548cf669625fd6d1a5bf81aa9f |
[CLJS-388] expose :output-wrapper compile option Created: 07/Oct/12 Updated: 15/Oct/12 Resolved: 15/Oct/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | David Nolen | Assignee: | David Nolen |
| Resolution: | Completed | Votes: | 2 |
| Labels: | None | ||
| Comments |
| Comment by Daniel Pittman [ 07/Oct/12 7:15 PM ] |
|
I went looking for exactly this feature two days ago, as part of investigating ClojureScript as part of the "component model" for our single page application. It uses the "Asynchronous Module Definition" pattern to isolate code, as defined here: https://github.com/amdjs/amdjs-api/wiki/AMD While it probably isn't the only headache, being able to easily produce an appropriate function definition around the ClojureScript code would make it much easier to get started here. |
| Comment by David Nolen [ 15/Oct/12 10:26 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/e83cf518ef4d3d6aa9a1cca18dc889efb0eae57f |
[CLJS-387] Add docstring from def and ns definitions to @namespaces metadata map, and make reflect functions make use of that Created: 07/Oct/12 Updated: 17/Oct/12 Resolved: 17/Oct/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Frank Siebenlist | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | docs, enhancement, patch,, reflection | ||
| Environment: |
clojure/clojurescript "0.0-1450" |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
The docstrings were parsed from the definitions-forms for def and ns, but not added to the @namespaces metadata map. |
| Comments |
| Comment by David Nolen [ 15/Oct/12 11:06 PM ] |
|
This patch no longer applies, mind updating it? |
| Comment by Frank Siebenlist [ 16/Oct/12 12:10 AM ] |
|
This patch should apply to master version on Mon, 15 Oct 2012 22:03:19 -0700 (4defcbcf19112b9be6a4a27b5d8855552bf94948) |
| Comment by David Nolen [ 17/Oct/12 10:57 AM ] |
|
Excellent, fixed http://github.com/clojure/clojurescript/commit/bef56a74f2eeecabfe0c0a28d89b455dce576ea3 Please at the ticket # to the commit message though, thanks! |
[CLJS-386] Remove TODO comments in clojure.browser.dom Created: 30/Sep/12 Updated: 22/Dec/12 Resolved: 22/Dec/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Trivial |
| Reporter: | Edward Tsech | Assignee: | Unassigned |
| Resolution: | Declined | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Remove line https://github.com/clojure/clojurescript/blob/master/src/cljs/clojure/browser/dom.cljs#L151 Because we can just use Google Closure class library directly: (def el (gdom/getElement "some-element")) ;; Add class |
| Comments |
| Comment by David Nolen [ 22/Dec/12 3:25 PM ] |
|
Not even important enough to be considered trivial |
[CLJS-385] ClojureScript's hashbang for Node.js output is not universal Created: 28/Sep/12 Updated: 09/Oct/12 Resolved: 09/Oct/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Paul deGrandis | Assignee: | Paul deGrandis |
| Resolution: | Completed | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Currently on `src/clj/cljs/closure.clj:859` - the shebang/hashbang for node-targeted compilation is `/usr/bin/nodejs`. This limits the potential reach. Instead we could rely upon `env` which is more universal. A patch is attached. |
| Comments |
| Comment by David Nolen [ 09/Oct/12 5:48 PM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/9ff4de297eba2c6af3f319f302c2c9382312e6fc |
[CLJS-384] Rhino and browser REPL namespaces both extend IJavaScriptEnv to IPersistentMap Created: 23/Sep/12 Updated: 28/Sep/12 Resolved: 28/Sep/12 |
|
| Status: | Resolved |