[CLJ-47] GC Issue 43: Dead code in generated bytecode Created: 17/Jun/09 Updated: 08/Oct/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
Reported by Levente.Santha, Jan 11, 2009 The bug was described in detail in this thread: http://groups.google.com/ group/clojure/browse_thread/thread/81ba15d7e9130441 For clojure.core$last__2954.invoke the correct bytecode would be (notice the removed "goto 65" after "41: goto 0"): public java.lang.Object invoke(java.lang.Object) throws java.lang.Exception; Code: 0: getstatic #22; //Field const__0:Lclojure/lang/Var; 3: invokevirtual #37; //Method clojure/lang/Var.get:()Ljava/lang/ Object; 6: checkcast #39; //class clojure/lang/IFn 9: aload_1 10: invokeinterface #41, 2; //InterfaceMethod clojure/lang/IFn.invoke: (Ljava/lang/Object;)Ljava/lang/Object; 15: dup 16: ifnull 44 19: getstatic #47; //Field java/lang/Boolean.FALSE:Ljava/lang/ Boolean; 22: if_acmpeq 45 25: getstatic #22; //Field const__0:Lclojure/lang/Var; 28: invokevirtual #37; //Method clojure/lang/Var.get:()Ljava/lang/ Object; 31: checkcast #39; //class clojure/lang/IFn 34: aload_1 35: invokeinterface #41, 2; //InterfaceMethod clojure/lang/IFn.invoke: (Ljava/lang/Object;)Ljava/lang/Object; 40: astore_1 41: goto 0 44: pop 45: getstatic #26; //Field const__1:Lclojure/lang/Var; 48: invokevirtual #37; //Method clojure/lang/Var.get:()Ljava/lang/ Object; 51: checkcast #39; //class clojure/lang/IFn 54: aload_1 55: aconst_null 56: astore_1 57: invokeinterface #41, 2; //InterfaceMethod clojure/lang/IFn.invoke: (Ljava/lang/Object;)Ljava/lang/Object; 62: areturn Our JIT reported incorrect stack size along the basic block introduced by the unneeded goto. The bug was present in SVN rev 1205. |
| Comments |
| Comment by Assembla Importer [ 08/Oct/10 10:21 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/47 |
| Comment by Assembla Importer [ 08/Oct/10 10:21 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Assembla Importer [ 08/Oct/10 10:21 AM ] |
|
aredington said: This appears to still be a problem with the generated bytecode in 1.3.0. Examining the bytecode for last, the problem has moved to invokeStatic: <pre> Line number 22 is an unreachable goto given the prior goto on line 19. |
[CLJ-113] GC Issue 109: RT.load's "don't load if already loaded" mechanism breaks ":reload-all" Created: 17/Jun/09 Updated: 09/Aug/11 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Stephen C. Gilardi |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by scgilardi, Apr 24, 2009 What (small set of) steps will reproduce the problem? "require" and "use" support a ":reload-all" flag that is intended to cause the specified libs to be reloaded along with all libs on which they directly or indirectly depend. This is implemented by temporarily binding a "loaded-libs" var to the empty set and then loading the specified libs. AOT compilation added another "already loaded" mechanism to clojure.lang.RT.load() which is currently not sensitive to a "reload- all" being in progress and breaks its operation in the following case: A, B, and C are libs A depends on B. (via :require in its ns form) B depends on C. (via :require in its ns form) B has been compiled (B.class is on classpath) At the repl I "require" A which loads A, B, and C (either from class files or clj files) I modify C.clj At the repl I "require" A with the :reload-all flag, intending to pick up the changes to C C is not reloaded because RT.load() skips loading B: B.class exists, is already loaded, and B.clj hasn't changed since it was compiled. What is the expected output? What do you see instead? I expect :reload-all to be effective. It isn't. What version are you using? svn 1354, 1.0.0RC1 Was this discussed on the group? If so, please provide a link to the discussion: http://groups.google.com/group/clojure/browse_frm/thread/9bbc290321fd895f/e6a967250021462a#e6a967250021462a Please provide any additional information below. I'll upload a patch soon that creates a "*reload-all*" var with a root binding of nil and code to bind it to true when the current thread has a :reload-all call pending. When *reload-all* is true, RT.load() will (re)load all libs from their ".clj" files even if they're already loaded. The fix for this may need to be coordinated with a fix for issue #3. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/113 |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
richhickey said: Updating tickets (#8, #42, #113, #2, #20, #94, #96, #104, #119, #124, #127, #149, #162) |
| Comment by Kevin Downey [ 08/Aug/11 7:40 PM ] |
|
seems like the code that is emitted in the static init for namespace classes could be emitted into a init_ns() static method and the static init could call init_ns(). then RT.load could call init_ns() to get the behavior of reloading an AOT compiled namespace. |
| Comment by Kevin Downey [ 09/Aug/11 8:31 PM ] |
|
looking at the compiler it looks like most of what I mentioned above is already implemented, just need RT to reflectively call load() on the namespace class in the right place |
[CLJ-127] DynamicClassLoader's call to ClassLoader.getSystemClassLoader is prohibited in some environments Created: 18/Jun/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Currently, clojure.lang.DynamicClassLoader's constructor has the super(EMPTY_URLS, (Thread.currentThread().getContextClassLoader() == null || Thread.currentThread().getContextClassLoader() == ClassLoader.getSystemClassLoader()) ? Compiler.class.getClassLoader() : Thread.currentThread().getContextClassLoader()); That call to ClassLoader.getSystemClassLoader() is forbidden by Google |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/127 |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
jmcconnell said: I'd be happy to take this up with the GAE folks if it winds up looking like this is something they should probably allow or if we need any further information from them on their policies. |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
richhickey said: Updating tickets (#127, #128, #129, #130) |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
mikehinchey said: GAE made some changes a few weeks ago, maybe changed this because I'm able to load from .clj files now (not the servlet, of course, which must be gen-class). |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
richhickey said: Updating tickets (#8, #42, #113, #2, #20, #94, #96, #104, #119, #124, #127, #149, #162) |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
mattrevelle said: J. McConnell, was this issue resolved by a change in GAE policy? |
[CLJ-270] defn-created fns inherit old metadata from the Var they are assigned to Created: 13/Feb/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Rich Hickey |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
user> (def #^{:foo "bar"} x 5)
I expect (meta #'x) to evaluate to the value of the final (meta x) in the above.
Current master (commit 61202d2ff6925002400a9843e8fbd080f3bef3a5).
Prompted by discussion at
I think this is due to DefExpr's eval method binding the Var to init.eval() first and attaching the supplied metadata to the Var later – see Compiler.java lines 341-352. (Note the Var is always already in place when init.eval() is called, regardless of whether it existed prior to the evaluation of the def / defn.) Thus the init expression supplied by defn sees the old (and wrong) metadata on the Var. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/270 |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
stu said: [file:dwK4yssayr37y_eJe5d-aX] |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
stu said: The problem happens with defn, but not with def+fn, so I think the original diagnosis is incorrect. Another stab at diagnosis: The defn macro copies metadata from a var onto its new value, so if you defn a var that already exists, the old var metadata becomes metadata on the new value. I don't know why this would be the right thing to do, and if you eliminate this behavior (see patch) all the Clojure and Contrib tests still pass. If this is correct, please assign back to me and I will write tests. If this is wrong, please tell me what's going on here so I know how to write the tests. |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
cgrand said: Child association with ticket #363 was added |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
cgrand said: I think the original diagnosis is correct. Note that the behavior differ when def iscompiled: user=> (def #^{:foo "bar"} x 5) See also http://groups.google.com/group/clojure/browse_thread/thread/6afd81896ca368b2# |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
cgrand said: [file:arrhbiAI4r35lQeJe5cbLr] |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
cgrand said: My patch aligns DefExpr.eval with DefExpr.emit (first set meta then eval the init value). |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
cgrand said: Forget it, my current patch is broken. |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
cgrand said: My current patch is broken because of #352, what is the rational for #352? |
[CLJ-252] Support typed non-primitive fields in deftype Created: 29/Jan/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Right now hints are accepted but not used as field type. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:07 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/252 |
[CLJ-326] add :as-of option to refer Created: 30/Apr/10 Updated: 24/Aug/10 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Christophe Grand |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Test |
| Description |
|
Discussed here: http://groups.google.com/group/clojure-dev/msg/74af612909dcbe56 :as-of allows library authors to specify a known subset of vars to refer from clojure (or any other library which would use :added metadata). (ns foo (:refer-clojure :as-of "1.1")) is equivalent to (ns foo (:refer-clojure :only [public-documented-vars-which-already-existed-in-1.1])) |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 10:19 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/326 |
| Comment by Assembla Importer [ 24/Aug/10 10:19 AM ] |
|
cgrand said: [file:a8SumUvcOr37SmeJe5cbLA]: requires application of #325 |
| Comment by Assembla Importer [ 24/Aug/10 10:19 AM ] |
|
richhickey said: Do we still need this? |
[CLJ-163] Enhance = and == docs Created: 30/Jul/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Laurent Petit |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
Enhance = and == docs as far as numbers handling is concerned (make them self referenced, make clear what == offers beyond = -except that it will only work for numbers) |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 1:04 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/163 |
| Comment by Assembla Importer [ 24/Aug/10 1:04 PM ] |
|
laurentpetit said: [file:bH0XMCFjur3PLMeJe5aVNr] |
| Comment by Assembla Importer [ 24/Aug/10 1:04 PM ] |
|
richhickey said: I don't want to recommend, in = doc, that people should prefer == for any case. People should always prefer =. If there is a perf, difference we can make that go away. Then the only difference with == is that it will fail on non-numbers, and that should be the only reason to choose it. |
| Comment by Assembla Importer [ 24/Aug/10 1:04 PM ] |
|
richhickey said: Updating tickets (#94, #96, #104, #119, #163) |
| Comment by Assembla Importer [ 24/Aug/10 1:04 PM ] |
|
laurentpetit said: Richn, by "will fail on non-numbers", do you mean "should throw an exception" (and thus the patch must change the code), or just as it works today : (== :a :a) ? |
| Comment by Assembla Importer [ 24/Aug/10 1:04 PM ] |
|
richhickey said: I've fixed the code so == on non-numbers throws |
[CLJ-42] GC Issue 38: When using AOT compilation, "load"ed files are not reloaded on (require :reload 'name.space) Created: 17/Jun/09 Updated: 24/Aug/10 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Stephen C. Gilardi |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by m...@kotka.de, Jan 07, 2009 What (small set of) steps will reproduce the problem? 1. Create a file src/foo.clj cat >src/foo.clj <<EOF (ns foo (:load "bar")) EOF 2. Create a file src/bar.clj cat >src/bar.clj <<EOF (clojure.core/in-ns 'foo) (def x 8) EOF 3. Start Clojure Repl: java -cp src:classes clojure.main -r 4. Compile the namespace. user=> (compile 'foo) foo 5. Require the namespace user=> (require :reload-all :verbose 'foo) (clojure.core/load "/foo") (clojure.core/load "/bar") What is the expected output? What do you see instead? 6. Re-Require the namespace user=> (require :reload-all :verbose 'foo) (clojure.core/load "/foo") Only the "master" file is loaded, but not the bar file. Expected would have been to also load the bar file. Changes to bar.clj are not reflected, and depending on the setting (eg. using multimethods in foo from a different namespace) code may be corrupted. What version are you using? SVN rev. 1195 |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:44 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/42 |
| Comment by Assembla Importer [ 24/Aug/10 6:44 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Assembla Importer [ 24/Aug/10 6:44 AM ] |
|
richhickey said: Updating tickets (#42, #71) |
| Comment by Assembla Importer [ 24/Aug/10 6:44 AM ] |
|
richhickey said: Updating tickets (#8, #42, #113, #2, #20, #94, #96, #104, #119, #124, #127, #149, #162) |
[CLJ-259] clojure.lang.Reflector.invokeMatchingMethod is not complete (rejects pontentially valid method invocations) Created: 03/Feb/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Description |
|
There exists invoke expressions on instances, where Java is able to perform the call, yet clojure is not reflectively. This restricts the possible search space. I suggest that if target is not null (e.g. is not a static method), the target.getClass() should be used instead as a root for getAsMethodOfPublicBase. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:12 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/259 |
| Comment by Assembla Importer [ 24/Aug/10 3:12 PM ] |
|
richhickey said: How about some sample case that demonstrates the problem? |
| Comment by Assembla Importer [ 24/Aug/10 3:12 PM ] |
|
hiredman said: Related association with ticket #126 was added |
[CLJ-666] Add support for Big* numeric types to Reflector Created: 29/Oct/10 Updated: 15/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
This should work as expected, for example: (Integer. 1N) Probably for BigInt, BigInteger, and BigDecimal. Method to look at is c.l.Reflector.paramArgTypeMatch, per Rich in irc. |
| Comments |
| Comment by Colin Jones [ 30/Mar/11 11:52 PM ] |
|
Questions posed on the clojure-dev list around how this impacts bit-shift-left: http://groups.google.com/group/clojure-dev/browse_thread/thread/2191cbf0048d8ca6 |
| Comment by Alexander Taggart [ 31/Mar/11 12:42 AM ] |
|
Patch on CLJ-445 fixes this as well. |
| Comment by Colin Jones [ 27/Apr/11 4:41 PM ] |
|
This patch fails a test around bit-shifting a BigInt: `(bit-shift-left 1N 10000)`. The reason is that the patch changes the dispatch of (BigInt, Long) from (Object, Object) to (long, int). Clearly this can't be applied (unless another change makes it possible), but I'm putting it up as a start of the conversation. |
| Comment by Alexander Taggart [ 27/Apr/11 5:26 PM ] |
|
My comment from the mailing list: If the test breaks it likely means Numbers.shiftLeft(long,int) was The suggestion of "simply" modifying paramArgTypeMatch is not sufficient since the mechanism for preferring one method over another lives in Compiler, and isn't smart enough to make these sorts of decisions. |
| Comment by Christopher Redinger [ 28/Apr/11 9:21 AM ] |
|
Considering moving this out of Release.next - soliciting comments from Chas. |
| Comment by Chas Emerick [ 28/Apr/11 9:41 AM ] |
|
I'm afraid I don't have any particular insight into the issues involved at this point. I ran into the problem originally noted a while back, and opened the ticket at Rich's suggestion. I'm sorry if the text of the ticket led anyone down unfruitful paths… |
| Comment by Luke VanderHart [ 29/Apr/11 10:01 AM ] |
|
The issues relating to bitshift are moot since the decision was made that bit-shifts are only for 32/64 bit values. Still a valid issue, but de-prioritized as per Rich. |
| Comment by Alex Ott [ 25/Jun/12 7:19 AM ] |
|
Modified version of original patch |
| Comment by Andy Fingerhut [ 26/Jun/12 1:38 PM ] |
|
Alex, would you mind attaching it with a unique file name? I know that JIRA lets us create multiple attachments with the same file name, and I know we can tell them apart by date and the account of the person who uploaded the attachment, but giving them the same name only seems to invite confusion. |
| Comment by Alex Ott [ 28/Jun/12 1:00 PM ] |
|
Renamed updated patch to unique name |
[CLJ-415] smarter assert (prints locals) Created: 29/Jul/10 Updated: 18/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Approval: | Incomplete |
| Waiting On: | Rich Hickey |
| Description |
|
Here is an implementation you can paste into a repl. Feedback wanted: (defn ^{:private true} local-bindings
"Produces a map of the names of local bindings to their values."
[env]
(let [symbols (map key env)]
(zipmap (map (fn [sym] `(quote ~sym)) symbols) symbols)))
(defmacro assert
"Evaluates expr and throws an exception if it does not evaluate to
logical true."
{:added "1.0"}
[x]
(when *assert*
(let [bindings (local-bindings &env)]
`(when-not ~x
(let [sep# (System/getProperty "line.separator")]
(throw (AssertionError. (apply str "Assert failed: " (pr-str '~x) sep#
(map (fn [[k# v#]] (str "\t" k# " : " v# sep#)) ~bindings)))))))))
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 5:41 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/415 |
| Comment by Assembla Importer [ 24/Aug/10 5:41 PM ] |
|
alexdmiller said: A simple example I tried for illustration: user=> (let [a 1 b 2] (assert (= a b)))
#<CompilerException java.lang.AssertionError: Assert failed: (= a b)
a : 1
b : 2
|
| Comment by Assembla Importer [ 24/Aug/10 5:41 PM ] |
|
fogus said: Of course it's weird if you do something like: (let [x 1 y 2 z 3 a 1 b 2 c 3] (assert (= x y))) java.lang.AssertionError: Assert failed: (= x y) x : 1 y : 2 z : 3 a : 1 b : 2 c : 3 (NO_SOURCE_FILE:0) </code></pre> So maybe it could be slightly changed to: <pre><code>(defmacro assert "Evaluates expr and throws an exception if it does not evaluate to logical true." {:added "1.0"} [x] (when *assert* (let [bindings (local-bindings &env)] `(when-not ~x (let [sep# (System/getProperty "line.separator") form# '~x] (throw (AssertionError. (apply str "Assert failed: " (pr-str form#) sep# (map (fn [[k# v#]] (when (some #{k#} form#) (str "\t" k# " : " v# sep#))) ~bindings))))))))) </code></pre> So that. now it's just: <pre><code>(let [x 1 y 2 z 3 a 1 b 2 c 3] (assert (= x y))) java.lang.AssertionError: Assert failed: (= x y) x : 1 y : 2 (NO_SOURCE_FILE:0) :f |
| Comment by Assembla Importer [ 24/Aug/10 5:41 PM ] |
|
fogus said: Hmmm, but that fails entirely for: (let [x 1 y 2 z 3 a 1 b 2 c 3] (assert (= [x y] [a c]))). So maybe it's better just to print all of the locals unless you really want to get complicated. |
| Comment by Assembla Importer [ 24/Aug/10 5:41 PM ] |
|
jawolfe said: See also some comments in: Plus one more suggestion to add to the mix: in addition to / instead of printing the locals, how about saving them somewhere. For example, the var assert-bindings could be bound to the map of locals. This way you don't run afoul of infinite/very large sequences, and allow the user to do more detailed interrogation of the bad values (especially useful when some of the locals print opaquely). |
| Comment by Assembla Importer [ 24/Aug/10 5:41 PM ] |
|
stuart.sierra said: Another approach, which I wil willingly donate: |
| Comment by Jeff Weiss [ 15/Dec/10 1:33 PM ] |
|
There's one more tweak to fogus's last comment, which I'm actually using. You need to flatten the quoted form before you can use 'some' to check whether the local was used in the form: (defmacro assert "Evaluates expr and throws an exception if it does not evaluate to logical true." {:added "1.0"} [x] (when *assert* (let [bindings (local-bindings &env)] `(when-not ~x (let [sep# (System/getProperty "line.separator") form# '~x] (throw (AssertionError. (apply str "Assert failed: " (pr-str form#) sep# (map (fn [[k# v#]] (when (some #{k#} (flatten form#)) (str "\t" k# " : " v# sep#))) ~bindings))))))))) |
| Comment by Stuart Halloway [ 04/Jan/11 8:31 PM ] |
|
I am holding off on this until we have more solidity around http://dev.clojure.org/display/design/Error+Handling. (Considering, for instance, having all exceptions thrown from Clojure provide access to locals.) When my pipe dream fades I will come back and screen this before the next release. |
| Comment by Stuart Halloway [ 28/Jan/11 1:14 PM ] |
|
Why try to guess what someone wants to do with the locals (or any other context, for that matter) when you can specify a callback (see below). This would have been useful last week when I had an assertion that failed only on the CI box, where no debugger is available. Rich, at the risk of beating a dead horse, I still think this is a good idea. Debuggers are not always available, and this is an example of where a Lisp is intrinsically capable of providing better information than can be had in other environments. If you want a patch for the code below please mark waiting on me, otherwise please decline this ticket so I stop looking at it. (def ^:dynamic *assert-handler* nil) (defn ^{:private true} local-bindings "Produces a map of the names of local bindings to their values." [env] (let [symbols (map key env)] (zipmap (map (fn [sym] `(quote ~sym)) symbols) symbols))) (defmacro assert [x] (when *assert* (let [bindings (local-bindings &env)] `(when-not ~x (let [sep# (System/getProperty "line.separator") form# '~x] (if *assert-handler* (*assert-handler* form# ~bindings) (throw (AssertionError. (apply str "Assert failed: " (pr-str form#) sep# (map (fn [[k# v#]] (when (some #{k#} (flatten form#)) (str "\t" k# " : " v# sep#))) ~bindings)))))))))) |
| Comment by Jeff Weiss [ 27/May/11 8:16 AM ] |
|
A slight improvement I made in my own version of this code: flatten does not affect set literals. So if you do (assert (some #{x} [a b c d])) the value of x will not be printed. Here's a modified flatten that does the job: (defn symbols [sexp] "Returns just the symbols from the expression, including those inside literals (sets, maps, lists, vectors)." (distinct (filter symbol? (tree-seq coll? seq sexp)))) |
| Comment by Andy Fingerhut [ 18/Nov/12 1:06 AM ] |
|
Attaching git format patch clj-415-assert-prints-locals-v1.txt of Stuart Halloway's version of this idea. I'm not advocating it over the other variations, just getting a file attached to the JIRA ticket. |
[CLJ-457] lazy recursive definition giving incorrect results Created: 13/Oct/10 Updated: 03/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | Priority: | Major |
| Reporter: | Assembla Importer | Assignee: | Christophe Grand |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
If you define a global data var in terms of a lazy sequence referring to that same var, you can get different results depending on the chunkiness of laziness of the functions being used to build the collection. Clojure's lazy sequences don't promise to support this, but they shouldn't return wrong answers. In the example given in http://groups.google.com/group/clojure/browse_thread/thread/1c342fad8461602d (and repeated below), Clojure should not return bad data. An error message would be good, and even an infinite loop would be more reasonable than the current behavior. (Similar issue reported here: https://groups.google.com/d/topic/clojure/yD941fIxhyE/discussion) (def nums (drop 2 (range)))
(def primes (cons (first nums)
(lazy-seq (->>
(rest nums)
(remove
(fn [x]
(let [dividors (take-while #(<= (* % %) x)
primes)]
(println (str "primes = " primes))
(some #(= 0 (rem x %)) dividors))))))))
(take 5 primes)
It prints out:
(primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
2 3 5 7 9)
|
| Comments |
| Comment by Assembla Importer [ 13/Oct/10 3:00 PM ] | ||||||||||||||||||||||||||||||||||||
|
Converted from http://www.assembla.com/spaces/clojure/tickets/457 | ||||||||||||||||||||||||||||||||||||
| Comment by Aaron Bedra [ 10/Dec/10 9:08 AM ] | ||||||||||||||||||||||||||||||||||||
|
Stu and Rich talked about making this an error, but it would break some existing code to do so. | ||||||||||||||||||||||||||||||||||||
| Comment by Rich Hickey [ 17/Dec/10 8:03 AM ] | ||||||||||||||||||||||||||||||||||||
|
Is there a specific question on this? | ||||||||||||||||||||||||||||||||||||
| Comment by Aaron Bedra [ 05/Jan/11 9:05 PM ] | ||||||||||||||||||||||||||||||||||||
|
Stu, you and I went over this but I can't remember exactly what the question was here. | ||||||||||||||||||||||||||||||||||||
| Comment by Christophe Grand [ 28/Nov/12 12:24 PM ] | ||||||||||||||||||||||||||||||||||||
|
Tentative patch attached. | ||||||||||||||||||||||||||||||||||||
| Comment by Rich Hickey [ 30/Nov/12 9:43 AM ] | ||||||||||||||||||||||||||||||||||||
|
The patch intends to do what? We have only a problem description and code. Please enumerate the plan rather than make us decipher the patch. As a first principle, I don't want Clojure to promise that such recursively defined values are possible. | ||||||||||||||||||||||||||||||||||||
| Comment by Christophe Grand [ 30/Nov/12 10:23 AM ] | ||||||||||||||||||||||||||||||||||||
|
The proposal here is to catch recursive seq realization (ie when computing the body of a lazy-seq attempts to access the same seq) and throw an exception. Currently when such a case happens, the recursive access to the seq returns nil. This results in incorrect code seemingly working but producing incorrect results or even incorrect code producing correct results out of luck (see https://groups.google.com/d/topic/clojure/yD941fIxhyE/discussion for such an example). So this patch moves around the modification to the LazySeq state (f, sv and s fields) before all potentially recursive method call (.sval in the while of .seq and .invoke in .sval) so that, upon reentrance, the state of the LazySeq is coherent and able to convey the fact the seq is already being computed. Currently a recursive call may find f and sv cleared and concludes the computation is done and the result is in s despite s being unaffected yet. Currently:
Note that "Being realized" states overlap with Unrealized or Realized. With the patch:
| ||||||||||||||||||||||||||||||||||||
| Comment by Andy Fingerhut [ 30/Nov/12 2:06 PM ] | ||||||||||||||||||||||||||||||||||||
|
That last comment, Christophe, goes a long way to explaining the idea to me, at least. Any chance comments with similar content could be added as part of the patch? | ||||||||||||||||||||||||||||||||||||
| Comment by Christophe Grand [ 03/Dec/12 11:18 AM ] | ||||||||||||||||||||||||||||||||||||
|
New patch with a comment explaining the expected states. // Before calling user code (f.invoke() in sval and, indirectly, // ((LazySeq)ls).sval() in seq -- and even RT.seq() in seq), ensure that // the LazySeq state is in one of these states: // // State f sv // ================================ // Unrealized not null null // Realized null null // Being realized null this CLJ-1119 is also fixed by this patch. |
[CLJ-2] Scopes Created: 15/Jun/09 Updated: 08/Mar/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Assembla Importer | Assignee: | Rich Hickey |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Add the scope system for dealing with resource lifetime management |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 11:43 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/2 |
| Comment by Assembla Importer [ 24/Aug/10 11:43 AM ] |
|
richhickey said: Updating tickets (#8, #42, #113, #2, #20, #94, #96, #104, #119, #124, #127, #149, #162) |
| Comment by Stuart Halloway [ 12/Jul/11 8:26 AM ] |
|
Patch demonstrates idea, not ready for prime time. |
| Comment by Tassilo Horn [ 23/Dec/11 7:37 AM ] |
|
I think the decision of having to specify either a Closeable resource or a close function for an existing non-Closeable resource in with-open is quite awkward, because they have completely different meaning. (let [foo (open-my-custom-resource "foo.bar")]
(with-open [r (reader "foo.txt")
foo #(.terminate foo)]
(do-stuff r foo)))
I think a CloseableResource protocol that can be extended to custom types as implemented in the patch to CLJ-308 is somewhat easier to use. Extend it once, and then you can use open-my-custom-resource in with-open just like reader/writer and friends... That said, Scopes can still be useful, but I'd vote for handling the "how should that resource be closed" question by a protocol. Then the with-open helper can simply add (swap! *scope* conj (fn [] (clojure.core.protocols/close ~(bindings 0)))) and cleanup-scope only needs to apply each fn without having to distinguish Closeables from fns. |
[CLJ-366] Multiplatform command-line clojure launcher Created: 28/May/10 Updated: 10/Dec/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Clojure needs a lower barrier of entry, long java commands scare people away! We need a script that conveniently launches a clojure repl or executes clojure files, much like the ruby/python/perl/other-favorite-interpreted-language behavior. NOTES: From Russ Olson (regarding Dejure/Dejour):
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 8:21 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/366 |
| Comment by Assembla Importer [ 24/Aug/10 8:21 AM ] |
|
stu said: Updating tickets (#370, #366, #374) |
| Comment by Aaron Bedra [ 10/Dec/10 10:13 AM ] |
|
Design page is at http://dev.clojure.org/display/design/CLJ+Launcher and should be the basis for all future discussion |
[CLJ-700] contains? broken for TransientMaps Created: 01/Jan/11 Updated: 28/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | Priority: | Major |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
(contains? (transient {:x "fine"}) :x)
also (contains? (transient (hash-map :x "fine")) :x)
|
| Comments |
| Comment by Herwig Hochleitner [ 01/Jan/11 8:01 PM ] |
|
the same is also true for TransientVectors {{(contains? (transient [1 2 3]) 0)}}
|
| Comment by Herwig Hochleitner [ 01/Jan/11 8:25 PM ] |
|
As expected, TransientSets have the same issue; plus an additional, probably related one. (:x (transient #{:x}))
(get (transient #{:x}) :x)
|
| Comment by Alexander Redington [ 07/Jan/11 2:07 PM ] |
|
This is caused by expectations in clojure.lang.RT regarding the type of collections for some methods, e.g. contains() and getFrom(). Checking for contains looks to see if the instance passed in is Associative (a subinterface of PersistentCollection), or IPersistentSet. This patch refactors several of the Clojure interfaces so that logic abstract from the issue of immutability is pulled out to a general interface (e.g. ISet, IAssociative), but preserves the contract specified (e.g. Associatives only return Associatives when calling assoc()). With more general interfaces in place the contains() and getFrom() methods were then altered to conditionally use the general interfaces which are agnostic of persistence vs. transience. Includes tests in transients.clj to verify the changes fix this problem. |
| Comment by Stuart Halloway [ 28/Jan/11 10:35 AM ] |
|
Rich: Patch doesn't currently apply, but I would like to get your take on approach here. In particular:
|
| Comment by Alexander Redington [ 25/Mar/11 7:44 AM ] |
|
Rebased the patch off the latest pull of master as of 3/25/2011, it should apply cleanly now. |
| Comment by Stuart Sierra [ 17/Feb/12 2:59 PM ] |
|
Latest patch does not apply as of f5bcf647 |
| Comment by Andy Fingerhut [ 17/Feb/12 5:59 PM ] |
|
clj-700-patch2.txt does patch cleanly to latest Clojure head as of a few mins ago. No changes to patch except in context around changed lines. |
| Comment by Andy Fingerhut [ 07/Mar/12 3:23 AM ] |
|
Sigh. Git patches applied via 'git am' are fragile beasts indeed. Look at them the wrong way and they fail to apply. clj-700-patch3.txt applies cleanly to latest master as of Mar 7, 2012, but not if you use this command: git am -s < clj-700-patch3.txt I am pretty sure this is because of DOS CR/LF line endings in the file src/jvm/clojure/lang/Associative.java. The patch does apply cleanly if you use this command: git am --keep-cr -s < clj-700-patch3.txt |
| Comment by Andy Fingerhut [ 23/Mar/12 6:34 PM ] |
|
This ticket was changed to Incomplete and waiting on Rich when Stuart Halloway asked for feedback on the approach on 28/Jan/2011. Stuart Sierra changed it to not waiting on Rich on 17/Feb/2012 when he noted the patch didn't apply cleanly. Latest patch clj-700-patch3.txt does apply cleanly, but doesn't change the approach used since the time Stuart Halloway's concern was raised. Should it be marked as waiting on Rich again? Something else? |
| Comment by Stuart Halloway [ 08/Jun/12 12:44 PM ] |
|
Patch 4 incorporates patch 3, and brings it up to date on hashing (i.e. uses hasheq). |
| Comment by Andy Fingerhut [ 08/Jun/12 12:52 PM ] |
|
Removed clj-700-patch3.txt in favor of Stuart Halloway's improved clj-700-patch4.txt dated June 8, 2012. |
| Comment by Andy Fingerhut [ 18/Jun/12 3:06 PM ] |
|
clj-700-patch5.txt dated June 18, 2012 is the same as Stuart Halloway's clj-700-patch4.txt, except for context lines that have changed in Clojure master since Stuart's patch was created. clj-700-patch4.txt no longer applies cleanly. |
| Comment by Andy Fingerhut [ 19/Aug/12 4:47 AM ] |
|
Adding clj-700-patch6.txt, which is identical to Stuart Halloway's clj-700-patch4.txt, except that it applies cleanly to latest master as of Aug 19, 2012. Note that as described above, you must use the --keep-cr option to 'git am' when applying this patch for it to succeed. Removing clj-700-patch5.txt, since it no longer applies cleanly. |
| Comment by Stuart Sierra [ 24/Aug/12 1:08 PM ] |
|
Patch fails as of commit 1c8eb16a14ce5daefef1df68d2f6b1f143003140 |
| Comment by Andy Fingerhut [ 24/Aug/12 1:53 PM ] |
|
Which patch did you try, and what command did you use? I tried applying clj-700-patch6.txt to the same commit, using the following command, and it applied, albeit with the warning messages shown: % git am --keep-cr -s < clj-700-patch6.txt Note the --keep-cr option, which is necessary for this patch to succeed. It is recommended in the "Screening Tickets" section of the JIRA workflow wiki page here: http://dev.clojure.org/display/design/JIRA+workflow |
| Comment by Andy Fingerhut [ 28/Aug/12 5:48 PM ] |
|
Presumptuously changing Approval from Incomplete back to None, since the latest patch does apply cleanly if the --keep-cr option is used. It was in Screened state recently, but I'm not so presumptuous as to change it to Screened |
[CLJ-84] GC Issue 81: compile gen-class fail when class returns self Created: 17/Jun/09 Updated: 10/Dec/10 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Rich Hickey |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Incomplete |
| Waiting On: | Chouser |
| Description |
Reported by davidhaub, Feb 14, 2009 When attempting to compile the following program, clojure fails with a ClassNotFoundException. It occurs because one of the methods returns the same class that is being generated. If the returnMe method below is changed to return an Object, the compile succeeds. Beware when testing! If the classpath contains a class file (say from a prior successful build when the returnMe method was changed to return an object), the compile will succeed. Always clear out the clojure.compile.path prior to compiling. ;badgenclass.clj (ns badgenclass (:gen-class :state state :methods [[returnMe [] badgenclass]] :init init)) (defn -init [] [[] nil]) (defn -returnMe [this] this) #!/bin/sh rm -rf classes mkdir classes java -cp lib/clojure.jar:classes:. -Dclojure.compile.path=classes \ clojure.lang.Compile badgenclass Comment 1 by chouser, Mar 07, 2009 Attached is a patch that accepts strings or symbols for parameter and return class names, and generates the appropriate bytecode without calling Class/forName. It fixes this issue, but because 'ns' doesn't resolve :gen-class's arguments, class names aren't checked as early anymore. :gen-class-created classes with invalid parameter or return types can even be instantiated, and no error will be reported until the broken method is called. One possible alternative would be to call Class/forName on any symbols given, but allow strings to use the method given by this patch. To return your own type, you'd need a method defined like: [returnMe [] "badgenclass"] Any thoughts? |
| Comments |
| Comment by Assembla Importer [ 28/Sep/10 5:09 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/84 |
| Comment by Assembla Importer [ 28/Sep/10 5:09 PM ] |
|
oranenj said: [file:cWS6Aww30r3RbzeJe5afGb]: on comment 1 |
| Comment by Assembla Importer [ 28/Sep/10 5:09 PM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Stuart Halloway [ 30/Oct/10 11:58 AM ] |
|
The approach take in the initial patch (delaying resolution of symbols into classes) is fine: gen-class makes no promise about when this happens, and the dynamic approach feels more consistent with Clojure. I think the proposed (but not implemented) use of string/symbol to control when class names are resolved is a bad idea: magical and not implied by the types. Needed:
|
| Comment by Chouser [ 30/Oct/10 9:29 PM ] |
|
Wow, 18-month-old patch, back to haunt me for Halloway'een So what does it mean that the assignee is Rich, but it's waiting on me? |
| Comment by Stuart Halloway [ 01/Nov/10 9:17 AM ] |
|
I am using Approval = Incomplete plus Waiting On = Someone to let submitters know that there is feedback waiting, and that they can move the ticket forward by acting on it. The distinction is opportunity to contribute (something has been provided to let you move forward) vs. expectation of contribution. |
[CLJ-69] GC Issue 66: Add "keyset" to Clojure; make .keySet for APersistentMap return IPersistentSet Created: 17/Jun/09 Updated: 10/Dec/10 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Incomplete |
| Description |
Reported by wolfe.a.jason, Feb 04, 2009 Describe the feature/change. Add "keyset" to Clojure; make .keySet for APersistentMap return an IPersistentSet Was this discussed on the group? If so, please provide a link to the discussion: http://groups.google.com/group/clojure/browse_thread/thread/66e708e477ae992f/ff3d8d588068b60e?hl=en#ff3d8d588068b60e ----------------------------------------------------- A patch is attached. Some notes: I chose to add a "keyset" function, rather than change the existing "keys", so as to avoid breaking anything. The corresponding RT.keyset function just calls .keySet on the argument. I would have liked to have "keyset" return an IPersistentSet even when passed a (non-Clojure) java.util.Map, but this seems impossible to do in sublinear time because of essentially the same limitation mentioned in the above thread (the Map interface does not support getKey() or entryAt()) -- assuming, again, that "get" is supposed to return the actual (identical?) key in a set, and not just an .equal key. I then changed the implementation of .keySet for APersistentMap to essentially copy APersistentSet. A more concise alternative would have been to extend APersistentSet and override the .get method, but that made me a bit nervous (since if APeristentSet changed this could break). Anyway, this is my first patch for the Java side of Clojure, and I'm not yet solid on the conventions and aesthetics, so comments/questions/criticisms/requests for revisions are very welcome. |
| Comments |
| Comment by Assembla Importer [ 28/Sep/10 7:00 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/69 |
| Comment by Assembla Importer [ 28/Sep/10 7:00 AM ] |
|
oranenj said: [file:dKgE6mw3Gr3O2PeJe5afGb] |
| Comment by Assembla Importer [ 28/Sep/10 7:00 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Stuart Halloway [ 03/Dec/10 1:12 PM ] |
|
patch not in correct format |
[CLJ-211] Support arbitrary functional destructuring via -> and ->> Created: 17/Nov/09 Updated: 10/Dec/10 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Incomplete |
| Description |
|
Support arbitrary functional destructuring, that is the use of The discussion began here: The attached patch implements the spec described here: That is, the following examples would now work: user=> (let [(-> str a) 1] a) user=> (let [[a (-> str b) c] [1 2]] (list a b c)) user=> (let [(->> (map int) [a b]) "ab"] (list a b)) |
| Comments |
| Comment by Assembla Importer [ 28/Sep/10 6:57 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/211 |
| Comment by Assembla Importer [ 28/Sep/10 6:57 AM ] |
|
chouser@n01se.net said: [file:aHWQ_W06Kr3O89eJe5afGb]: [PATCH] Support -> and ->> in destructuring forms. |
| Comment by Assembla Importer [ 28/Sep/10 6:57 AM ] |
|
cgrand said: I think the current patch suffers from the problem described here http://groups.google.com/group/clojure-dev/msg/80ba7fad2ff04708 too. |
| Comment by Assembla Importer [ 28/Sep/10 6:57 AM ] |
|
richhickey said: so, don't use syntax-quote, just use clojure.core/-> |
| Comment by Assembla Importer [ 28/Sep/10 6:57 AM ] |
|
chouser@n01se.net said: Only -> and ->> are actually legal here anyway – if you've locally bound foo to -> there's not really any good reason to think (fn [(foo inc a)] a) should work. And if you've redefined -> or ->> to mean something else in your ns, do we need to catch that at compile time, or is it okay to emit the rearranged code and see what happens? In short, would '#{ |
| Comment by Assembla Importer [ 28/Sep/10 6:57 AM ] |
|
cgrand said: Only -> and ->> are legal here but what if they are aliased or shadowed? Instead of testing the symboil per se I would check, if:
(when-not (&env (first b)) (#{#'clojure.core/-> #'clojure.core/->>} (resolve (first b))))
but it requires to change destructure's sig to pass the env around |
| Comment by Stuart Halloway [ 03/Dec/10 1:03 PM ] |
|
Rich: Are you assigned to this by accident? If so, please deassign yourself. |
[CLJ-291] (take-nth 0 coll) redux... Created: 08/Apr/10 Updated: 10/Dec/10 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Incomplete |
| Description |
|
I dont seem to be able make the old ticket uninvalid so here goes (let [j 0 I used jvisualvm and the jvm is doing some RNI call - no clojure code is running at all |
| Comments |
| Comment by Assembla Importer [ 17/Oct/10 9:47 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/291 |
| Comment by Assembla Importer [ 17/Oct/10 9:47 AM ] |
|
bhurt said: Before this bug gets marked as invalid as well, let me point out that the problem here is that (take-nth 0 any-list) is a meaningless construction- the only question is what to do when this happens. IMHO, the correct behavior is to throw an exception. |
| Comment by Assembla Importer [ 17/Oct/10 9:47 AM ] |
|
ataggart said: [file:dfNhoS2Cir3543eJe5cbLA]: throws IllegalArgumentException on negative step size |
| Comment by Stuart Halloway [ 29/Oct/10 10:36 AM ] |
|
Does calling (take-nth 0 ...) cause the problem, or only realizing the result? |
| Comment by Chouser [ 29/Oct/10 11:06 AM ] |
|
I'm not seeing a problem. Calling take-nth and even partially consuming the seq it returns works fine for me: (take 5 (take-nth 0 [1 2 3])) Note however that it is returning an infinite lazy seq. The example in the issue description seems to include essentially (doall <infinite-lazy-seq>) which does blow the heap: (doall (range)) This issue still strikes me as invalid. |
| Comment by Rich Hickey [ 29/Oct/10 11:06 AM ] |
|
(take-nth 0 ...) returns an infinite sequence of the first item: (take 12 (take-nth 0 [1 2 3])) Is something other than this happening on Solaris? |
[CLJ-699] make sure compile paths shares as much code as possible Created: 31/Dec/10 Updated: 31/Dec/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stuart Halloway | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Issue http://dev.clojure.org/jira/browse/CLJ-697 highlighted the fact that compilation has more than one entry point. Review these entry points and make them share code. |
[CLJ-807] hash-maps print-dup as literal, thus can be read as array-maps Created: 07/Jun/11 Updated: 29/Jul/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | Priority: | Minor |
| Reporter: | Alexander Taggart | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Per Rich in user=> (hash-map :k :v)
{:k :v}
user=> (type *1)
clojure.lang.PersistentHashMap
user=> (binding [*print-dup* true] (print-str *2))
"{:k :v}"
user=> (read-string *1)
{:k :v}
user=> (type *1)
clojure.lang.PersistentArrayMap
The cause is due to RT.map conditionally creating an array-map if the size is within the PersistentArrayMap.HASHTABLE_THRESHOLD. |
| Comments |
| Comment by Aaron Bedra [ 28/Jun/11 6:47 PM ] |
|
Rich: do you want a patch for this? |
| Comment by Rich Hickey [ 29/Jul/11 7:42 AM ] |
|
Only if it important to someone, solves some problem. |
[CLJ-248] Add support for subsets and submaps to sorted Sets/Maps Created: 27/Jan/10 Updated: 02/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Anonymous | Assignee: | Jim Blomo |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Currently we can have a subseq of a sorted-set|map-by, but this returns a seq and |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:05 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/248 |
| Comment by Assembla Importer [ 24/Aug/10 6:05 AM ] |
|
awizzard said: Another nice addition could be java.util.NavigableMap, though this is available only since Java 6. |
| Comment by Jim Blomo [ 11/May/12 1:13 AM ] |
|
SortedSet-SortedMap-interfaces-248.diff 2012-05-10 is a first pass at the SortedMap interface. If there are no objections, I'll build on the SortedMap implementation to add SortedSet support. |
| Comment by Jim Blomo [ 18/May/12 12:33 AM ] |
|
SortedMap-interfaces-248.diff 2012-05-10 supersedes the last diff. It implements and tests the SortedMap interface. Additionally it includes tests for `sorted-map`, which didn't seem to be tested yet. |
| Comment by Jim Blomo [ 18/May/12 1:56 AM ] |
|
SortedMap-SortedSet-interfaces-248.diff 2012-05-18 supersedes the last diff. It implements and tests both SortedMap and SortedSet. (Concurrent)NavigableMap is not implemented because I think 1.5 is still targeted. In any case, it probably should have its own ticket. |
| Comment by Andy Fingerhut [ 24/May/12 10:25 PM ] |
|
clj-248-SortedMap-SortedSet-interfaces-patch2.txt dated May 24, 2012 is simply an updated version of SortedMap-SortedSet-interfaces-248.diff dated May 17, 2012. The latter patch no longer applied cleanly. The new patch combines what was internally multiple git commits into one, simply because it was easier for me to create the patch that way. I left out the addition of *.swp and *.swo files to the .gitignore file. Builds and tests cleanly on Oracle/Apple JDK 1.6 on Mac OS X 10.6.8. |
| Comment by Andy Fingerhut [ 25/May/12 12:27 AM ] |
|
I don't know why Priority changed to Blocker when I changed Patch to "Code and Test". I didn't try to do that – suspect that something with the web UI is doing that automatically somehow. |
| Comment by Jim Blomo [ 02/Jun/12 7:08 PM ] |
|
Added CLJ-1008 for NavigableMap interface enhancement. |
[CLJ-803] IAtom interface Created: 27/May/11 Updated: 04/Jul/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Pepijn de Vos | Assignee: | Aaron Bedra |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Atom and the other reference types do not have interfaces and are marked final. Use cases for interfaces for the reference types include database wrappers. CouchDB behaves exactly like compare-and-set! and is shared, synchronous, independent state, so it makes sense to use the Atom interface to update a CouchDB document. I talked to Rich about this, and he said "patch welcome for IAtom", complete conversation: http://clojure-log.n01se.net/date/2010-12-29.html#10:04c |
| Comments |
| Comment by Stuart Halloway [ 27/May/11 2:33 PM ] |
|
Please add a patch formatted by "git format-patch" so that attribution is included. |
| Comment by Pepijn de Vos [ 04/Jun/11 5:56 AM ] |
|
I added the formatted patch a few days ago. Does 'no news is good news' apply here? And, silly question, will it make it into 1.3? I can't figure out how to tell Jira to show me that. |
| Comment by Kevin Downey [ 04/Jul/11 9:06 PM ] |
|
I fail to see the need for an IAtom, if you want something atom like for couchdb the interfaces are already there. Maybe I ICompareAndSwap. Atoms and couchdb are different so making them appear the same is a bad idea. http://en.wikipedia.org/wiki/Fallacies_of_Distributed_Computing http://clojure.org/state one of the distinctions between agents and actors raised in the section titled "Message Passing and Actors" is local vs. distributed and the same distinction can be made between couchdb (regardless of compare and swap) and atoms |
| Comment by Aaron Bedra [ 04/Jul/11 9:18 PM ] |
|
This ticket has already been moved into approved backlog. It will be revisited again after the 1.3 release where we will take a closer look at things. For now, this will remain as is. |
[CLJ-735] Improve error message when a protocol method is not found Created: 04/Feb/11 Updated: 09/Dec/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Alex Miller | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
If you call a protocol function but pass the wrong arity (forget an argument for example), you currently a message that says "No single method ... of interface ... found for function ... of protocol ...". The code in question is getting matching methods from the Reflector and creates this message if the number of matches != 1. There are really two cases there:
I propose that the == 0 case instead should have slightly different text at the beginning and a hint as to the intended arity within it: "No method: ... of interface ... with arity ... found for function ... of protocol ...". The >1 case should have similar changes: "Multiple methods: ... of interface ... with arity ... found for function ... of protocol ...". Patch is attached. I used case which presumably should have better performance than a nested if/else. I was not sure whether the reported arity should match the actual Java method arity or Clojure protocol function arity (including the target). I did the former. I did not add a test as I wasn't sure whether checking error messages in tests was appropriate or not. Happy to add that if requested. |
| Comments |
| Comment by Chas Emerick [ 14/Jul/11 6:39 AM ] |
I think it should be the latter. The message is emitted when the protocol methods are being invoked through the corresponding function, so it should be consistent with the errors emitted by regular functions. +1 for some tests, too. There certainly are tests for reflection warnings and such. FWIW, I'm happy to take this on if Alex is otherwise occupied. |
[CLJ-731] Create macro to variadically unroll a combinator function definition Created: 26/Jan/11 Updated: 28/Jan/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Fogus | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
Clojure contains a set of combinators that are implemented in a similar, but slightly different way. That is, they are implemented as a complete set of variadic overloads on both the call-side and also on the functions that they return. Visually, they all tend to look something like: (defn foo
([f]
(fn
([] do stuff...)
([x] do stuff...)
([x y] do stuff...)
([x y z] do stuff...)
([x y z & args] do variadic stuff...)))
([f1 f2]
(fn
([] do stuff...)
([x] do stuff...)
([x y] do stuff...)
([x y z] do stuff...)
([x y z & args] do variadic stuff...)))
([f1 f2 f3]
(fn
([] do stuff...)
([x] do stuff...)
([x y] do stuff...)
([x y z] do stuff...)
([x y z & args] do variadic stuff...)))
([f1 f2 f3 & fs]
(fn
([] do stuff...)
([x] do stuff...)
([x y] do stuff...)
([x y z] do stuff...)
([x y z & args] do variadic stuff...))))
To build this type of function for each combinator is tedious and error-prone. There must be a way to implement a macro that takes a "specification" of a combinator including: 1. name And builds something like the function foo above. This macro should be able to implement the current batch of combinators (assuming that http://dev.clojure.org/jira/browse/CLJ-730 is completed first for the sake of verification). |
| Comments |
| Comment by Stuart Halloway [ 28/Jan/11 9:03 AM ] |
|
This seems useful. Rich, would you accept a patch? |
| Comment by Stuart Halloway [ 28/Jan/11 9:40 AM ] |
|
Nevermind, just saw that Rich already suggested this on the dev list. Patch away. |
[CLJ-1104] Concurrent with-redefs do not unwind properly, leaving a var permanently changed Created: 07/Nov/12 Updated: 21/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Jason Wolfe | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Mac OS, Java 6 |
||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
On 1.4 and latest master: user> (defn ten [] 10) Not sure if this is a bug per se, but the doc doesn't mention lack of concurrency safety and my expectation was that the original value would always be restored after any (arbitrarily interleaved) sequence of with-redefs calls. |
| Comments |
| Comment by Tim McCormack [ 07/Nov/12 8:50 PM ] |
|
The with-redefs doc (v1.4.0) says "These temporary changes will be visible in all threads." That sounds non-thread-safe to me. In general, changes to var root bindings are not thread safe. |
| Comment by Herwig Hochleitner [ 08/Nov/12 9:17 AM ] |
|
As I understand it, with-redefs is mainly used in test suites to mock out vars. It was introduced when vars became static by default and a lot of testsuites had been using binding for mocking. Maybe the docstring should be amended with something along the lines of: When using this you have to ensure that only a single thread is interacting with redef'd vars. |
| Comment by Stuart Halloway [ 25/Nov/12 6:41 PM ] |
|
Behavior find as is, doc string change would be fine. |
| Comment by Andy Fingerhut [ 25/Nov/12 6:57 PM ] |
|
Patch clj-1104-doc-unsafety-of-concurrent-with-redefs-v1.txt dated Nov 25 2012 updates doc string of with-redefs to make it clear that concurrent use is unsafe. |
[CLJ-348] reify allows use of qualified name as method parameter Created: 13/May/10 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
This should complain about using a fully-qualified name as a parameter: (defmacro lookup [] Instead it simply ignores that parameter in the method body in favour of clojure.core/key. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 8:03 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/348 |
| Comment by Assembla Importer [ 24/Aug/10 8:03 AM ] |
|
technomancy said: [file:d2xUJIxTyr36fseJe5cbLA]: A test to expose the unwanted behaviour |
| Comment by Assembla Importer [ 24/Aug/10 8:03 AM ] |
|
richhickey said: I'm not sure the bug is what you say it is, or the resolution should be what you suggest. The true problem is the resolution of key when qualified. Another possibility is to ignore the qualifier there. |
| Comment by Assembla Importer [ 24/Aug/10 8:03 AM ] |
|
technomancy said: Interesting. So it's not appropriate to require auto-gensym here? Why are the rules different for reify methods vs proxy methods? > (defmacro lookup [] Can't use qualified name as parameter: clojure.core/key |
[CLJ-713] Upgrade ASM to a more current version Created: 11/Jan/11 Updated: 11/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Aaron Bedra | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
| Comments |
| Comment by Ghadi Shayban [ 10/Mar/13 6:34 AM ] |
|
Attached is a patch that externalizes and moves the ASM lib to the latest version (4.1), which has support for invokeDynamic if a brave soul wants to emit that instruction. Heed fogus's caveats [3]. ASM in this patch is not re-rooted, but an external Maven dependency. It does have the disadvantage of possibly conflicting with other dependents of ASM, but this is the same approach is used by other JVM langs. Can classloaders mitigate that problem? [1] Recent post on clojure-dev, oblivious of [2] https://groups.google.com/d/msg/clojure-dev/iX-ZFPk_zyE/Es3mDOdG3bYJ |
| Comment by Ghadi Shayban [ 11/Mar/13 10:41 AM ] |
|
Ran some of Andy Fingerhut's expression microbenchmarks on -master with the patch. There is no difference between performance compared to 1.5.1. |
| Comment by Andy Fingerhut [ 11/Mar/13 3:43 PM ] |
|
Ghadi, out of curiosity, if you do AOT compilation of some Clojure class files, does it produce byte-for-byte identical .class files after your changes vs. before your changes? If so, that would be pretty high assurance of no problems. If not, it would be good to understand what changed. |
[CLJ-250] debug builds Created: 27/Jan/10 Updated: 14/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stuart Halloway | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Incomplete |
| Waiting On: | Rich Hickey |
| Description |
|
This ticket includes two patches:
Things to consider before approving these patches:
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:05 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/250 |
| Comment by Stuart Halloway [ 07/Dec/10 8:23 PM ] |
|
Ignore the old patches. Considering the following implementation, please review and then move ticket to waiting on Stu:
|
| Comment by Rich Hickey [ 08/Dec/10 11:00 AM ] |
|
#3 - root bound only #6 - my biggest reservation is that this isn't yet informed by maven best practices |
| Comment by Stuart Sierra [ 08/Dec/10 2:09 PM ] |
|
System properties can be passed through Maven, so I do not anticipate this being a problem. However, I would prefer *assert* to remain true by default. |
| Comment by Chas Emerick [ 09/Dec/10 7:19 AM ] |
|
SS is correct about this approach not posing any issue for Maven. In addition, the build could easily be set up to always emit two jars, one "normal", one "debug". I'd suggest that, while clojure.debug might have broad effect, additional properties should be available to provide fine-grained control over each of the additional "debug"-related parameterizations that might become available in the future. I'd like to raise a couple of potentially tangential concerns (after now thinking about assertions for a bit in the above context), some or all of which may simply be a result of my lack of understanding in various areas. Looking at where assert is used in core.clj (only two places AFAICT: validating arguments to derive and checking pre- and post-conditions in fn), it would seem unwise to make it false by default. i.e. non-Named values would be able to get into hierarchies, and pre- and post-conditions would simply be ignored. It's my understanding that assertions (talking here of the JVM construct, from which Clojure reuses AssertionError) should not be used to validate arguments to public API functions, or used to validate any aspect of a function's normal operation (i.e. "where not to use assertions"). That would imply that derive should throw IllegalArugmentException when necessary, and fn pre- and post-conditions should perhaps throw IllegalStateException – or, in any case, something other than AssertionError via assert. This would match up far better with most functions in core using assert-args rather than assert, the former throwing IllegalArgumentException rather than AssertionError. That leads me to the question: is assert (and *assert*) intended to be a Clojure construct, or a quasi-interop form? If the former, then it can roughly have whatever semantics we want, but then it seems like it should not be throwing AssertionError. If the latter, then AssertionError is appropriate on the JVM, but then we need to take care that assertions can be enabled and disabled at runtime (without having to switch around different builds of Clojure), ideally using the host-defined switches (e.g. -ea and friends) and likely not anything like *assert*. I don't know if this is possible or practical at this point (I presume this would require nontrivial compiler changes). Hopefully the above is not water under the bridge at this point. Thank you in advance for your forbearance. |
| Comment by Rich Hickey [ 09/Dec/10 8:08 AM ] |
|
Thanks for the useful input Chas. Nothing is concluded yet. I think we should step back and look at the objective here, before moving forward with a solution. Being a dynamic language, there are many things we might want to validate about our programs, where the cost of checking is something we are unwilling to pay in production. Being a macro, assert has the nice property that, should *assert* not be true during compilation, it generates nil, no conditional test at all. Thus right now it is more like static conditional compilation. Java assert does have runtime toggle-ability, via -ea as you say. I haven't looked at the bytecode generated for Java asserts, but it might be possible for Clojure assert to do something similar, if the runtime overhead is negligible. It is quite likely that HotSpot has special code for eliding the assertion bytecode given a single check of some flag. I'm just not sure that flag is Class.desiredAssertionStatus. Whether this turns into changes in assert or pre/post conditions, best practices etc is orthogonal and derived. Currently we don't have a facility to run without the checks. We need to choose between making them disappear during compilation (debug build) or runtime (track -ea) or both. Then we can look at how that is reflected in assert/pre-post and re-examine existing use of both. The "where not to use assertions" doc deals with them categorically, but in not considering their cost, seems unrealistic IMO. I'd appreciate it if someone could look into how assert is generated and optimized by Java itself. |
| Comment by Chas Emerick [ 09/Dec/10 5:04 PM ] |
|
Bytecode issues continue to be above my pay grade, unfortunately… A few additional thoughts in response that you may or may not be juggling already: assert being a macro makes total sense for what it's doing. Trouble is, "compile-time" is a tricky concept in Clojure: there's code-loading-time, AOT-compile-time, and transitively-AOT-compile-time. Given that, it's entirely possible for an application deployed to a production environment that contains a patchwork of code or no code produced by assert usages in various libraries and namespaces depending upon when those libs and ns' were loaded, AOT-compiled, or their dependents AOT-compiled, and the value of *assert* at each of those times. Of course, this is the case for all such macros whose results are dependent upon context-dependent state (I think this was a big issue with clojure.contrib.logging, making it only usable with log4j for a while). What's really attractive about the JVM assertion mechanism is that it can be parameterized for a given runtime on a per-package basis, if desired. Reimplementing that concept so that assert can be *ns*-sensitive seems like it'd be straightforward, but the compile-time complexity already mentioned remains, and the idea of having two independently-controlled assertion facilities doesn't sound fun. I know nearly nothing about the CLR, but it would appear that it doesn't provide for anything like runtime-controllable assertions. |
| Comment by Stuart Halloway [ 29/Dec/10 3:17 PM ] |
|
The best (dated) evidence I could find says that the compiler sets a special class static final field $assertionsDisabled based on the return of desiredAssertionStatus. HotSpot doesn't do anything special with this, dead code elimination simply makes it go away. The code indeed compiles this way: 11: getstatic #6; //Field $assertionsDisabled:Z Even if we were 100% sure that assertion removal was total, I would still vote for a separate Clojure-level switch, for the following reasons:
Rich: awaiting your blessing to move forward on this. |
| Comment by Rich Hickey [ 07/Jan/11 9:42 AM ] |
|
The compiler sets $assertionsDisabled when, in static init code? Is there special support in the classloader for it? Is there a link to the best dated evidence you found? |
| Comment by Stuart Halloway [ 07/Jan/11 9:51 AM ] |
|
| Comment by Stuart Halloway [ 07/Jan/11 9:57 AM ] |
|
Link: Google "java assert shirazi". (Not posting link because I can't tell in 10 secs whether it includes my session information.) |
| Comment by Alexander Kiel [ 14/Mar/13 1:28 PM ] |
|
Is there anything new on this issue? I also look for a convenient way to disable assertions in production. |
[CLJ-428] subseq, rsubseq enhancements to support priority maps? Created: 20/Aug/10 Updated: 01/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
See dev thread at http://groups.google.com/group/clojure-dev/browse_thread/thread/fdb000cae4f66a95. Note: subseq currently returns () instead of nil in some situations. If the rest of this idea dies we might still want to fix that. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 10:10 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/428 |
| Comment by Andy Fingerhut [ 28/Apr/13 2:14 AM ] |
|
Patch clj-428-change-Sorted-seqFrom-to-take-inclusive-patch-v1.txt dated Apr 28 2013 was written by Mark Engelberg in July 2010, and was attached to a message he sent to the dev thread linked in the description. The approach he takes is described by him in that thread, copied here: ---------------------------------------- In this patch, I do not address one issue I raised before, which is whether subseq implies by its name that it should return a seq rather than a sequence (in other words nil rather than ()). If seq behavior is desired, it would be necessary to wrap a call to seq around the calls to take-while. But for now, I'm just making the behavior match the current behavior. Although I think this is the cleanest way to address the extensibility issue with subseq, the change to seqFrom will break anyone who currently is overriding that method. I didn't see any such classes in clojure.contrib, so I don't think it's an issue, but if this is a concern, my other idea is to fix the problem entirely within subseq by changing the calls to next into calls to drop-while. I have coded this to confirm that it works, and can provide that alternative patch if desired. I can also supply a patch that uses drop-while in clojure.core/subseq and rsubseq if such an approach is preferred to the one in this patch. |
| Comment by Andy Fingerhut [ 28/Apr/13 12:12 PM ] |
|
clj-428-change-Sorted-seqFrom-to-take-inclusive-patch-v2.txt dated Apr 28 2013 is same as clj-428-change-Sorted-seqFrom-to-take-inclusive-patch-v1.txt (soon to be deleted), except it adds tests for subseq and rsubseq, and corrects a bug in that patch. The approach is the same as described above for that patch. |
| Comment by Andy Fingerhut [ 01/May/13 2:44 AM ] |
|
Patch clj-428-change-Sorted-seqFrom-to-take-inclusive-patch-v3.txt dated May 1 2013 is the same as clj-428-change-Sorted-seqFrom-to-take-inclusive-patch-v1.txt, still with the bug fix mentioned for -v2, but with some unnecessary changes removed from the patch. The comments for -v1.txt on the approach still apply. |
[CLJ-21] GC Issue 17: arity checking during compilation Created: 17/Jun/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by richhickey, Dec 17, 2008 Use available metadata to check calls when possible |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 2:44 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/21 |
[CLJ-64] GC Issue 61: Make Clojure datatype Java Serializable Created: 17/Jun/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by straszheimjeffrey, Jan 30, 2009 I mentioned this on Google Groups. Currently the core Clojure datatypes are not Java Serializable. This means that they cannot easily be streamed as binary objects. Also, it will be difficult to use them with certain Java features like RMI. Comment 1 by rob.nikander, Mar 11, 2009 I voted for this because I'm experimenting with using Clojure for web apps. Tomcat barfs trying to serialize objects in the session, like clojure.lang.Cons. Comment 2 by cjkent, Mar 25, 2009 I'm experimenting with Clojure and Wicket. Any Wicket page classes containing maps that use Keywords as keys can't be saved to the session because Keyword isn't serializable. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 2:44 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/64 |
| Comment by Assembla Importer [ 24/Aug/10 2:44 PM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Assembla Importer [ 24/Aug/10 2:44 PM ] |
|
cemerick said: A patch has been submitted (via ticket #174) to add Serializable support to c.l.Keyword. |
[CLJ-77] GC Issue 74: Clojure compiler emits too-large classfiles (results in ClassFormatError) Created: 17/Jun/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by cemer...@snowtide.com, Feb 10, 2009 The jvm has certain implementation limits around the maximum size of classfiles, literal strings, method length, etc; however, in certain circumstances, the Clojure compiler can currently emit classfiles that violate some of those limitations, causing an error later when the classfile is loaded. While test coverage would necessarily detect this sort of problem on a project-by-project basis when one's tests attempted to load a project's classfiles, it seems like Clojure should do the following to ensure failure as quickly as possible: - throw an exception immediately if, while compiling a lib, it is detected that the resulting classfile(s) would violate any classfile implementation limits. Ideally, the exception's message would detail what file and on which line number the offending form is (e.g. if a method's bytecode would be too long). I can imagine that doing this may not be straightforward; a reasonable stop-gap would be for the compiler to immediately attempt to load the generated classfile in order to ensure up-front failure. - emit a warning if any clojure form is read that would, upon being compiled, require violating any of the classfile implementation limits; I suspect that *most* people looking to generate classfiles would be doing so in a "build" environment (rather than loading some code, tinkering, and then using clojure.core/compile), but for those that aren't, I can imagine there being a good deal of frustration around seeing that loading and using some code successfully would eventually produce unusable classfiles. I've appended a sample stack trace emitted by java when it attempted to load a too-long method implementation (which was produced by embedding a large list literal in a compiled lib). Exception in thread "main" java.lang.ClassFormatError: Invalid method Code length 105496 in class file com/foo/MyClass__init at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:675) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:316) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java: 288) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java: 374) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at clojure.lang.RT.loadClassForName(RT.java:1512) at clojure.lang.RT.load(RT.java:394) at clojure.lang.RT.load(RT.java:374) at clojure.core$load__4911$fn__4913.invoke(core.clj:3623) at clojure.core$load__4911.doInvoke(core.clj:3622) at clojure.lang.RestFn.invoke(RestFn.java:413) at clojure.core$load_one__4863.invoke(core.clj:3467) at clojure.core$compile__4918$fn__4920.invoke(core.clj:3633) at clojure.core$compile__4918.invoke(core.clj:3632) at clojure.lang.Var.invoke(Var.java:336) at clojure.lang.Compile.main(Compile.java:56) |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/77 |
| Comment by Assembla Importer [ 24/Aug/10 6:45 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
[CLJ-115] GC Issue 111: Enable naming an array parameter for areduce Created: 17/Jun/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by bo...@boriska.com, Apr 28, 2009 Currently there is no way to access anonymous array parameter of areduce. Consider: (areduce (.. System getProperties values toArray) i r 0 (some_expression)) some_expression has no way to access the array. Per Rich: -------------------- Yes, areduce would be nicer if it looked like a binding set: (areduce [aname anarray, ret init] expr) (areduce [aname anarray, ret init, start-idx start-n] expr) (areduce [aname anarray, ret init, start-idx start-n, end-idx end-n] expr) -------------------- This was discussed here: http://groups.google.com/group/clojure/tree/browse_frm/thread/40597a8ac322bc37/8cf6b17328ea7e8b?rnum=1&_done=%2Fgroup%2Fclojure%2Fbrowse_frm%2Fthread%2F40597a8ac322bc37%2F8cf6b17328ea7e8b%3Ftvc%3D1%26pli%3D1%26#doc_9ea7e3c5d500ed3c |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 5:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/115 |
| Comment by Assembla Importer [ 24/Aug/10 5:45 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
[CLJ-126] abstract superclass with non-public accessibility Created: 17/Jun/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The following code works in Java 6 but not in Java 5: (def Clojure 1.1.0-alpha-SNAPSHOT This was discussed on the Clojure mailing list and Stephen C. Gillardi came up with the following conclusion: _StringBuilder extends AbstractStringBuilder (though the JavaDoc docs lie and say it extends Object). AbstractStringBuilder has default accessibility (not public, protected, or private) which makes the class inaccessible to code outside the java.lang package. In both Java SE 5 and Java SE 6, StringBuilder does not contain a .setCharAt method definition. It relies on the inherited public method in AbstractStringBuilder. (I downloaded the source code for both versions from Sun to check.) In Java SE 5, when Clojure checks whether or not .setCharAt on StringBuilder is public, it finds that it's a public method of a non-public base class and throws the exception you saw. (It looks like you're using a version of Clojure older than 18 May 2009 (Clojure svn r1371). Versions later than that print the more detailed message I saw.) In Java SE 6, Clojure's checks for accessibility of this method succeed and the method call works. I'm not sure whether or not Clojure could be modified to make this method call work in Java 5. Google searches turn up discussion that this pattern of using an undocumented abstract superclass with non-public accessibility is not common in the JDK._ This ticket is being filed in the event that Clojure can handle these types of situations somehow. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 4:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/126 |
| Comment by Assembla Importer [ 24/Aug/10 4:45 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Assembla Importer [ 24/Aug/10 4:45 AM ] |
|
hiredman said: Related association with ticket #259 was added |
[CLJ-150] Doc for array-map should mention its characteristics/caveats Created: 10/Jul/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
Doc for array-map should mention its characteristics: preserves order of keys, linear O |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 4:54 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/150 |
[CLJ-153] Suggest adding set-precision! API to accompany with-precision Created: 12/Jul/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
Ticket #137 makes math-context</code> settable at the REPL. However, <code>math-context is not a public name in Clojure. The related public function is with-precision</code> which works by pushing a new binding for <code>math-context</code>. This ticket suggests adding <code>set-precision!</code> to Clojure's public API. Its effect would be the same as <code>with-precision</code>, but accomplished by using <code>set!</code> on the current <code>math-context binding rather than by pushing a new binding. Chouser suggests that we also add a doc string for math-context</code> noting that it is private and pointing the user to <code>with-precision</code> and <code>set-precision!. I agree. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 12:55 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/153 |
[CLJ-140] Single :tag for type hints conflates value's type with type of return value from an invoke Created: 01/Jul/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
The value of a Var can be operated on directly, or, if it is a fn, it can be invoked and the resulting value operated on. :tag metadata on a Var is used to provide a type hint to the compiler to avoid reflection. Having a single metadata key for this two distinct uses makes it possible (even easy, if unlikely) to create a situation where type-hinting the value causes a ClassCastException on an operation on the invocation return value, or the reverse. The only obvious solution is two use different keys for the two uses. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:51 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/140 |
[CLJ-213] Invariants and the STM Created: 01/Dec/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
(ticket requested here http://groups.google.com/group/clojure/browse_thread/thread/119311e89fa46806/4903ce25ff6deaa6#4903ce25ff6deaa6) The general idea is to declare invariants inside a transaction and, when at commit time an invariant doesn't hold anymore, the transaction retries. See the attached file for quick prototype. User code would looks like: (invariant (@world :key)) (commute world update-in [:key] val-transform-fn) This means the commute will occur only if (@world :key) returns the same value in-transaction and at commit point. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 7:23 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/213 |
[CLJ-233] better error reporting of nonexistent var Created: 31/Dec/09 Updated: 29/Sep/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
simple improvement to error message when referencing a var that doesn't exist. |
| Comments |
| Comment by Assembla Importer [ 29/Sep/10 5:29 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/233 |
| Comment by Assembla Importer [ 29/Sep/10 5:29 AM ] |
|
chouser@n01se.net said: Stuart, I don't see a patch attached. |
[CLJ-273] def with a function value returns meta {:macro false}, but def itself doesn't have meta Created: 23/Feb/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Rich Hickey |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
On the master (1.2) branch, if you create a def with an initial function value, {:macro false} is added to the metadata of the return value for def. However, if you look again at the metadata on the var itself, the {:macro false} is not present! This breaks the use of contrib's defalias when aliasing macros, because the new alias is marked as {:macro false}. The code below demonstrates the issue, which was introduced in http://github.com/richhickey/clojure/commit/430dd4fa711d0008137d7a82d4b4cd27b6e2d6d1, "metadata for fns." ;; all running on 1.2, DIFF noted in comments
(defmacro foo [])
-> #'user/foo
(meta (def bar (.getRoot #'foo)))
-> {:macro false, :ns #<Namespace user>, :name bar, :file "NO_SOURCE_PATH", :line 83}
;; DIFF: where did that :macro false come from??
(def bar (.getRoot #'foo))
-> #'user/bar
(meta #'bar)
-> {:ns #<Namespace user>, :name bar, :file "NO_SOURCE_PATH", :line 84}
;; LIKE 1.1, but really weird: now the :macro false is gone again!
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 9:32 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/273 |
[CLJ-277] Making clojure.xml/emit a little friendler to xml consumers Created: 03/Mar/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Currently, clojure.xml/emit breaks the eBay api, because emit adds whitespace before and after :contents. This trivial patch fixes it for me: (Dunno whether there's a good reason emit works that way, or if I'm missing something obvious.) I realize that emit's behavior conforms to the XML spec and it's probably eBay at fault here. But I can nevertheless see this whitespace causing problems. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 9:41 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/277 |
| Comment by Assembla Importer [ 24/Aug/10 9:41 AM ] |
|
bpsm said: I've attached a patch to #410, which also fixes this issue. (In fact, it turns out that it's the same patch tlj previously attached here.) |
| Comment by Assembla Importer [ 24/Aug/10 9:41 AM ] |
|
stu said: Duplicated association with ticket #410 was added |
[CLJ-319] TransactionalHashMap bug Created: 26/Apr/10 Updated: 01/Oct/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
TransactionalHashMap computation of the bin is buggy. The implementation doesn't unset the sign bit before using it in accessing the bin array which in some cases cause an ArrayOutOfBoundException to be thrown. As Rich Hickey has pointed out, this is an unsupported experimental Class and won't be fixed unless I provided a patch, so attached is the patch file. |
| Comments |
| Comment by Assembla Importer [ 01/Oct/10 4:06 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/319 |
| Comment by Assembla Importer [ 01/Oct/10 4:06 PM ] |
|
megabyte2021 said: [file:cuuZnsuuWr36H0eJe5dVir]: The patch file |
| Comment by Assembla Importer [ 01/Oct/10 4:06 PM ] |
|
stu said: Please add a test case. |
[CLJ-434] Additional copy methods for URLs in clojure.java.io Created: 10/Sep/10 Updated: 10/Sep/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The copy method in clojure.java.io doesn't handle java.net.URL as input. |
| Comments |
| Comment by Assembla Importer [ 10/Sep/10 7:32 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/434 |
[CLJ-459] RFE: modify description of "assoc" Created: 14/Oct/10 Updated: 14/Oct/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The documentation for "assoc" in clojure.core should probably (assoc vector index val) </code></pre> and <pre><code>(assoc vector index val & ivs) in the usage line. |
| Comments |
| Comment by Assembla Importer [ 14/Oct/10 4:55 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/459 |
[CLJ-148] Poor reporting of symbol conflicts when using (ns) Created: 10/Jul/09 Updated: 28/Jun/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
I have a module that includes pprint and my own utils. When com.howard.lewisship.cascade.dom/write was changed from private to public I get the following error: java.lang.IllegalStateException: write already refers to: #'clojure.contrib.pprint/write in namespace: com.howardlewisship.cascade.test-views (test_views.clj:0) (ns com.howardlewisship.cascade.test-views ; line 15 That line number is wrong but better yet, identifying the true conflict (com.howard.lewisship.cascade.dom/write) would be even more important. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:54 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/148 |
| Comment by Assembla Importer [ 24/Aug/10 3:54 AM ] |
|
scgilardi said: It's saying that the symbol com.howardlewisship.cascade.test-views/write already resolves to #���clojure.contrib.pprint/write, so you can't def a new write in com.howardlewisship.cascade.test-views. What do you propose for an alternate wording of the error message here? |
| Comment by Jeff Rose [ 12/May/11 9:49 AM ] |
|
I think the issue is that only one side of the conflict is reported in the error, so if you get this kind of error in the middle of a large project it can be hard to figure out which namespace is conflicting. Take a toy example: user=> (ns foo) In this case it would be best if the error said something like: "Conflict referring to #'bar/foobar in #<Namespace problem> because foobar already refers to: #'foo/foobar." This way the error message clearly identifies the location of the conflict, and the locations of the two conflicting vars. Hopefully this helps clarify. I think I see where to fix it in warnOrFailOnReplace on line 88 of src/jvm/clojure/lang/Namespace.java, and this reminds me I need to send in a CA so I can pitch in next time... |
| Comment by Aaron Bedra [ 28/Jun/11 6:42 PM ] |
|
It looks like the true conflict is in test-views, not in dom. A small example of the line number breakage showing the problem on master (1.3) would be very helpful. |
[CLJ-272] load/ns/require/use overhaul Created: 18/Feb/10 Updated: 28/Feb/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Description |
|
Creating this ticket to describe various things people have wanted to change about how ns works: Minimal needs
Other possibilities to discuss.
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 9:27 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/272 |
| Comment by Assembla Importer [ 24/Aug/10 9:27 AM ] |
|
stu said: Suggestions from Volkan Yazici: Hi, I saw your "load/ns/require/use overhaul" ticket[1] and would like to tr/edu/bilkent/cs/retop.clj In retop.clj, I have below ns definition. (ns tr.edu.bilkent.cs.retop And in every .clj file in retop/ directory I have below in-ns in the (in-ns 'tr.edu.bilkent.cs.retop) The problems with the ns decleration are: 1) Most of the :import's in retop.clj only belong to a single .clj file. (tr.edu.bilkent.cs.patoh imports are only used by graph.clj. Yep, I can add an (import ...) 2) See (:load ...) clause in (ns ...) form. There are lots of (:load Also, being able to use wildcards would be awesome. 3) There are inconsistencies between macros and functions. For instance, (ns foo.bar.baz (:use mov)) I'd like to get rid of quotations in both cases. I'm not sure if I'm using the right tools and doing the right approach |
| Comment by Assembla Importer [ 24/Aug/10 9:27 AM ] |
|
stuart.sierra said: My requests: 1. If writing macros that do not evaluate their arguments, provide function versions that do evaluate their arguments. 2. Do not support prefix lists for loading Clojure namespaces. It's hard to parse with external tools. 3. Do not conflate importing Java classes with loading Clojure namespaces. They are fundamentally different operations with different semantics. I have implemented some ideas in a macro called "need" at http://github.com/stuartsierra/need |
| Comment by Stuart Sierra [ 12/Dec/10 4:08 PM ] |
|
Further requests: Permit tools to read the "ns" declaration and statically determine the dependencies of a namespace, without evaluating any code. |
| Comment by Paudi Moriarty [ 28/Feb/12 3:56 AM ] |
This would be great for building OSGi bundles where Bnd is currently not much help. |
[CLJ-400] A faster flatten Created: 13/Jul/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
As discussed in this thread, I am submitting a more performant version of flatten for review. It has the same semantics as the current core/flatten. I have also updated the doc string to say that "(flatten nil) returns the empty list", because that's what the current version of core/flatten does as well. I haven't mailed in a CA yet, but I will tomorrow morning. Edit: Of course I'd mess my first ticket up |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 12:19 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/400 |
[CLJ-190] enhance with-open to be extensible with a new close multimethod Created: 13/Sep/09 Updated: 23/Dec/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
Discussion: http://groups.google.com/group/clojure/browse_thread/thread/8e4e56f6fc65cc8e/618a893a5b2a5410 Currently, with-open calls .close when it's finished. I'd like it to have a (defmulti close type) so it's behavior is extensible. A standard method could be defined for java.io.Closeable and a :default method with no type hint. I've come across a few cases where some external library defines what is essentially a close method but names it shutdown or disable, etc., and adding my own "defmethod close" would be much easier than rewriting with-open. This would also allow people to eliminate reflection for classes like sql Connection that were created before Closeable. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 4:30 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/190 |
| Comment by Assembla Importer [ 24/Aug/10 4:30 AM ] |
|
mikehinchey said: [file:ca27R6Ojur3PQ0eJe5afGb]: fix adds close method and tests |
| Comment by Assembla Importer [ 24/Aug/10 4:30 AM ] |
|
mikehinchey said: Note, I only defined methods for :default (reflection of .close) and Closeable, not sql or the numerous other classes in java that should be Closeable but are not. Maybe clojure.contrib.sql and other such libraries should define related close methods. |
| Comment by Assembla Importer [ 24/Aug/10 4:30 AM ] |
|
richhickey said: I want to hold off on this until scopes are in |
| Comment by Tassilo Horn [ 23/Dec/11 6:50 AM ] |
|
Probably better implemented using a protocol. See http://dev.clojure.org/jira/browse/CLJ-308 |
[CLJ-450] Add default predicate argument to filter, every?, take-while Created: 01/Oct/10 Updated: 27/Apr/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Some seq processing functions that take predicates could be improved by the addition of a default value of identity for the predicate argument. This has been discussed on the mailing list, and people seem favorable: I can put together a patch. |
| Comments |
| Comment by Assembla Importer [ 01/Oct/10 4:39 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/450 |
| Comment by Jason Orendorff [ 13/Mar/12 2:51 PM ] |
|
I independently wanted this. Here's a patch for: some, not-any?, every?, not-every?. If this is roughly what's wanted I'll be happy to add filter, remove, take-while, drop-while. |
| Comment by Jason Orendorff [ 13/Mar/12 4:57 PM ] |
|
Note that there are a few cases of (every? identity ...) and (some identity ...) in core.clj itself; the patch removes "identity" from those. |
| Comment by Andy Fingerhut [ 26/Apr/12 7:51 PM ] |
|
clj-450-add-default-pred-arg-to-core-fns-patch.txt dated Apr 26 2012 is identical to Jason Orendorff's, except it is in git format. Jason is not on the list of Clojure contributors as of today. I have sent him an email asking if he has done so, or is planning to. |
| Comment by Jason Orendorff [ 27/Apr/12 10:35 AM ] |
|
Of course I'd be happy to send in a contributor agreement. ...Is there actually any interest in taking this patch or something like it? |
| Comment by Andy Fingerhut [ 27/Apr/12 11:38 AM ] |
|
I don't know if there is any interest in taking this patch. Perhaps a Clojure screener will take a look at it and comment, but I am not a screener and can't promise anything. |
[CLJ-451] fn literals lack name/arglists/namespace metadata Created: 05/Oct/10 Updated: 05/Oct/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
I would expect (meta (fn not-so-anonymous [a b c])) to include {:name not-so-anonymous :arglists ([a b c])} alongside line number information and possibly namespace/file as well, but currently it only includes :line. |
| Comments |
| Comment by Assembla Importer [ 05/Oct/10 12:29 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/451 |
[CLJ-396] Better support for multiple inheritance in hierarchies and multimethods Created: 07/Jul/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
While the hierarchies produced with 'derive' allow multiple parents per child, there is no way to indicate precedence between those parents, other than by laboriously specifying 'prefer-method' for every type X every multimethod. When 2 multimethods are both applicable to the supplied arguments, Clojure produces a nonspecific IllegalArgumentException containing only an error string. All this means that while Clojure does have an "inheritance" mechanism in the form of the ad hoc hierarchies, it is currently not really possible to implement multiple inheritance using the ad hoc hierarchy mechanism. 'Prefer-method' will not scale up to use in large applications with complex type hierarchies and heavy use of multimethods. Some potential ways to solve this are:
Paul |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 11:06 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/396 |
[CLJ-405] better error messages for bad defrecord calls Created: 20/Jul/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
defrecord could tell you if, e.g., you didn't specify an interface before leaping into method bodies. See http://groups.google.com/group/clojure/browse_thread/thread/f52f90954edd8b09 |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 12:28 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/405 |
| Comment by Assembla Importer [ 24/Aug/10 12:28 AM ] |
|
stu said: This could be fixed with an assert-valid-defrecord call in core_deftype, similar to assert-valid-fdecl in core.clj. Such a function would also be a place to hang other defrecord error messages. |
[CLJ-379] problem with classloader when run as windows service Created: 13/Jun/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I found following error when I run clojure application as MS Windows service (via procrun from Apache Daemon project). When I tried to do 'require' during run-time, I got NullPointerException. This happened as baseLoader function from RT class returned null in such environment (the value of Thread.currentThread().getContextClassLoader()). (Although my app works fine when I run my application as standalone program, not as service). (.setContextClassLoader (Thread/currentThread) (java.lang.ClassLoader/getSystemClassLoader)) before any call to 'require'.... May be you need to modify 'baseLoader' function, so it will check is value of Thread.currentThread().getContextClassLoader() is null or not, and if null, then return value of java.lang.ClassLoader.getSystemClassLoader() ? |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 10:40 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/379 |
| Comment by Assembla Importer [ 24/Aug/10 10:40 AM ] |
|
alexott said: possible fix is attached |
| Comment by Assembla Importer [ 24/Aug/10 10:40 AM ] |
|
alexott said: [file:c5XWHcD4yr34HveJe5ccaP] |
[CLJ-130] Namespace metadata lost in AOT compile Created: 19/Jun/09 Updated: 03/Dec/10 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
For example, the namespace @clojure.contrib.def@ has metadata for doc and author. We see this when we load the file directly from source: But if we load the file from the jar where it's been compiled, the metadata is lost: Even if we use @load@, we don't see metadata on the item: The jar isn't the problem, for if we use the slim jar (without the AOT This seems to be true usually, but not always. For example the |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/130 |
| Comment by Assembla Importer [ 24/Aug/10 6:45 AM ] |
|
richhickey said: Updating tickets (#127, #128, #129, #130) |
| Comment by Assembla Importer [ 24/Aug/10 6:45 AM ] |
|
juergenhoetzel said: This is still a issue on Clojure 1.2.0-master-SNAPSHOT Any progress, hints? I prefer interactive documentiation via slime/repl |
[CLJ-401] Promote "seqable?" from contrib? Created: 13/Jul/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
This was vaguely discussed here and could potenntially help this ticket as well as be generally useful. I don't speak for everyone but when I saw sequential? I assumed it would have the semantics that seqable? does. Just my opinion, I'd love to hear someone's who is more informed than mine. In the proposed patch referenced in the ticket above, if seqable? could be used in place of sequential? flatten could be more powerful and work with maps/sets/java collections. Here's how it would look: (defn flatten [coll]
(lazy-seq
(when-let [coll (seq coll)]
(let [x (first coll)]
(if (seqable? x)
(concat (flatten x) (flatten (next coll)))
(cons x (flatten (next coll))))))))
And an example: user=> (flatten #{1 2 3 #{4 5 {6 {7 8 9 10 #tok1-block-tok}}}}) |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 9:19 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/401 |
[CLJ-112] GC Issue 108: All Clojure interfaces should specify CharSequence instead of String when possible Created: 17/Jun/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by redchin, Apr 20, 2009
rhickey: unlink: then just use a map {:escaped true :val "foo"}
unlink: What I meant is, everything in between would want to see something
String-y, not caring whether it's a String or MyString.
hiredman: unlink: if you use something that implements CharSequence and
IMeta (I think it's IMeta) you get something that is basically a String,
but with metadata
rhickey: what hiredman said
hiredman: ideally most things would not specify String but CharSequence in
their interface
hiredman: but somehow I doubt that is case
unlink: ok.
unlink: Good to know.
rhickey: hiredman: unfortunately that's not true of some of Clojure - could
you enter an issue for it please - use CharSequence when possible?
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/112 |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
[CLJ-129] Add documentation to sorted-set-by detailing how the provided comparator may change set membership semantics Created: 18/Jun/09 Updated: 24/Aug/10 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Chas Emerick |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
To start, let's look at some simple default sorted-set behaviour (which uses PersistentHashMap via PersistentHashSet, and therefore uses equality/hashCode to determine identity): user=> (sorted-set [1 2] [-5 10] [1 5])
#{[-5 10] [1 2] [1 5]}
</code></pre>
sorted-set-by uses PersistentTreeMap via PersistentTreeSet though, which implies that the comparator provided to sorted-set-by will be used to determine identity, and therefore member in the set. This can lead to (IMO) non-intuitive behaviour:
<pre><code>
user=> (sorted-set-by #(> (first %) (first %2)) [1 2] [-5 10] [1 5])
#{[1 2] [-5 10]}
Notice that because the provided comparison fn determines that [1 2] and [1 5] have the same sort order, the latter value is considered identical to the former, and not included in the set. This behaviour could be very handy, but is also likely to cause confusion when what the user almost certainly wants is to maintain the membership semantics of the original set (e.g. relying upon equality/hashCode), but only modify the ordering. (BTW, yes, I know there's far easier ways to get the order I'm indicating above over a set of vectors thanks to vectors being comparable via the compare fn. The examples are only meant to be illustrative. The same non-intuitive result would occur, with no easy fallback (like the 'compare' fn when working with vectors) when the members of the set are non-Comparable Java object, and the comparator provided to sorted-set-by is defining a sort over some values returned by method calls into those objects.) I'd be happy to change the docs for sorted-set-by, but I suspect that there are others who could encapsulate what's going on here more correctly and more concisely than I. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 7:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/129 |
| Comment by Assembla Importer [ 24/Aug/10 7:45 AM ] |
|
richhickey said: Updating tickets (#127, #128, #129, #130) |
[CLJ-440] java method calls cannot omit varargs Created: 27/Sep/10 Updated: 29/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 5 |
| Labels: | None | ||
| Description |
|
From http://groups.google.com/group/clojure/browse_thread/thread/7d0d6cb32656a621 E.g., trying to call java.util.Collections.addAll(Collection c, T... elements) user=> (Collections/addAll [] (object-array 0)) false user=> (Collections/addAll []) IllegalArgumentException No matching method: addAll clojure.lang.Compiler$StaticMethodExpr.<init> (Compiler.java:1401) The Method class provides an isVarArg() method, which could be used to inform the compiler to process things differently. |
| Comments |
| Comment by Assembla Importer [ 27/Sep/10 8:19 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/440 |
| Comment by Alexander Taggart [ 01/Apr/11 11:16 PM ] |
|
Patch adds support for varargs. Builds on top of patch in CLJ-445. |
| Comment by Alexander Taggart [ 05/Apr/11 5:45 PM ] |
|
Patch updated to current CLJ-445 patch. |
| Comment by Nick Klauer [ 29/Oct/12 8:12 AM ] |
|
Is this ticket on hold? I find myself typing (.someCall arg1 arg2 (into-array SomeType nil)) alot just to get the right method to be called. This ticket sounds like it would address that extraneous into-array arg that I use alot. |
| Comment by Andy Fingerhut [ 29/Oct/12 10:45 AM ] |
|
fixbug445.diff uploaded on Oct 29 2012 was written Oct 23 2010 by Alexander Taggart. I am simply copying it from the old Assembla ticket tracking system to here to make it more easily accessible. Not surprisingy, it doesn't apply cleanly to latest master. I don't know how much effort it would be to update it, but only a few hunks do not apply cleanly according to 'patch'. See the "Updating stale patches" section on the JIRA workflow page here: http://dev.clojure.org/display/design/JIRA+workflow |
| Comment by Andy Fingerhut [ 29/Oct/12 10:56 AM ] |
|
Ugh. Deleted the attachment because it was for CLJ-445, or at least it was named that way. CLJ-445 definitely has a long comment history, so if one or more of its patches address this issue, then you can read the discussion there to see the history. I don't know of any "on hold" status for tickets, except for one or two where Rich Hickey has explicitly said in a comment that he wants to wait a while before making the change. There are just tickets that contributors choose to work on and ones that screeners choose to screen. |
[CLJ-19] GC Issue 15: JavaDoc for interfaces Created: 17/Jun/09 Updated: 17/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by richhickey, Dec 17, 2008 Add JavaDoc to those interfaces supported for public use - IFn, IPersistentCollection etc. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:44 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/19 |
| Comment by Assembla Importer [ 24/Aug/10 6:44 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Kevin Downey [ 17/Nov/12 8:05 PM ] |
|
this seems like a great task for someone just starting out contributing to clojure. |
[CLJ-274] cannot close over mutable fields (in deftype) Created: 23/Feb/10 Updated: 01/Oct/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
Simplest case: user=> java.lang.IllegalArgumentException: Cannot assign to non-mutable: val (NO_SOURCE_FILE:5) Functions should be able to mutate mutable fields in their surrounding deftype (just like inner classes do in Java). Filed as bug, because the loop special form expands into a fn form sometimes: user=> |
| Comments |
| Comment by Assembla Importer [ 01/Oct/10 9:35 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/274 |
| Comment by Assembla Importer [ 01/Oct/10 9:35 AM ] |
|
donmullen said: Updated each run to [_] for new syntax. Now gives exception listed. |
| Comment by Assembla Importer [ 01/Oct/10 9:35 AM ] |
|
richhickey said: We're not going to allow closing over mutable fields. Instead we'll have to generate something other than fn for loops et al used as expressions. Not going to come before cinc |
[CLJ-15] GC Issue 11: incremental hashcode calculation for collections Created: 17/Jun/09 Updated: 08/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by richhickey, Dec 17, 2008
So hachCode can be final, more efficient to calc as you go.
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:44 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/15 |
| Comment by Christophe Grand [ 08/Mar/13 6:20 AM ] |
|
Wouldn't the naive approach incur realizing lazy sequences when adding them to a list or a vector or as values in a map? |
[CLJ-698] class accessible from deftype method bodies is not suitable for instance?, ... Created: 28/Dec/10 Updated: 29/Dec/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | Backlog |
| Type: | Defect | Priority: | Major |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Example interaction: http://pastebin.com/cTdUCKfp
|
| Comments |
| Comment by Stuart Halloway [ 29/Dec/10 12:45 PM ] |
|
The problem occurs in 1.2 but is fixed on master. Leaving in backlog in case we ever cut another 1.2 release--if not, then mark as fixed. |
[CLJ-200] Extend cond to support inline let, much like for Created: 18/Oct/09 Updated: 02/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Anonymous | Assignee: | Mark Engelberg |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
I find it occasionally very useful to do a few tests in a cond, then introduce some new symbols (for both clarity and efficiency) that can be referenced in later tests (or matching expressions). This parallels similar functionality inside the for macro, where the :let keyword is matched against a vector of symbol bindings and forms an implicit let around the remainder of the comprehension. I'll be adding a patch for this shortly. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 1:51 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/200 |
| Comment by Assembla Importer [ 24/Aug/10 1:51 PM ] |
|
hlship said: Trickier than I thought because cond is really wired into other fundamentals, like let. |
| Comment by Assembla Importer [ 24/Aug/10 1:51 PM ] |
|
cgrand said: Howard, what do you think of http://gist.github.com/432712 ? |
| Comment by Mark Engelberg [ 23/Nov/12 2:33 AM ] |
|
Patch cond-let-clauses.diff on 23/Nov/12 adds inline :let clauses to cond, implementing CLJ-200. The code is based off of code by cgrand, with some tweaks so the implementation only relies on constructs defined earlier in core.clj, since when cond is defined, things aren't yet fully bootstrapped. Also added a test to control.clj. |
| Comment by Christophe Grand [ 23/Nov/12 3:06 AM ] |
|
Some comments: the docstring is missing, I believe you don't have to modify the original cond (except the docstring maybe), just redefine it later on once most of the language is defined – a bit like what is done for let for example. There is still the unlikely eventuality that some code uses :let as :else. What about shipping a cond which complains on keywords (in test position) other than :else? |
| Comment by Mark Engelberg [ 23/Nov/12 3:47 AM ] |
|
cond-let-clauses-with-docstring.diff contains the same patches as cond-let-clauses, but includes the original docstring for cond along with an additional sentence about the :let bindings. |
| Comment by Mark Engelberg [ 23/Nov/12 3:54 AM ] |
|
Cgrand, I did see your example of redefining cond after most of the language is defined, but since I was able to figure out how to do it in the proper place, that makes the :let bindings available for users of cond downstream and avoids any unforeseen complications that might come from rebinding. As for your other point, I think it is highly improbable that someone would have used :let in the :else position. However I can imagine someone intentionally using something like :true or :default. I think the idea of warning for other keywords is actually more likely to cause complications than the unlikely problem it is meant to solve. I did resubmit the patch with the docstring restored. Thanks for pointing out that problem. I'm excited about this patch – I use :let bindings within the cond in my own code all the time. Thanks again for the blog post that started me on that path. |
| Comment by Christophe Grand [ 23/Nov/12 4:13 AM ] |
|
True, it's :unlikely for :let to happen. |
| Comment by Andy Fingerhut [ 29/Nov/12 8:46 PM ] |
|
Mark, could you remove the obsolete earlier patch now that you have added the one with the doc string? Instructions for removing patches are under the heading "Removing Patches" on this page: http://dev.clojure.org/display/design/JIRA+workflow |
| Comment by Mark Engelberg [ 29/Nov/12 10:50 PM ] |
|
Done. |
| Comment by Andy Fingerhut [ 30/Nov/12 1:24 AM ] |
|
I haven't figured out what is going wrong yet. I can apply the patch cond-let-clauses-with-docstring.diff to the latest Clojure master just fine. I can do "ant jar" and it will build a jar. When I do "ant", it fails with the new test for cond with :let, throwing a StackOverflowException. I can enter that same form into the REPL and it evaluates just as the test says it should. I can comment out that new test and all of the rest pass. But the new test doesn't pass when inside of the control.clj file. Anyone know why? |
| Comment by Christophe Grand [ 30/Nov/12 4:54 AM ] |
|
It's because of the brutal replacement performed by test/are: the placeholders for this are form are x and y but in Mark's test there are used as local names and are tries to substitute them recursively... |
| Comment by Mark Engelberg [ 02/Dec/12 8:20 AM ] |
|
cond-let-clauses-fixed-test.diff on 02/Dec/12 contains the same patch, but with the x,y locals in the test case changed to a,b so that it works properly in the are clause which uses x and y. |
| Comment by Mark Engelberg [ 02/Dec/12 8:27 AM ] |
|
On Windows, I can't get Clojure's test suite task to work, either via ant or maven, which has made it difficult for me to verify the part of the patch that applies to the test suite works as expected; I had tested it as best I could in the REPL, using a version of Clojure built with the patch applied, but using this process, I missed the subtle interaction between are and the locals in the test case. Sorry about that. If someone can double-check that the test suite task now works with the newest patch, that would be great, and then I'll go ahead and remove the obsoleted patch. Thanks. |
| Comment by Andy Fingerhut [ 02/Dec/12 6:29 PM ] |
|
clj-200-cond-let-clauses-fixed-test-v2-patch.txt dated Dec 2 2012 is identical to Mark Engelberg's cond-let-clauses-fixed-test.diff of the same date, except it applies cleanly to the latest Clojure master. I've verified that it compiles and passes all tests with latest Clojure master as of this date. Mark, I've made sure to keep your name in the patch, since you wrote it. You should be able to remove your two attachments now, so the screener won't be confused which patch should be examined. |
| Comment by Andy Fingerhut [ 02/Dec/12 6:31 PM ] |
|
Mark, besides general issues with Windows not being used much (or maybe not at all?) by Clojure developers, there is the issue right now filed as CLJ-1076 that not all tests pass when run on Windows due to CR-LF line ending differences that cause several Clojure tests to fail, regardless of whether you use ant or maven to run them. |
[CLJ-761] print-dup generates call to nonexistent method for APersistentVector$SubVector Created: 19/Mar/11 Updated: 04/Nov/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Backlog |
| Fix Version/s: | Backlog |
| Type: | Defect | Priority: | Minor |
| Reporter: | Stuart Sierra | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Originally reported by Carson print-dup on any collection type generates code to call the create method of the collection's class. APersistentVector$SubVector has no create method. Example with Clojure at commit ecae8ff08a298777c365a261001adfe9bfa4d83c : Clojure 1.3.0-master-SNAPSHOT
user=> (read-string (binding [*print-dup* true] (pr-str (subvec [1 2 3] 1))))
IllegalArgumentException No matching method found: create clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:50)
|
| Comments |
| Comment by Kevin Downey [ 04/Nov/11 11:29 AM ] |
|
33.927 hiredman ,(binding [*print-dup* true] (pr-str (first {:a 1}))) |
[CLJ-346] (pprint-newline :fill) is not handled correctly Created: 12/May/10 Updated: 29/Nov/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Tom Faulhaber |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Incomplete |
| Waiting On: | Tom Faulhaber |
| Description |
|
Filled pretty printing (where we try to fit as many elements on a line as possible) is being too aggressive as we can see when we try to print the following array: user> (binding [*print-right-margin* 20] (pprint (int-array (range 10)))) Produces: [0, Rather than [0, 1, 2, 3, 4, or something like that. (I haven't worked through the exact correct representation for this case). We currently only use :fill style newlines for native java arrays. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 8:01 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/346 |
| Comment by Assembla Importer [ 24/Aug/10 8:01 AM ] |
|
stu said: [file:diLxv6y4Sr35GVeJe5cbLr] |
| Comment by Assembla Importer [ 24/Aug/10 8:01 AM ] |
|
stu said: The second patch includes the first, and adds another test. |
| Comment by Assembla Importer [ 24/Aug/10 8:01 AM ] |
|
tomfaulhaber said: This patch was attached to the wrong bug. It should be attached to bug #347. There is no fix for this bug yet. |
| Comment by Rich Hickey [ 05/Nov/10 8:07 AM ] |
|
Is this current? |
| Comment by Stuart Halloway [ 29/Nov/10 8:48 PM ] |
|
Tom, this patch doesn't apply, and I am not sure why. Can you take a look? |
[CLJ-304] contrib get-source no longer works with deftype Created: 20/Apr/10 Updated: 03/Dec/10 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Description |
|
Now that deftype creates a class (but not a var), you can't use c.c.repl-utils/get-source on a deftype. Is there something we can do on the Clojure side to help this work again? |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 4:38 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/304 |
| Comment by Assembla Importer [ 24/Aug/10 4:38 PM ] |
|
chouser@n01se.net said: That's a great question. get-source just needs a file name and line number. If IMeta were a protocol, it could be extended to Class. That implementation could look for a "well-known" static field, perhaps? __clojure_meta or something? Then deftype would just have to populate that field, and get-source would be all set. Does that plan have any merit? Is there a better place to store a file name and line number? |
| Comment by Assembla Importer [ 24/Aug/10 4:38 PM ] |
|
stu said: Seems like a reasonable idea, but this is going to get back-burnered for now, unless there is a dire use case we have missed. |
[CLJ-5] Unintuitive error response in clojure 1.0 Created: 17/Jun/09 Updated: 28/Apr/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Incomplete |
| Description |
|
The following broken code: (let [[x y] {}] x) provides the following stack trace: Exception in thread "main" java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap (test.clj:0) The message "nth not supported on this type" while correct doesn't make the cause of the error very clear. Better error messages when destructuring would be very helpful. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 10:44 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/5 |
| Comment by Eugene Koontz [ 11/Nov/11 7:36 PM ] |
|
Please see the attached patch which produces a (hopefully more clear) error message as shown below (given the broken code shown in the original bug report): Clojure 1.4.0-master-SNAPSHOT
user=> (let [x 42 y 43] (+ x y))
85
user=> (let [[x y] {}] x)
UnsupportedOperationException left side of binding must be a symbol (found a PersistentVector instead). clojure.lang.Compiler.checkLet (Compiler.java:6545)
user=>
In addition, this patch checks the argument of (let) as shown below: user=> (let 42) UnsupportedOperationException argument to (let) must be a vector (found a Long instead). clojure.lang.Compiler.checkLet (Compiler.java:6553) |
| Comment by Eugene Koontz [ 11/Nov/11 7:38 PM ] |
|
Patch produced by doing git diff against commit ba930d95fc (master branch). |
| Comment by Eugene Koontz [ 13/Nov/11 11:24 PM ] |
|
Sorry, this patch is wrong: it assumes that the left side of the binding is wrong - the [x y] in : (let [[x y] {}] x)
because [x y] is a vector, when in fact, the left side is fine (per http://clojure.org/special_forms#let : "Clojure supports abstract structural binding, often called destructuring, in let binding lists".) So it's the right side (the {}) that needs to be checked and flagged as erroneous, not the [x y]. |
| Comment by Carin Meier [ 30/Nov/11 12:15 PM ] |
|
Add patch better-error-for-let-vector-map-binding This produces the following: (let [[x y] {}] x)
Exception map binding to vector is not supported
There are other cases that are not handled by this though — like binding vector to a set user=> (let [[x y] #{}] x)
UnsupportedOperationException nth not supported on this type: PersistentHashSet
Wondering if it might be better to try convert the map to a seq to support? Although this might be another issue. Thoughts? |
| Comment by Aaron Bedra [ 30/Nov/11 7:12 PM ] |
|
This seems too specific. Is this issue indicative of a larger problem that should be addressed? Even if this is the only case where bindings produce poor error messages, all the cases described above should be addressed in the patch. |
| Comment by Carin Meier [ 16/Dec/11 7:47 AM ] |
|
Unfortunately, realized that this still does not cover the nested destructuring cases. Coming to the conclusion, that my approach above is not going to work for this. |
| Comment by Carin Meier [ 28/Apr/12 10:46 PM ] |
|
File: clj-5-destructure-error.diff Added support for nested destructuring errors let [[[x1 y1][x2 y2]] [[1 2] {}]]
;=> UnsupportedOperationException let cannot destructure class clojure.lang.PersistentArrayMap.
|
[CLJ-821] should reify merge rather than replace on repeated specs? Created: 20/Jul/11 Updated: 09/Aug/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
reify, deftype, and the like fail silently if you specify a class twice: (macroexpand '(reify Map (size [this] 0), The later Map section entirely supersedes the former, which I discovered when I wrote a macro that injects some automated method bodies into a reify for you. I've attached a fix to make the above expand to the expected [for me, anyway] output. |
| Comments |
| Comment by Stuart Halloway [ 25/Jul/11 5:01 PM ] |
|
In Clojure, it is generally the case that redefining something replaces the original, as opposed to augmenting it by merging the old and the new. This makes it easy to reason locally about how code works. One could argue that the following snippet has the same kind of issue you describe: (defn foo [a] 1) (defn foo [a b] 1) (foo 1) ; is it a bug that the first arity is gone? I also wonder whether the current behavior might be a convenience for some macros. (Clearly it wasn't for yours!) I am changing the type and title of the ticket to better reflect the nature of the request and see what the BDFL says. |
| Comment by Rich Hickey [ 29/Jul/11 7:32 AM ] |
|
Everything in this ticket needs to be said with more precision. I don't know what exactly the problem is nor what the proposed solution is. One thing to note is that it is necessary to accept definitions under base interfaces, so the class areas are not strict, nor expected to be complete. |
| Comment by Alan Malloy [ 09/Aug/11 2:16 PM ] |
|
Stuart: The two foo forms you give are entirely separate, and to unify the two behaviors you would have to group them together. It's not at all unreasonable to suppose the user wants to define foo once, fiddle with it, and then redefine it - clojure.core does similar stuff with let, reduce, etc. As written, deftype/reify have a somewhat similar "look" - because there is nothing physically grouping the declaration of Map with its functions, it's not clear what should happen when a heading like Map is given twice, and it's not specified in the docs. I think the difference is that in the reify case, the two are in the same top-level form, so the compiler can detect that you're trying to do something "weird", so a silent redefinition (reasonable for your defn example) is surprising. There are a number of solutions that would reduce this surprise: 1) Permit or require reify to group things, as in (reify (Comparable (compare [this other] 1))). Then the explicit grouping of Comparable with its methods serves two purposes: it implies that other definitions for Comparable should be included in that grouping; and it makes it easier to do that, because you can just iterate over forms until you find Comparable, and then insert another definition. 2) Throw an exception if an interface is specified twice. This is not ideal because it can be a lot of work for the user to group things together themselves, while it's easy for deftype to do given the grouping it's already doing. However, it would avoid the confusion and surprise, by saying "that's not allowed" rather than leaving the user guessing what's gone wrong. 3) Interpret my original example code as an attempt to open the Map interface, add implementations, and then later add some more implementations. I would have liked reify to implement (1) to begin with, but at this point I don't think the syntax is backwards-compatible, so it doesn't seem like a good idea. I suppose either (2) or (3) is fine, and they both seem like an improvement over the current confusing behavior. Of course, I prefer (3), but I can understand a desire to make reify reject syntax that is not immediately obvious in intent rather than interpreting it as what I think is the most useful intent. |
[CLJ-99] GC Issue 95: max-key and min-key evaluate k multiple times for arguments Created: 17/Jun/09 Updated: 15/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
Reported by H.Duerer, Mar 13, 2009 max-key or min-key will evaluate (k value) multiple times for arguments if more than 2 arguments are passed. This is undesirable if k is expensive to calculate. Something like the code below would avoid these double calculations (at the price of generating more ephemeral garbage) (defn max-key "Returns the x for which (k x), a number, is greatest." ([k x] x) ([k x y] (if (> (k x) (k y)) x y)) ([k x y & more] (second (reduce (fn [x y] (if (> (first x) (first y)) x y)) (map #(vector (k %) %) (cons x (cons y more))))))) |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 5:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/99 |
| Comment by Assembla Importer [ 24/Aug/10 5:45 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Andy Fingerhut [ 15/Nov/12 9:36 PM ] |
|
clj-99-min-key-max-key-performance-v1.txt dated Nov 15 2012 changes min-key and max-key to evaluate the function k on each of its other arguments at most once. |
[CLJ-771] Move unchecked-prim casts to clojure.unchecked Created: 07/Apr/11 Updated: 13/Feb/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Backlog |
| Fix Version/s: | Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Alexander Taggart | Assignee: | Alexander Taggart |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Incomplete |
| Waiting On: | Rich Hickey |
| Description |
|
Per Rich's comment in
|
| Comments |
| Comment by Alexander Taggart [ 29/Apr/11 3:41 PM ] |
|
Requires that patch on |
| Comment by Stuart Sierra [ 31/May/11 10:43 AM ] |
|
Applies on master as of commit 66a88de9408e93cf2b0d73382e662624a54c6c86 |
| Comment by Rich Hickey [ 09/Dec/11 8:40 AM ] |
|
still considering when to incorporate this |
| Comment by John Szakmeister [ 19/May/12 9:36 AM ] |
|
v2 of the patch applies to master as of commit eccde24c7fb63679f00c64b3c70c03956f0ce2c3 |
| Comment by Andy Fingerhut [ 07/Sep/12 12:40 AM ] |
|
Patch clj-771-move-unchecked-casts-patch-v3.txt dated Sep 6 2012 is the same as Alexander Taggart's patch move-unchecked-casts.patch except that it has been updated to apply cleanly to latest Clojure master. |
| Comment by Andy Fingerhut [ 20/Oct/12 12:18 PM ] |
|
Patch clj-771-move-unchecked-casts-patch-v4.txt dated Oct 20 2012 is the same as Alexander Taggart's patch move-unchecked-casts.patch except that it has been updated to apply cleanly to latest Clojure master. |
| Comment by Andy Fingerhut [ 01/Jan/13 11:37 AM ] |
|
The patch clj-771-move-unchecked-casts-patch-v4.txt applies cleanly to latest master and passes all tests. Rich marked this ticket as Incomplete on Dec 9 2011 with the comment "still considering when to incorporate this" above. Is it reasonable to change it back to Vetted or Screened so it can be considered again, perhaps after Release 1.5 is made? |
| Comment by Andy Fingerhut [ 13/Feb/13 12:50 AM ] |
|
Patch clj-771-move-unchecked-casts-patch-v5.txt dated Feb 12 2013 is the same as Alexander Taggart's patch move-unchecked-casts.patch except that it has been updated to apply cleanly to latest Clojure master. |
[CLJ-308] protocol-ize with-open Created: 21/Apr/10 Updated: 13/Apr/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Good use (and documentation example) of protocols: make with-open aware of a Closable protocol for APIs that use a different close convention. See http://groups.google.com/group/clojure/browse_thread/thread/86c87e1fc4b1347c |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 4:39 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/308 |
| Comment by Tassilo Horn [ 23/Dec/11 5:11 AM ] |
|
Added a CloseableResource protocol and extended it on java.io.Closeable (implemented by all Readers, Writers, Streams, Channels, Sockets). Use it in with-open. All tests pass. |
| Comment by Tassilo Horn [ 23/Dec/11 7:14 AM ] |
|
Seems to be related to Scopes (http://dev.clojure.org/jira/browse/CLJ-2). |
| Comment by Tassilo Horn [ 08/Mar/12 3:59 AM ] |
|
Updated patch. |
| Comment by Andy Fingerhut [ 02/Apr/12 12:11 PM ] |
|
Patch 0001-Added-ClosableResource-protocol-for-with-open.patch dated 08/Mar/12 applies, builds, and tests cleanly on latest master as of Apr 2 2012. Tassilo has signed a CA. |
| Comment by Tassilo Horn [ 13/Apr/12 11:23 AM ] |
|
Updated patch to apply cleanly against master again. |
[CLJ-107] GC Issue 103: bit-count function Created: 17/Jun/09 Updated: 15/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
Reported by a...@thened.net, Apr 08, 2009 I posted this small patch to the mailing list last week but received no feedback, so I'm attaching it here to make sure it doesn't get lost. I have submitted a CA. http://groups.google.com/group/clojure/browse_thread/thread/4345f76a12bac6fe/ The new function bit-count returns the count of 1-bits in a number, like C's popcount or Common Lisp's logcount. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/107 |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
oranenj said: [file:dqone2w4er3RbzeJe5afGb] |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Andy Fingerhut [ 15/Nov/12 8:40 PM ] |
|
clj-107-add-bit-count-v1.txt is probably a correct updated version of the old patch linked above. Added a couple of unit tests. |
[CLJ-445] Method/Constructor resolution does not factor in widening conversion of primitive args Created: 29/Sep/10 Updated: 20/Feb/12 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Reviewed Backlog |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alexander Taggart | Assignee: | Alexander Taggart |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Approval: | Incomplete |
| Description |
|
Problem: Examples: user=> (Integer. (byte 0)) java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Integer (NO_SOURCE_FILE:0) </code></pre> The above occurs because there is no Integer(byte) constructor, though it should match on Integer(int). <pre><code>user=> (bit-shift-left (byte 1) 1) Reflection warning, NO_SOURCE_PATH:3 - call to shiftLeft can't be resolved. 2 In the above, a call is made via reflection to Numbers.shiftLeft(Object, Object) and its associated auto-boxing, instead of directly to the perfectly adequate Numbers.shiftLeft(long, int). Workarounds: Ancillary benefits of fixing: |
| Comments |
| Comment by Assembla Importer [ 23/Oct/10 6:43 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/445 |
| Comment by Assembla Importer [ 23/Oct/10 6:43 PM ] |
|
ataggart said: [file:b6gDSUZOur36b9eJe5cbCb] |
| Comment by Assembla Importer [ 23/Oct/10 6:43 PM ] |
|
ataggart said: Also fixes #446. |
| Comment by Stuart Halloway [ 03/Dec/10 12:50 PM ] |
|
The patch is causing a test failure [java] Exception in thread "main" java.lang.IllegalArgumentException:
More than one matching method found: equiv, compiling:(clojure/pprint/cl_format.clj:428)
Can you take a look? |
| Comment by Stuart Halloway [ 28/Jan/11 12:30 PM ] |
|
The failing test happens when trying to find the correct equiv for signature (Number, long). Is the compiler wrong to propose this signature, or is the resolution method wrong in not having an answer? (It thinks two signatures are tied: (Object, long) and (Number, Number).) Exception in thread "main" java.lang.IllegalArgumentException: More than one matching method found: equiv, compiling:(clojure/pprint/cl_format.clj:428) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6062) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6050) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.access$100(Compiler.java:35) at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:5492) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6043) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6043) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$IfExpr$Parser.parse(Compiler.java:2372) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6043) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3277) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6057) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5231) at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:5527) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6043) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5231) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$IfExpr$Parser.parse(Compiler.java:2385) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5231) at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:5527) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6043) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$IfExpr$Parser.parse(Compiler.java:2385) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5231) at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:5527) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6043) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5231) at clojure.lang.Compiler$FnMethod.parse(Compiler.java:4667) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3397) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6053) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6043) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.access$100(Compiler.java:35) at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:480) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler.eval(Compiler.java:6114) at clojure.lang.Compiler.load(Compiler.java:6545) at clojure.lang.RT.loadResourceScript(RT.java:340) at clojure.lang.RT.loadResourceScript(RT.java:331) at clojure.lang.RT.load(RT.java:409) at clojure.lang.RT.load(RT.java:381) at clojure.core$load$fn__1427.invoke(core.clj:5308) at clojure.core$load.doInvoke(core.clj:5307) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.pprint$eval3969.invoke(pprint.clj:46) at clojure.lang.Compiler.eval(Compiler.java:6110) at clojure.lang.Compiler.load(Compiler.java:6545) at clojure.lang.RT.loadResourceScript(RT.java:340) at clojure.lang.RT.loadResourceScript(RT.java:331) at clojure.lang.RT.load(RT.java:409) at clojure.lang.RT.load(RT.java:381) at clojure.core$load$fn__1427.invoke(core.clj:5308) at clojure.core$load.doInvoke(core.clj:5307) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.core$load_one.invoke(core.clj:5132) at clojure.core$load_lib.doInvoke(core.clj:5169) at clojure.lang.RestFn.applyTo(RestFn.java:143) at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:77) at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28) at clojure.core$apply.invoke(core.clj:602) at clojure.core$load_libs.doInvoke(core.clj:5203) at clojure.lang.RestFn.applyTo(RestFn.java:138) at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:77) at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28) at clojure.core$apply.invoke(core.clj:604) at clojure.core$use.doInvoke(core.clj:5283) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.main$repl.doInvoke(main.clj:196) at clojure.lang.RestFn.invoke(RestFn.java:422) at clojure.main$repl_opt.invoke(main.clj:267) at clojure.main$main.doInvoke(main.clj:362) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.lang.Var.invoke(Var.java:401) at clojure.lang.AFn.applyToHelper(AFn.java:163) at clojure.lang.Var.applyTo(Var.java:518) at clojure.main.main(main.java:37) Caused by: java.lang.IllegalArgumentException: More than one matching method found: equiv at clojure.lang.Reflector.getMatchingParams(Reflector.java:639) at clojure.lang.Reflector.getMatchingParams(Reflector.java:578) at clojure.lang.Reflector.getMatchingMethod(Reflector.java:569) at clojure.lang.Compiler$StaticMethodExpr.<init>(Compiler.java:1439) at clojure.lang.Compiler$HostExpr$Parser.parse(Compiler.java:896) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) ... 115 more |
| Comment by Alexander Taggart [ 08/Feb/11 6:27 PM ] |
|
In working on implementing support for vararg methods, I found a number of flaws with the previous solutions. Please disregard them. I've attached a single patch (reflector-compiler-numbers.diff) which is a rather substantial overhaul of the Reflector code, with some enhancements to the Compiler and Numbers code. The patch notes:
|
| Comment by Alexander Taggart [ 10/Feb/11 7:35 PM ] |
|
Updated patch to fix a bug where a concrete class with multiple identical Methods (e.g., one from an interface, another from an abstract class) would result in ambiguity. Now resolved by arbitrary selection (this is what the original code did as well albeit not explicitly). |
| Comment by Alexander Taggart [ 25/Feb/11 9:29 PM ] |
|
Updated patch to work with latest master branch. |
| Comment by Stuart Halloway [ 06/Mar/11 1:54 PM ] |
|
patch appears to be missing test file clojure/test_clojure/reflector.clj. |
| Comment by Alexander Taggart [ 06/Mar/11 2:39 PM ] |
|
Bit by git. Patch corrected to contain clojure.test-clojure.reflector. |
| Comment by Stuart Halloway [ 11/Mar/11 10:30 AM ] |
|
Rich: I verified that the patch applied but reviewed only briefly, knowing you will want to go over this one closely. |
| Comment by Stuart Halloway [ 11/Mar/11 10:55 AM ] |
|
After applying this patch, I am getting method missing errors: java.lang.NoSuchMethodError: clojure.lang.Numbers.lt(JLjava/lang/Object;)
but only when using compiled code, e.g. the same code works in the REPL and then fails after compilation. Haven't been able to isolate an example that I can share here yet, but hoping this will cause someone to have an "a, hah" moment... |
| Comment by Alexander Taggart [ 02/Apr/11 12:55 PM ] |
|
The patch now contains only the minimal changes needed to support widening conversion. Cleanup of Numbers overloads, etc., can wait until this patch gets applied. The vararg support is in a separate patch on CLJ-440. |
| Comment by Christopher Redinger [ 15/Apr/11 12:50 PM ] |
|
Please test patch |
| Comment by Christopher Redinger [ 21/Apr/11 11:02 AM ] |
|
FYI: Patch applies cleanly on master and all tests pass as of 4/21 (2011) |
| Comment by Christopher Redinger [ 22/Apr/11 9:57 AM ] |
|
This work is too big to take into the 1.3 beta right now. We'll revisit for a future release. |
| Comment by Alexander Taggart [ 28/Apr/11 1:19 PM ] |
|
To better facilitate understanding of the changes, I've broken them up into two patches, each with a number of isolable, incremental commits: reorg-reflector.patch: Moves the reflection/invocation code from Compiler to Reflector, and eliminates redundant code. The result is a single code base for resolving methods/constructors, which will allow for altering that mechanism without excess external coordination. This contains no behaviour changes. prim-conversion.patch: Depends on the above. Alters the method/constructor resolution process:
This also provides a base to add further features, e.g., CLJ-666. |
| Comment by Alexander Taggart [ 29/Apr/11 3:01 PM ] |
|
It's documented in situ, but here are the conversion rules that the reflector uses to find methods:
|
| Comment by Alexander Taggart [ 10/May/11 3:13 PM ] |
|
prim-conversion-update-1.patch applies to current master. |
| Comment by Alexander Taggart [ 11/May/11 2:15 PM ] |
|
Created CLJ-792 for the reflector reorg. |
| Comment by Stuart Sierra [ 17/Feb/12 2:29 PM ] |
|
prim-conversion-update-1.patch does not apply as of f5bcf64. Is CLJ-792 now a prerequisite of this ticket? |
| Comment by Alexander Taggart [ 17/Feb/12 3:15 PM ] |
|
Yes, after the original patch was deemed "too big". After this much time with no action from TPTB, feel free to kill both tickets. |
| Comment by Andy Fingerhut [ 20/Feb/12 2:04 PM ] |
|
Again, not sure if this is any help, but I've tested starting from Clojure head as of Feb 20, 2012, applying clj-792-reorg-reflector-patch2.txt attached to CLJ-792, and then applying clj-445-prim-conversion-update-2-patch.txt attached to this ticket, and the result compiles and passes all but 2 tests. I don't know whether those failures are easy to fix or not, or whether issues may have been introduced with these patches. |
[CLJ-862] pmap level of parallelism inconsistent for chunked vs non-chunked input Created: 23/Oct/11 Updated: 20/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.1, Release 1.2, Release 1.3, Release 1.4 |
| Fix Version/s: | Reviewed Backlog |
| Type: | Defect | Priority: | Minor |
| Reporter: | Marshall T. Vandegrift | Assignee: | Jim Blomo |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
The code of pmap creates futures for the set of map operations it needs to perform with (map #(future %) coll), then acts on that sequence in a fashion obviously intended to keep only #CPUs+2 unfinished futures realized at any given time. It works exactly this way for non-chunked input seqs, but when pmap is passed a chunked seq, the seq of futures also becomes chunked. This causes an arbitrary number of futures to be realized as the #CPUs+2 window and chunk-size window interact. The doc-string for pmap doesn't promise any particular level of parallelism, but I think the inconsistent parallelism for chunked vs non-chunked input comprises a bug. |
| Comments |
| Comment by Stuart Halloway [ 25/Oct/11 6:51 PM ] |
|
Next person to take a deep look at pmap should probably also think through fork/join. |
| Comment by Jim Blomo [ 19/May/12 12:31 AM ] |
|
fork/join is a Java 7 feature. Would a proposed patch need to be able to fall back to Java 5 features? |
| Comment by Andy Fingerhut [ 19/May/12 1:06 AM ] |
|
Clojure/core folks can say more authoritatively, but I believe with the recent reduce enhancements that rely on jsr166 code, Clojure 1.5 will most likely require Java 6 or later, and Java 5 will no longer be supported. |
| Comment by Jim Blomo [ 28/May/12 5:29 PM ] |
|
Spinning up more threads than CPU cores is not a good idea when the work is CPU bound. Currently (1.4) pmap uses an unbounded thread pool, so chunked sequences will create more threads than intended. The least invasive change is to use a fixed sized thread pool (ForkJoinPool being one example). pmap is differentiated from core.reducers by the fact that it is lazy. This implies a one-at-a-time ThreadPool.submit model, instead of the recursive fork/join model. Tradeoffs include: Enforce look-ahead even on chunked sequences:
Move to a fixed size thread pool:
Use ForkJoinPool for fixed thread pool (instead of newFixedThreadPool):
I think using a traditional fixed size thread pool is the right option. Most of the time all of pmap's results will be realized, so I don't think it's worth saving work by being strict about the look-ahead size. This is also the decision map has made. Since we're not using ForkJoin's main strength (recursive work queuing), I don't think it is worth setting it up in clojure.core. I'll use Agent/pooledExecutor as the fixed size thread. Let me know if I forgot or misunderstood anything. |
| Comment by Jim Blomo [ 28/May/12 7:59 PM ] |
|
2012-05-28 pmap-chunking-862.diff uses a fixed size thread pool for pmap functions. |
[CLJ-891] make (symbol foo "bar") work with foo being a namespace Created: 05/Dec/11 Updated: 02/Mar/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Reviewed Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Joe Gallo | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
I've run across the need to do (symbol ns "bar") a few times, and the existing approach (symbol (name (ns-name ns)) "bar") just doesn't seem like it ought to be the only way to do the job. Includes a patch to make this work, by adding a new arity to Symbol.intern(). Some discussion on this idea, here: https://groups.google.com/forum/#!topic/clojure/n25aZ5HA7hc/discussion |
| Comments |
| Comment by Stuart Halloway [ 09/Dec/11 9:39 AM ] |
|
I am not sure I like this, but I would like a rethink of names and namespaces. Doing a lot of cross language work, it would be great to have protocols for "I have a name" and for "I have a namespace". With such protocols in place, it would also be possible to separately consider implementing symbol et al in terms of them. |
| Comment by Kevin Downey [ 09/Dec/11 12:24 PM ] |
|
Named being a protocol or an interface seems orthogonal to being able to create a symbol qualified with a namespace when you have a namespace in hand. I don't think the patch goes far enough, not only should (symbol ns "foo") be supported, but also (symbol ns 'foo), given that (symbol 'foo) works and (symbol "foo") works, (symbol 'bar 'foo) should also work, but doesn't. if Named is a protocol, and if you extend it to String, and if you make the symbol function create symbols from one or two Named things you still end up having to do (symbol (ns-name ns) 'foo) or (symbol (ns-name ns) "foo") |
| Comment by Joe Gallo [ 16/Dec/11 4:18 PM ] |
|
Stuart, I'm not opposed to the idea of separate protocols for Named and Namespaced. Where should I go about creating a proposal to create those protocols and get them into clojure? I'm interested in doing the leg-work, or being a part of it. But as an outsider, I don't know what to do next – creating a ticket in Jira exhausted my knowledge of the process. |
| Comment by Frank Siebenlist [ 02/Mar/12 4:53 PM ] |
|
The same enhancement that joe suggests for symbol, would also apply to keyword. See: http://groups.google.com/group/clojure/browse_thread/thread/222e4abc16df8b20 Probably same/similar solution applies to both issues. -FrankS. |
[CLJ-889] Specifically allow '.' inside keywords Created: 01/Dec/11 Updated: 15/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Reviewed Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Howard Lewis Ship | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | keywords, reader | ||
| Description |
|
The documentation for keywords (on page http://clojure.org/reader) specifically states that '.' is not allowed as part of a keyword name; however '.' is specifically useful. For example, several web frameworks for Clojure use keywords to represent HTML elements, using CSS selector syntax (i.e., :div.important is equivalent to <div class='important'>). In any case, the use of '.' is not checked by the reader and it is generally useful. I would like to see '.' officially allowed (in the documentation). Further, I'd like to see additional details about which punctuation characters are allowed (my own web framework uses '&', '?' and '>' inside keywords for various purposes ... again, current reader implementation does not forbid this, but if a future reader will reject it, I'd like to know now). |
| Comments |
| Comment by Howard Lewis Ship [ 08/Dec/11 3:37 PM ] |
|
To clarify, Hiccup and Cascade both use keywords containing '#' and '.' Cascade goes further, using '&' (to represent HTML entities), '>', and (possibly in the future) '?'. |
| Comment by Devin Walters [ 20/Oct/12 6:46 PM ] |
|
I think the EDN spec mitigates some of the concern, but as of yet the official clojure.org reader documentation does not reflect the language used in the description of EDN. Where does EDN stand right now? Can the description being used on the github page be pulled over to clojure.org? References:
|
| Comment by Howard Lewis Ship [ 15/Apr/13 5:56 AM ] |
|
Unfortunately, the EDN specification does not mention '>'. |
[CLJ-1154] Compile.java closes out preventing java from reporting exceptions Created: 31/Jan/13 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | Release 1.5, Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Robert (Bobby) Evans | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
I was trying to compile a project that has some native dependencies. I am using clojure-maven-plugin version 1.3.13 with Maven 2.0. I forgot to set java.library.path properly so that the native library could be found, and only got an error of [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Clojure failed. [INFO] ------------------------------------------------------------------------ I traced this down to Compile.java, where it is flushing and closing out |
| Comments |
| Comment by Stuart Halloway [ 01/Mar/13 10:45 AM ] |
|
I have encountered this problem as well. Did not verify the explanation, but sounds reasonable. |
[CLJ-944] compiler makes different concrete maps then the reader Created: 04/Mar/12 Updated: 24/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4, Release 1.5 |
| Fix Version/s: | Release 1.5, Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Alf Kristian Støyle | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
Clojure 1.3 om Mac OS 10.7, Clojure 1.5.0 alpha1 on Linux x86_64 (OpenJDK 1.7.0 b147) |
||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Screened |
| Description |
|
I (Stu) agree with Nicola's assessment in the comments: the single real problem here is that the compiler's MapExpr parser emits maps differently from other map-makers, e.g. RT's factory functions. Patch clj944-plus-tests does three things:
Original report follows: Hi guys, I am getting the following exception: (.containsKey {:one 1} :one)
;=> ClassCastException clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.PersistentHashMap
The map is a clojure.lang.PersistentArrayMap, which obviously has a containsKey method (https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentArrayMap.java#L95). Casting it works fine though: (.containsKey ^clojure.lang.PersistentArrayMap {:one 1} :one)
;=> true
The mailing list suggest that the compiler injects an incorrect cast to clojure.lang.PersistentHashMap. In this case it should probably be cast to a clojure.lang.Associative, the highest common interface having the .containsKey method. The problem is not present in Clojure 1.2.1. |
| Comments |
| Comment by Nicola Mometto [ 30/Oct/12 5:02 PM ] |
|
The attached patch fixes the issue, by emitting IPersistentMap instead of Persistent{Hash|Array}Map as class type for maps literals |
| Comment by Nicola Mometto [ 01/Nov/12 3:48 PM ] |
|
I uploaded another patch fixing the same problem in a different way. This approach is more consistent, making the type of the compiler's internal representation of a map literal equal to the one of the reader. Note that this second approach while being more consistent, breaks some tests that assume some operations on maps (specifically `seq` and `print`) to be order dependent, and written with the hash-map return order implementation in mind. That should not be the case and if the second patch is preferred over the first one, I'll gladly fix those tests. |
| Comment by Stuart Halloway [ 01/Mar/13 12:09 PM ] |
|
Approach #2, relying on consistent choice of concrete map class by size throughout, feels quite fragile. Approach #1 seems to abuse the method name getJavaClass(), now having it return "get the base type I would need for cast". Maybe there needs to be a different thing entirely? |
| Comment by Nicola Mometto [ 01/Mar/13 2:17 PM ] |
|
Patch #2 should get merged (IMHO) regardless of the fragility of its approach to fixing this ticket's bug, since it fixes another bug: prior to the patch: user=> (class {:a 1}) after the patch: user=> (class {:a 1}) This should also lead to some minor performance enhancement since prior to this moment, every map def'ed would be a HashMap instead of an ArrayMap So, I think patch #2 should be applied if not for this ticket's bug, at least for the reason stated above. |
| Comment by Rich Hickey [ 13/Apr/13 9:41 AM ] |
|
This should not have passed screening. There are two issues, should be separate. I have no idea what has been screened nor what will be applied should it be approved. There's contention in the discussion but no resolution. |
| Comment by Nicola Mometto [ 13/Apr/13 12:06 PM ] |
|
I don't think that there are two issues here. The underlying cause of those two symtoms is fixed by the patch 002 that i submitted (incorporated in Stu's clj944-plus-tests patch. Stuart said that this approach feels fragile but the bug is caused by the fact that everywhere else clojure returns a PersistentArrayMap when the element count is <= than the PersistentHashMap threshold, and when emitting maps, it doesn't. Making clojure emit maps consistently with how clojure does internally everywhere else looks to me like the only solution, and I don't really see how making clojure consistent is a fragile approach. But again, if somebody can suggest a better solution to this problem, I'll gladly submit another patch. |
[CLJ-1161] sources jar has bad versions.properties resource Created: 11/Feb/13 Updated: 24/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | Release 1.5, Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Steve Miner | Assignee: | Stuart Halloway |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | patch | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Screened |
| Description |
|
Summary: patch leaves version.properties file out of sources JAR, where it causes problems for tools. The "sources" jar (at least since Clojure 1.4 and including 1.5 RC) has a bad version.properties file in it. The resource clojure/version.properties is literally: version=${version} The regular Clojure jar has the correct version string in that resource. I came across a problem when I was experimenting with the sources jar (as used by IDEs). I naively added the sources jar to my classpath, and Clojure died on start up. The bad clojure/versions.properties file was found first, which led to a parse error as the clojure version was being set. |
| Comments |
| Comment by Steve Miner [ 11/Feb/13 10:04 AM ] |
|
Notes from the dev mailing list: The "sources" JAR is generated by another Maven plugin, configured here: The simplest solution might be to just exclude the file from the sources jar. It looks like maven-source-plugin has an excludes option which would do the trick: http://maven.apache.org/plugins/maven-source-plugin/jar-mojo.html#excludes |
[CLJ-949] let undeclared exceptions continue unchecked Created: 07/Mar/12 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Backlog |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Brian Taylor | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
The recent modifications regarding checked exceptions have eliminated the need for several try/catch blocks. This commit removes the blocks that no longer serve a purpose. |
| Comments |
| Comment by Andy Fingerhut [ 09/Mar/12 9:06 AM ] |
|
Patch 0001-let-undeclared-exceptions-continue-unchecked.patch applies cleanly to latest master as of March 9, 2012, and build and test without errors or warnings. One author, Brian Taylor, has signed CA. |
[CLJ-1005] Use transient map in zipmap Created: 30/May/12 Updated: 11/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.6 |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Michał Marczyk | Assignee: | Aaron Bedra |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
The attached patch changes zipmap to use a transient map internally. The definition is also moved so that it resides below that of #'transient. The original definition is commented out (like that of #'into). |
| Comments |
| Comment by Aaron Bedra [ 14/Aug/12 9:24 PM ] |
|
Why is the old implementation left and commented out? If we are going to move to a new implementation, the old one should be removed. |
| Comment by Michał Marczyk [ 15/Aug/12 4:17 AM ] |
|
As mentioned in the ticket description, the previously attached patch follows the pattern of into whose non-transient-enabled definition is left in core.clj with a #_ in front – I wasn't sure if that's something desirable in all cases. Here's a new patch with the old impl removed. |
| Comment by Andy Fingerhut [ 15/Aug/12 10:37 AM ] |
|
Thanks for the updated patch, Michal. Sorry to raise such a minor issue, but would you mind using a different name for the updated patch? I know JIRA can handle multiple attached files with the same name, but my prescreening code isn't quite that talented yet, and it can lead to confusion when discussing patches. |
| Comment by Michał Marczyk [ 15/Aug/12 10:42 AM ] |
|
Thanks for the heads-up, Andy! I've reattached the new patch under a new name. |
| Comment by Andy Fingerhut [ 16/Aug/12 8:24 PM ] |
|
Presumptuously changing Approval from Incomplete back to None after the Michal's updated patch was added, addressing the reason the ticket was marked incomplete. |
| Comment by Aaron Bedra [ 11/Apr/13 5:32 PM ] |
|
The patch looks good and applies cleanly. Are there additional tests that we should run to verify that this is providing the improvement we think it is. Also, is there a discussion somewhere that started this ticket? There isn't a lot of context here. |
| Comment by Michał Marczyk [ 11/Apr/13 6:19 PM ] |
|
Hi Aaron, Thanks for looking into this! From what I've been able to observe, this change hugely improves zipmap times for large maps. For small maps, there is a small improvement. Here are two basic Criterium benchmarks (transient-zipmap defined at the REPL as in the patch): ;;; large map
user=> (def xs (range 16384))
#'user/xs
user=> (last xs)
16383
user=> (c/bench (zipmap xs xs))
Evaluation count : 13920 in 60 samples of 232 calls.
Execution time mean : 4.329635 ms
Execution time std-deviation : 77.791989 us
Execution time lower quantile : 4.215050 ms ( 2.5%)
Execution time upper quantile : 4.494120 ms (97.5%)
nil
user=> (c/bench (transient-zipmap xs xs))
Evaluation count : 21180 in 60 samples of 353 calls.
Execution time mean : 2.818339 ms
Execution time std-deviation : 110.751493 us
Execution time lower quantile : 2.618971 ms ( 2.5%)
Execution time upper quantile : 3.025812 ms (97.5%)
Found 2 outliers in 60 samples (3.3333 %)
low-severe 2 (3.3333 %)
Variance from outliers : 25.4675 % Variance is moderately inflated by outliers
nil
;;; small map
user=> (def ys (range 16))
#'user/ys
user=> (last ys)
15
user=> (c/bench (zipmap ys ys))
Evaluation count : 16639020 in 60 samples of 277317 calls.
Execution time mean : 3.803683 us
Execution time std-deviation : 88.431220 ns
Execution time lower quantile : 3.638146 us ( 2.5%)
Execution time upper quantile : 3.935160 us (97.5%)
nil
user=> (c/bench (transient-zipmap ys ys))
Evaluation count : 18536880 in 60 samples of 308948 calls.
Execution time mean : 3.412992 us
Execution time std-deviation : 81.338284 ns
Execution time lower quantile : 3.303888 us ( 2.5%)
Execution time upper quantile : 3.545549 us (97.5%)
nil
Clearly the semantics are preserved provided transients satisfy their contract. I think I might not have started a ggroup thread for this, sorry. |
[CLJ-701] Compiler loses 'loop's return type in some cases Created: 03/Jan/11 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Chouser | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Clojure commit 9052ca1854b7b6202dba21fe2a45183a4534c501, version 1.3.0-master-SNAPSHOT |
||
| Approval: | Vetted |
| Description |
(set! *warn-on-reflection* true)
(fn [] (loop [b 0] (recur (loop [a 1] a))))
Generates the following warnings: recur arg for primitive local: b is not matching primitive, had: Object, needed: long Auto-boxing loop arg: b This is interesting for several reasons. For one, if the arg to recur is a let form, there is no warning: (fn [] (loop [b 0] (recur (let [a 1] a)))) Also, the compiler appears to understand the return type of loop forms just fine: (use '[clojure.contrib.repl-utils :only [expression-info]])
(expression-info '(loop [a 1] a))
;=> {:class long, :primitive? true}
The problem can of course be worked around using an explicit cast on the loop form: (fn [] (loop [b 0] (recur (long (loop [a 1] a)))))
Reported by leafw in IRC: http://clojure-log.n01se.net/date/2011-01-03.html#10:31 |
| Comments |
| Comment by a_strange_guy [ 03/Jan/11 4:36 PM ] |
|
The problem is that a 'loop form gets converted into an anonymous fn that gets called immediately, when the loop is in a expression context (eg. its return value is needed, but not as the return value of a method/fn). so (fn [] (loop [b 0] (recur (loop [a 1] a)))) gets converted into (fn [] (loop [b 0] (recur ((fn [] (loop [a 1] a)))))) see the code in the compiler: this conversion already bites you if you have mutable fields in a deftype and want to 'set! them in a loop |
| Comment by Christophe Grand [ 23/Nov/12 2:28 AM ] |
|
loops in expression context are lifted into fns because else Hotspot doesn't optimize them.
Adressing all those problems isn't easy. [1] beware of |
[CLJ-1058] StackOverflowError on exception in reducef for PersistentHashMap fold Created: 02/Sep/12 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Tom Jack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Clojure 1.5.0-alpha4, Sun Java 1.6.0_35, with [org.codehaus.jsr166-mirror/jsr166y "1.7.0"] |
||
| Approval: | Vetted |
| Description |
|
If reducef throws an exception, the PHM fold code can descend into an infinite loop, causing a stack overflow which masks the problem. This situation is commented "aargh" in PersistentHashMap.java line 444 (as of 412a51d). To reproduce: user> (require '[clojure.core.reducers :as r])
nil
user> (r/fold (fn ([]) ([ret k v] (+ 3 "foo") ret)) (into {} (map (juxt identity identity) (range 10000))))
;; boom
This results in a stack like: https://raw.github.com/gist/3bab917287a7fd635a84/f38bfe3e270556e467f3fc02062af7ea10781390/gistfile1.txt |
| Comments |
| Comment by Timothy Baldridge [ 30/Nov/12 3:40 PM ] |
|
Verified as a bug. |
[CLJ-420] Some compiler exceptions erroneously using REPL line numbers. Created: 08/Aug/10 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Alexander Redington | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but what seems to be the REPL line number. jawolfe@[~/Projects/testproj]: cat > src/test.clj bla (bla) |
| Comments |
| Comment by Assembla Importer [ 28/Sep/10 9:59 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/420 |
| Comment by Assembla Importer [ 28/Sep/10 9:59 PM ] |
|
stu said: Updating tickets (#427, #426, #421, #420, #397) |
| Comment by Assembla Importer [ 28/Sep/10 9:59 PM ] |
|
stu said: Updating tickets (#429, #437, #397, #420) |
[CLJ-124] GC Issue 120: Determine mechanism for controlling automatic shutdown of Agents, with a default policy and mechanism for changing that policy as needed Created: 17/Jun/09 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Chas Emerick |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Approval: | Vetted |
| Waiting On: | Rich Hickey |
| Description |
Reported by cemer...@snowtide.com, Jun 01, 2009 There has been intermittent chatter over the past months from a couple of people on the group (e.g. http://groups.google.com/group/clojure/browse_thread/thread/409054e3542adc1f) and in #clojure about some clojure scripts hanging, either for a constant time (usually reported as a minute or so with no CPU util) or seemingly forever (or until someone kills the process). I just hit a similar situation in our compilation process, which invokes clojure.lang.Compile from ant. The build process for this particular project had taken 15 second or so, but after adding a couple of pmap calls, that build time jumped to ~1:15, with roughly zero CPU utilization over the course of that last minute. Adding a call to Agent.shutdown() in the finally block in clojure.lang.Compile/main resolved the problem; a patch including this change is attached. I wouldn't suspect anyone would have any issues with such a change. ----- In general, it doesn't seem like everyone should keep tripping over this problem in different directions. It's a very difficult thing to debug if you're not attuned to how clojure's concurrency primitives work under the hood, and I would bet that newer users would be particularly affected. After discussion in #clojure, rhickey suggested adding a *auto-shutdown-agents* var, which: - if true when exiting one of the main entry points (clojure.main, or the legacy script/repl entry points), Agent.shutdown() would be called, allowing for the clean exit of the application - would be bound by default to true - could be easily set to false for anyone with an advanced use-case that requires agents to remain active after the main thread of the application exits. This would obviously not help anyone initializing clojure from a different entry point, but this may represent the best compromise between least-surprise and maximal functionality for advanced users. ------ In addition to the above, it perhaps might be worthwhile to change the keepalive values used to create the Threadpools used by c.l.Actor's Executors. Currently, Actor uses a default thread pool executor, which results in a 60s keepalive. Lowering this to something much smaller (1s? 5s?) would additionally minimize the impact of Agent's threadpools on Java applications that embed clojure directly (and would therefore not benefit from *auto-shutdown-agents* as currently conceived, leading to puzzling 'hanging' behaviour). I'm not in a position to determine what impact this would have on performance due to thread churn, but it would at least minimize what would be perceived as undesirable behaviour by users that are less familiar with the implementation details of Agent and code that depends on it. Comment 1 by cemer...@snowtide.com, Jun 01, 2009 Just FYI, I'd be happy to provide patches for either of the suggestions mentioned above... |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/124 |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
oranenj said: [file:a56S2ow4ur3O2PeJe5afGb] |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
cemerick said: (In [[r:fa3d24973fc415b35ae6ec8d84b61ace76bd4133]]) Add a call to Agent.shutdown() at the end of clojure.lang.Compile/main Refs #124 Signed-off-by: Chouser <chouser@n01se.net> Branch: master |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: I'm closing this ticket to because the attached patch solves a specific problem. I agree that the idea of an auto-shutdown-agents var sounds like a positive compromise. If Rich wants a ticket to track that issue, I think it'd be best to open a new ticket (and perhaps mention this one there) rather than use this ticket to track further changes. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
scgilardi said: With both Java 5 and Java 6 on Mac OS X 10.5 Leopard I'm getting an error when compiling with this change present. Java 1.5.0_19 For example, when building clojure using "ant" from within my clone of the clojure repo: [java] java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThread) I reproduced this on two Mac OS X 10.5 machines. I'm not aware of having any enhanced security policies along these lines on my machines. The compile goes fine for me with Java 1.6.0_0 on an Ubuntu box. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: I had only tested it on my ubuntu box – looks like that was openjdk 1.6.0_0. I'll test again with sun-java5 and sun-java6. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: 1.6.0_13 worked fine for me on ubuntu, but 1.5.0_18 generated an the exception Steve pasted. Any suggestions? Should this patch be backed out until someone has a fix? |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
achimpassen said: [file:aqn0IGxZSr3RUGeJe5aVNr] |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: With Achim's patch, clojure compiles for me on ubuntu using java 1.5.0_18 from sun, and still works on 1.6.0_13 sun and 1.6.0_0 openjdk. I don't know anything about ant or the security error, but this is looking good to me. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
achimpassen said: It works for me on 1.6.0_13 and 1.5.0_19 (32 and 64 bit) on OS X 10.5.7. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: (In [[r:895b39dabc17b3fd766fdbac3b0757edb0d4b60d]]) Rev fa3d2497 causes compile to fail on some VMs – back it out. Refs #124 Branch: master |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
mikehinchey said: I got the same compile error on both 1.5.0_11 and 1.6.0_14 on Windows. Achim's patch fixes both. See the note for "permissions" on http://ant.apache.org/manual/CoreTasks/java.html . I assume ThreadPoolExecutor.shutdown is the problem, it would shutdown the main Ant thread, so Ant disallows that. Forking avoids the permissions limitation. In addition, since the build error still resulted in "BUILD SUCCESSFUL", I think failonerror="true" should also be added to the java call so the build would totally fail for such an error. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: I don't know if the <java fork=true> patch is a good idea or not, or if there's a better way to solve the original problem. Chas, I'm kicking back to you, but I guess if you don't want it you can reassign to "nobody". |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
richhickey said: Updating tickets (#8, #42, #113, #2, #20, #94, #96, #104, #119, #124, #127, #149, #162) |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
shoover said: I'd like to suggest an alternate approach. There are already well-defined and intuitive ways to block on agents and futures. Why not deprecate shutdown-agents and force users to call await and deref if they really want to block? In the pmap situation one would have to evaluate the pmap form. The System.exit problem goes away if you configure the threadpools to use daemon threads (call new ThreadPoolExecutor and pass a thread factory that creates threads and sets daemon to true). That way the user has an explicit means of blocking and System.exit won't hang. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
alexdmiller said: I blogged about these issues at: I think that:
|
| Comment by Alexander Taggart [ 11/Jul/11 9:33 PM ] |
|
Rich, what is the intention behind using non-daemon threads in the agent pools? If it is because daemon threads could terminate before their work is complete, would it be acceptable to add a shutdown hook to ensure against such premature termination? Such a shutdown hook could call Agent.shutdown(), then awaitTermination() on the pools. |
| Comment by Christopher Redinger [ 27/Nov/12 3:47 PM ] |
|
Moving this ticket out of approval "OK" status, and dropping the priority. These were Assembla import defaults. Also, Chas gets to be the Reporter now. |
| Comment by Chas Emerick [ 27/Nov/12 5:56 PM ] |
|
Heh, blast from the past. The comment import appears to have set their timestamps to the date of the import, so the conversation is pretty hard to follow, and obviously doesn't benefit from the intervening years of experience. In addition, there have been plenty of changes to agents, including some recent enhancements that address some of the pain points that Alex Miller mentioned above. I propose closing this as 'invalid' or whatever, and opening one or more new issues to track whatever issues still persist (presumably based on fresh ML discussion, etc). |
| Comment by Andy Fingerhut [ 27/Nov/12 6:11 PM ] |
|
Rereading the original description of this ticket, without reading all of the comments that follow, that description is still right on target for the behavior of latest Clojure master today. People send messages to the Clojure Google group every couple of months hitting this issue, and one even filed CLJ-959 because of hitting it. I have updated the examples on ClojureDocs.org for future, and also for pmap and clojure.java.shell/sh which use future in their implementations, to warn people about this and explain that they should call (shutdown-agents), but making it unnecessary to call shutdown-agents would be even better, at least as the default behavior. It sounds fine to me to provide a way for experts on thread behavior to change that default behavior if they need to. |
[CLJ-866] Provide a clojure.test function to run a single test case with fixtures Created: 27/Oct/11 Updated: 04/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Hugo Duncan | Assignee: | Anthony Grimes |
| Resolution: | Unresolved | Votes: | 8 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Incomplete |
| Description |
|
At present, clojure.test test cases are functions and can be invoked directly. However, in the case that the test relies on fixtures, this does not work. Please provide a function that can run a single test case with all fixtures applied. |
| Comments |
| Comment by Anthony Grimes [ 22/Oct/12 6:17 PM ] |
|
I just added clj-866-test-vars.patch (22/Oct/12 6:09PM). I had to implement this hackishly in Leiningen a few days ago, so I'm very excited to get this functionality in clojure.test itself. This patch adds a test-vars function that solves this problem (and is more general). You can test as many vars as you want with it, with fixtures. It works by grouping vars passed by their namespace and then running them all with appropriate fixtures applied. Being able to run a single test isn't the problem here, being able to run only specific tests is. If we wrote a function to run one test with fixtures but we actually needed to run several, just not all tests, we'd end up having to run once-fixtures more than once which is wasteful. I think test-vars is a good solution that solves both this problem and the one I just mentioned. |
| Comment by Alex Miller [ 04/May/13 9:36 AM ] |
|
This is highly useful. Could you add a test to the patch? |
[CLJ-1202] protocol fns with dashes may get compiled into property access when used higher order Created: 16/Apr/13 Updated: 10/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | David Nolen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
user=> (defprotocol Foo (-foo [x]))
Foo
user=> (deftype Bar [] Foo (-foo [_] :baz))
user.Bar
user=> (map -foo [(Bar.)])
IllegalArgumentException No matching field found: foo for class user.Bar
clojure.lang.Reflector.getInstanceField (Reflector.java:271)
I would have expected to see (:baz). The full stack is: IllegalArgumentException No matching field found: foo for class user.Bar
clojure.lang.Reflector.getInstanceField (Reflector.java:271)
clojure.lang.Reflector.invokeNoArgInstanceMember (Reflector.java:300)
user/eval79/fn--80/G--71--82 (NO_SOURCE_FILE:11)
user/eval79/fn--80/G--70--85 (NO_SOURCE_FILE:11)
clojure.core/map/fn--4207 (core.clj:2485)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:60)
clojure.lang.RT.seq (RT.java:484)
clojure.core/seq (core.clj:133)
clojure.core/print-sequential (core_print.clj:46)
clojure.core/fn--5406 (core_print.clj:143)
clojure.lang.MultiFn.invoke (MultiFn.java:231)
nil
I suspect this is somehow related to the property access changes to make Clojure/ClojureScript compatible. I was in fact prepping core.logic for a unified code base and was adopting the ClojureScript protocol naming convention when I encountered this issue.
|
| Comments |
| Comment by Alan Malloy [ 18/Apr/13 7:18 PM ] |
|
Attached patch fixes the issue, and adds regression test for it. |
| Comment by Gabriel Horner [ 10/May/13 3:19 PM ] |
|
Verified patch works |
[CLJ-1171] Compiler macro for clojure.core/instance? disregards lexical shadows on class names Created: 27/Feb/13 Updated: 24/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Herwig Hochleitner | Assignee: | Stuart Halloway |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Screened |
| Description |
SummaryThe compiler tries to emit jvm native instanceof expressions for direct clojure.core/instance? calls. Patches[Stu] All three patches should be applied IMO.
DataTest caseuser=> (let [Long String] (instance? Long "abc")) false ;; expected true as in user=> (let [Long String] (apply instance? [Long "abc"])) true Culprit methodList Discussionhttps://groups.google.com/d/topic/clojure/mf25OlFRpa8/discussion TangentThis was discovered because the same compiler macro also omits the arity check implicit in the default definition. This could also conveniently be fixed when touching that method: user=> (instance? String) false ;; expected user=> (apply instance? [String]) ArityException Wrong number of args (1) passed to: core$instance-QMARK- clojure.lang.AFn.throwArity (AFn.java:437)
|
| Comments |
| Comment by Herwig Hochleitner [ 27/Feb/13 8:11 PM ] |
|
Attached patches test and fix issue + tangent |
| Comment by Herwig Hochleitner [ 04/Mar/13 3:51 PM ] |
|
Note: Patch 0003 just adds the arity check, hence is optional, but if it's omitted from the patchset, the corresponding test from patch 0001 will fail. |
| Comment by Stuart Halloway [ 29/Mar/13 7:31 AM ] |
|
Summarizing the decisions in these patches:
It is possible (although unlikely) that existing code relies on the current eccentric behavior of instance?. I think it would be fair to categorize programs relying on this behavior as buggy, but that is easy for me to say. |
[CLJ-1125] Clojure can leak memory when used in a servlet container Created: 11/Dec/12 Updated: 24/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Toby Crawley | Assignee: | Stuart Halloway |
| Resolution: | Unresolved | Votes: | 8 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Incomplete |
| Description |
|
When used within a servlet container The issue comes from threads living beyond the lifetime of a I've attached a patch that does the following:
There is still the opportunity for memory leaks if agents or futures This patch has a small performance impact: its use of a try/finally Providing an automated test for this patch is difficult - I've tested The above is a condensation of: I'm happy to provide whatever feedback/work is needed to get this |
| Comments |
| Comment by Colin Jones [ 13/May/13 7:30 PM ] |
|
This patch works great for me to avoid OOM/PermGen crashes from classloaders being retained [mine is a non-servlet use case]. |
| Comment by Stuart Halloway [ 24/May/13 9:43 AM ] |
|
Does Tomcat create warnings for Clojure, as described e.g. here? If so, does this patch make the warnings go away? |
| Comment by Toby Crawley [ 24/May/13 9:56 AM ] |
|
Stu: that's a good question. I'll take a look at Tomcat this afternoon. |
| Comment by Stuart Halloway [ 24/May/13 10:04 AM ] |
|
The code that calls transaction.remove() seems unncessarily subtle. There are two exits from the method, and only one is protected by the finally block. If the "outer" case was a top-level if, the logic would be more clear, and only the "outer" case would need try/finally, which might reduce the performance penalty in the case of deeply nested dosyncs. Did your transaction overhead of 4-6 microseconds test only one level of dosync, or many? |
| Comment by Stuart Halloway [ 24/May/13 10:13 AM ] |
|
Because the unwind code calls remove at the top (as opposed to set(null)), the code should now be safe for use with Clojure-defined ThreadLocal subclasses. Therefore, Var's use of an initialValue should be irrelevant to this patch, and it should be possible to fix this bug with a patch half the size of the current patch, touching only LockingTransaction.runInTransaction and Var.popThreadBindings. |
[CLJ-850] Hinting the arg vector of a primitive-taking fn with a non-primitive type results in AbstractMethodError when invoked Created: 09/Oct/11 Updated: 24/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Alexander Taggart | Assignee: | Stuart Halloway |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Screened |
| Description |
|
Summary: The CLJ-850-conform-to-invokePrim.diff patch is constructed per Rich's feedback, and appears good to me [Stu]. See the following examples: user=> (defn f1 ^String [^String s] s) #'user/f1 user=> (f1 "foo") "foo" user=> (defn f2 ^long [^String s ^long i] i) #'user/f2 user=> (f2 "foo" 1) 1 user=> (defn f3 ^String [^String s ^long i] s) #'user/f3 user=> (f3 "foo" 1) AbstractMethodError user$f3.invokePrim(Ljava/lang/Object;J)Ljava/lang/Object; user/eval8 (NO_SOURCE_FILE:6) |
| Comments |
| Comment by Ben Smith-Mannschott [ 15/Oct/11 11:54 AM ] |
|
CLJ-850-test.patch added. |
| Comment by Ben Smith-Mannschott [ 16/Oct/11 7:32 AM ] |
|
XXX this is where I got myself confused. The invokePrim overload it's trying to invoke is the correct one. But, that apparently is no the one that's being generated. Sorry for the noise. |
| Comment by Ben Smith-Mannschott [ 16/Oct/11 10:17 AM ] |
|
|
| Comment by Ben Smith-Mannschott [ 18/Oct/11 12:29 AM ] |
|
There are two things going on here. I'm not sure which is the error. It looks like the return type of the generated invokePrim method is too specific. It's generated as returning String, though the IFn$LO interface specifies returning Object. The caller attempts to call invokePrim returning Object, which is what the interface IFn$LO specifies, but this doesn't work because methodSL doesn't actually implement that method. Instead it implements an overload returning String.
(defn methodSL ^String [^long i] (str i)) <<1>> public final java.lang.String invokePrim(long); <<1>>
Code:
0: getstatic #25;
//Field const__0:Lclojure/lang/Var;
3: invokevirtual #34;
//Method clojure/lang/Var.getRawRoot:()Ljava/lang/Object;
6: checkcast #36;
//class clojure/lang/IFn
9: lload_1
10: invokestatic #42;
//Method clojure/lang/Numbers.num:(J)Ljava/lang/Number;
13: invokeinterface #46, 2;
//InterfaceMethod clojure/lang/IFn.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
18: checkcast #48;
//class java/lang/String
21: areturn
public java.lang.Object invoke(java.lang.Object);
Code:
0: aload_0
1: aload_1
2: checkcast #54;
//class java/lang/Number
5: invokestatic #58;
//Method clojure/lang/RT.longCast:(Ljava/lang/Object;)J
<<2>> 8: invokeinterface #60, 3;
//InterfaceMethod clojure/lang/IFn$LO.invokePrim:(J)Ljava/lang/String;
13: areturn
(defn callSL ^String [] (methodSL 42)) public java.lang.Object invoke();
Code:
0: getstatic #25;
//Field const__0:Lclojure/lang/Var;
3: invokevirtual #43;
//Method clojure/lang/Var.getRawRoot:()Ljava/lang/Object;
6: checkcast #45;
//class clojure/lang/IFn$LO
9: ldc2_w #26;
//long 42l
<<3>> 12: invokeinterface #49, 3;
//InterfaceMethod clojure/lang/IFn$LO.invokePrim:(J)Ljava/lang/Object;
17: areturn
|
| Comment by Ben Smith-Mannschott [ 18/Oct/11 1:40 AM ] |
|
Given P is some primitive type, O is type Object, and R some subclass of Object: When Clojure generates a R invokePrim(P x), it also generates a Object invoke(Object x), which delegates to R invokePrim(P x). R invokePrim(P x) overloads, but does not override the method of the corresponding Fn$PO interface. If Clojure were to generate an additional O invokePrim(P x) which delegates to R invokePrim(P x), it would satisfy the requirements of the Fn$PO interface, and should fix this issue. |
| Comment by Ben Smith-Mannschott [ 18/Oct/11 2:54 PM ] |
|
CLJ-850.patch fixes the issue. I consider this patch to be pretty hackish and hope that there's a cleaner way of addressing CLJ-850. This is the first time I've tried to understand (much less change) the Clojure compiler, so don't expect genius. |
| Comment by Ben Smith-Mannschott [ 19/Oct/11 5:06 AM ] |
|
The patch lies slightly:
It turns out that what I'm actually doing is generating a R invokePrim(P x) which is a copy of O invokePrim(P x), instead of delgating to O invokePrim(P x). This works, but the resulting class file would be smaller if the patch actually did what it says it does. |
| Comment by Andy Fingerhut [ 28/Feb/12 12:49 AM ] |
|
clj-850-type-hinted-fn-abstractmethoderror-patch2.txt is identical to Ben's two patches combined into one, with the small modification that the new tests are added to metadata.clj instead of creating a new test file. The patch applies cleanly to latest master as of Feb 27, 2012. One of the new tests does fail without the change to the compiler, and succeeds with it. I can't vouch for the correctness of the change myself, not knowing enough about the compiler internals to judge. |
| Comment by Andy Fingerhut [ 23/Mar/12 7:50 PM ] |
|
Same comments as made on Feb 27, 2012, except the patch clj-850-type-hinted-fn-abstractmethoderror-patch3.txt applies cleanly to latest master as of Mar 23, 2012. Updated because previous patch (now removed) no longer applied cleanly. git patches often fail to apply if context lines near changes are modified. |
| Comment by Rich Hickey [ 13/Apr/12 9:35 AM ] |
|
We don't support sigs taking prims and returning anything other than prim or Object. Overloading on return value only is a bad idea (and forbidden in Java). The return type of the generated method should be Object, and the String return hint should be used only as a hint. |
| Comment by Andy Fingerhut [ 01/Nov/12 7:22 PM ] |
|
clj-850-type-hinted-fn-abstractmethoderror-patch4.txt dated Nov 1 2012 is same as Ben Smith-Mannschott's CLJ-850.patch and CLJ-850-test.patch, except it has been combined into one patch and does not create a new test source file. |
| Comment by Mike Anderson [ 09/Dec/12 3:42 PM ] |
|
+10 for solving this issue: it keeps biting me in 1.4 and wouuld love to see in 1.5 I'm not familiar with the Clojure compiler internals, but looking at the approach, shouldn't we produce a primitive method with a different name (since Java doesn't support overloading on return types as Rich correctly points out). Also I think there should be 4 methods: R invokePrimExact(P x) - the actual method, used when compiler can infer I think this solves all the important cases? |
| Comment by Rich Hickey [ 19/Dec/12 8:03 AM ] |
|
Still no patch incorporating my feedback, afaict. Pushing to next release. |
| Comment by Ghadi Shayban [ 19/Dec/12 3:41 PM ] |
|
Does this new patch address the issue and concerns? (This incorporates Ben's tests from the previous patch, wasn't sure how to attribute him on that hunk) CLJ-850-conform-to-invokePrim.diff |
| Comment by Andy Fingerhut [ 21/Dec/12 10:53 PM ] |
|
Presumptuously changing state from Incomplete back to Vetted after Ghadi Shayban added the patch CLJ-850-conform-to-invokePrim.diff dated Dec 19 2012 after the status was changed to Incomplete. |
[CLJ-322] Enhance AOT compilation process to emit classfiles only for explicitly-specified namespaces Created: 29/Apr/10 Updated: 24/May/13 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 12 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Incomplete |
| Waiting On: | Chas Emerick |
| Description |
|
Summary: still needs decision on implementation approach. This was originally/erroneously reported by Howard Lewis Ship in the clojure-contrib assembla: My build file specifies the namespaces to AOT compile but if I include another namespace (even from a JAR dependency) that is not AOT compiled, the other namespace will be compiled as well. In my case, I was using clojure-contrib's clojure.contrib.str-utils2 namespace, and I got a bunch of clojure/contrib/str_utils2 classes in my output directory. I think that the AOT compiler should NOT precompile any namespaces that are transitively reached, only namespaces in the set specified by the command line are appropriate. As currently coded, you will frequently find unwanted third-party dependencies in your output JARs; further, if multiple parties depend on the same JARs, this could cause bloating and duplication in the eventual runtime classpath. Having the option of shipping either all AOT-compiled classfiles or mixed source/AOT depending upon one's distribution requirements would make that phase of work with a clojure codebase significantly easier and less error-prone. The only question in my mind is what the default should be. We're all used to the current behaviour, but I'd guess that any nontrivial project where the form of the distributable matters (i.e. the source/AOT mix), providing as much control as possible by default makes the most sense. Given the tooling that most people are using, it's trivial (and common practice, IIUC) to provide a comprehensive list of namespaces one wishes to compile, so making that the default shouldn't be a hurdle to anyone. If an escape hatch is desired, a --transitive switch to clojure.lang.Compile could be added. |
| Comments |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/322 |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
hlship said: I'd like to reinforce this. I've been doing research on Clojure build tools for an upcoming talk and all of them (Maven, Leiningen, Gradle) have the same problem: the AOT compile extends from the desired namespaces (such as one containing a :gen-class) to every reached namespace. This is going to cause a real ugliness when application A uses libraries B and C that both depend on library D (such as clojure-contrib) and B and C are thus both bloated with duplicate, unwanted AOT compiled classes from the library D. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: This behaviour is an implementation detail of Clojure's AOT compilation process, and is orthogonal to any particular build tooling. I am working on a patch that would provide a mechanism for such tooling to disable this default behaviour. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: A first cut of a change to address this issue is here (caution, work in progress!): http://github.com/cemerick/clojure/commit/6f14e0790c0d283a7e44056adf1bb3f36bb16e0e This makes available a new recognized system property, clojure.compiler.transitive, which defaults to true. When set/bound to false (i.e. -Dclojure.compiler.transitive=false when using clojure.lang.Compile), only the first loaded file (either the ns named in the call to compile or each of the namespaces named as arguments to clojure.lang.Compile) will have classfiles written to disk. This means that this compilation invocation: java -cp <your classpath> -Dclojure.compiler.transitive=false clojure.lang.Compile com.bar com.baz
will generate classfiles only for com.bar and com.baz, but not for any of the namespaces or other files they load, require, or use. The only shortcoming of this WIP patch is that classfiles are still generated for proxy and gen-class classes defined outside of the explicitly-named namespaces. What I thought was a solution for this ended up breaking the loading of generated interfaces (as produced by defprotocol, etc). I'll take a second look at this before the end of the week, but wanted to get this out there so as to get any comments people might have. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
technomancy said: Looks good, but I'm having trouble getting it to work. I tried compiling from master of Chas's fork on github, but I still got the all the .class files generated with -Dclojure.compiler.transitive=false. It could be a quirk of the way I'm using ant to fork off processes though. Is it possible to set it using System/setProperty, or must it be given as a property on the command-line? |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: Bah, that's just bad documentation. :-/ The system property is only provided by clojure.lang.Compile; the value of it drives the binding of clojure.core/transitive-compile, which has a root binding of true. You should be able to configure the transitivity the same way you configure compile-path (system prop to clojure.lang.Compile or a direct binding when at the REPL, etc). If not, ping me in irc or elsewhere. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
meikelbrandmeyer said: I think, excluding parts 'load'ed is a little strong. I have some namespaces which load several parts from different files, but which belong to the same namespace. The most prominent example of such a case is clojure.core itself. I'm find with stopping require and use, but load is a bit too much, I'd say. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
technomancy said: Chas: Thanks; will give that a go. Meikel: Do people actually use load outside of clojure.core? I thought it was only used there because clojure.core is a "special" namespace where you want more vars to be available than can reasonably fit in a single file. Splitting up a namespace into several files is quite unadvisable otherwise. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
technomancy said: I can confirm that this works for me modulo the proxy/gen-class issue that Chas mentioned. I would love to see this in Clojure 1.2; it would really clean up a lot of build-related issues. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
meikelbrandmeyer said: I used it several times and this is the first time, I hear that it is unadvisable to do so. Even with a lower number of Vars in the namespace (c.c is here certainly exceptional) and might be of use to split several "sections" of code which belong to the same namespace but have different functionality. Whether to use a big comment in the source to indicate the section or split things into subfiles is a matter of taste. But it's a perfectly reasonable thing todo. Another use case, where I use this (and c.c.lazy-xml, IIRC) is to conditionally load code depending on whether a dependency is available or not. Eg. vimclojure uses c.c.pprint and c.c.stacktrace/clj-stacktrace transparently depending on their availability. There are perfectly legal uses of load. I don't see any "unadvisable" here. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: Thanks, Meikel; I had forgotten about that use case, as I don't use load directly myself at all. I probably wouldn't say it's inadvisable, just mostly unnecessary. In any case, that's a good catch. It complicates things a bit, but we'll see what happens. I'm going to take another whack at resolving the proxy/gen-class case and narrowing the impact of nontransitivity to use and require later tonight. I agree wholeheartedly that this should be in 1.2, assuming the technical bits work out. This has been an irritant for quite a long time. I actually believe that nontransitivity should be the default – no one wants or expects to have classfiles show up for dependencies show up when a project is AOT-compiled. I think the only negative impact would be whoever still fiddles with compilation at the REPL, and doesn't use maven or lein – and even then, it's just a matter of binding another var. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
meikelbrandmeyer said: Then the var should be added to the default bindings in the clojure.main repl. Then it's set!-able like the other vars ��� warn-on-reflection and friends. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: This is looking pretty good (still WIP): http://github.com/cemerick/clojure/commit/fedfb022ecef420a932b3d69c182ec7a8e5960a6 Thank you again for mentioning load, Meikel: it was very helpful in resolving the proxy/gen-class issue as well. Just a single data point: the jar produced by the medium-sized project I've been using for testing the changes has shrunk from 1.8MB to less than 1MB. That's not the only reason this is a good change, but it's certainly a nice side-effect. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: [file:aIWFiWHeGr35ImeJe5cbLA] |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: [file:aI7Eu-HeGr35ImeJe5cbLA] |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: Patched attached. The The user impact of changing the default would be:
|
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
hlship said: Just had a brain-storm: How about an option to support transitive compilation, but only if the Clojure source file being compiled as a file: URL (i.e., its a local file on the file system, not a file stored in a JAR). That would make it easier to use compilation on the local project without transitively compiling imported libraries, such as clojure-contrib. So transitive-compile should be a keyword, not a boolean, with values :all (for 1.1 behavior), :none (to compile only the exact specified namespaces) or :local (to compile transitively, but only for local files, not source files from JARs). |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: (Crossposted to the clojure-dev list) I thought about this some, and I don't think that's a good idea, at least for now. I'm uncomfortable with semantics changing depending upon where code is being loaded from – which, depending upon a tool's implementation, might be undefined. E.g. if the com.foo.bar ns is available in source form in one directory, but as classes from a jar, and classpaths aren't being constructed in a stable fashion, then the results of compilation will change. If we decide that special treatment depending upon the source of code is warranted in the future, that's a fairly straightforward thing to do w.r.t. the API – we could have :all and :local as you suggest, with nil representing :none. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
stu said: Rich is not comfortable enough with the implementation complexity of this patch (e.g. the guard clause for proxies and gen-class) to slide this in as a minor fix under the wire for 1.2. Better to live with the pain we know a little longer than ship something we don't have enough experience with to be confident. |
| Comment by Chas Emerick [ 19/Nov/10 9:28 PM ] |
|
Updated patch to cleanly apply to HEAD and address issues raised by screening done by Cosmin Stejerean. Also includes proper tests. Note: this patch's tests require the fix for |
| Comment by Stuart Halloway [ 29/Nov/10 7:18 AM ] |
|
the "-resolved" patch resolves a conflict in main.clj |
| Comment by Stuart Halloway [ 29/Nov/10 7:25 AM ] |
|
Several questions:
|
| Comment by Stuart Sierra [ 10/Dec/10 3:34 PM ] |
|
An alternative approach: patch write-classes-1.diff.gz From my forked branch What this patch does:
This approach was prompted by the following observations:
|
| Comment by Chas Emerick [ 10/Dec/10 4:04 PM ] |
|
S. Halloway: My apologies, I didn't know you had commented. I thought that, having assigned this issue to myself, I'd be notified of updates. FWIW, I aim to review your comments and SS' approach over the weekend. |
| Comment by Chas Emerick [ 16/Dec/10 7:36 AM ] |
|
S. Halloway: 1. Certainly shouldn't happen. AFAIK, others have screened the patch, presumably with a successful build. |
| Comment by Chas Emerick [ 16/Dec/10 9:00 AM ] |
|
I think S. Sierra's approach is fundamentally superior what I offered. I have two suggestions: one slight perspective change (which implies no change in the actual implementation), and an idea for an even simpler approach (at least from a user perspective), in that order. While interop is the driving requirement behind AOT, I absolutely do not want to have to keep an updated enumeration of all of the classes resulting from each and every defrecord et al. usages in my pom.xml/project.clj (and I wouldn't wish the task of ferreting those usages and their resulting classnames on any build tool author). Right now, *compile-write-classes* is documented to be a set of classname strings, but could just as easily be any other function. *compile-write-classes* should be documented to accept any predicate function (renamed to e.g. *compile-write-class?*?). There's no reason why it shouldn't be bound to, e.g. #(re-matches #"foo\.bar\.[\w_]+$" %) if I know that all my records are defined in the foo.bar namespace. To go along with that, I think some package/classname-globbing utilities along with corresponding options to clojure.lang.Compile would be most welcome. Classname munging rules are not exactly obvious, and it'd be good to make things a little easier for users in this regard. Another alternativeIf there's a closed set of forms that generate classes that one might reasonably be interested in having in a build result (outside of use cases for pervasive AOT), then why not have a simple option that only those forms utilize? gen-class and gen-interface already do this, but reusing the all-or-nothing *compile-files* binding; if they keyed off of a binding that implied a diminished scope (e.g. *compile-interop-forms* – which would be true if *compile-files* were true), then they'd do exactly what we wanted. Extending this approach to deftype (and therefore defrecord) should be straightforward. An implementation of this would probably be somewhat more complicated than S. Sierra's patch, though not as complex as my original stab at the problem (i.e. no *load-level*). On the plus side: 1. No additional configuration for users or implementation work for build tool authors, aside from the addition of the boolean diminished-scope AOT option I can see wanting to further restrict AOT to specific classnames in certain circumstances, in which case the above and S. Sierra's patch might be complimentary. |
| Comment by Stuart Sierra [ 16/Dec/10 11:49 AM ] |
|
I like the idea of *compile-interop-forms*. But is it always possible to determine what an "interop form" is? I think it is, I'm just not sure. |
| Comment by Allen Rohner [ 09/Oct/11 12:50 PM ] |
|
I'm also in favor of compile-interop-forms. As far as determining, how about sticking metadata on the var? (defmacro ^{:interop-form true} deftype ...) |
| Comment by Stuart Sierra [ 21/Oct/11 8:38 AM ] |
|
Summary and design discussion on wiki at http://dev.clojure.org/display/design/Transitive+AOT+Compilation |
| Comment by Stuart Sierra [ 29/Nov/11 6:54 PM ] |
|
New attachment compile-interop-1.patch has new approach: Add a third possible value for *compile-files*. True and false keep their original meanings, but :interop causes only interop-related forms to be written out as .class files. "Interop forms" are gen-class, gen-interface, deftype, defrecord, defprotocol, and definterface. Pros:
Cons:
|
| Comment by Stuart Sierra [ 02/Dec/11 8:12 AM ] |
|
Just realized my patch doesn't solve the transitive compilation problem. If library A loads library B, then compiling interop forms in A will also emit interop .class files in B. |
| Comment by Paudi Moriarty [ 01/Jan/13 3:55 AM ] |
|
It's disappointing to see an important issue like this still unresolved after 2.5 years. This is a real pain for us. We have a large closed source project where shipping source is not an option. This forces us to manage the AOT'ing of dependencies due to the hard dependency on protocol interfaces introduced by transitive AOT compilation (see https://groups.google.com/forum/?fromgroups=#!topic/clojure-dev/r3A1JOIiwVU). |
| Comment by Andy Fingerhut [ 01/Jan/13 4:27 PM ] |
|
Paul, do you have a suggestion for which of the approaches described in comments here, or on the wiki page http://dev.clojure.org/display/design/Transitive+AOT+Compilation would be preferable solution for you? Or perhaps even a patch that implements your preferred approach? |
| Comment by Howard Lewis Ship [ 04/Jan/13 4:18 PM ] |
|
Andy, I'm now consulting with Paudi's organization, so I think I can speak for him (I'm now the default buildmeister). I like Stuart's :interop idea, but that is somewhat orthogonal to our needs. I return to what I would like; compilation would compile specific namespaces; dependencies of those namespaces would not be compiled. To be honest, I'm still a little hung up on the interop forms: especially defprotocol and friends; from a cursory glance, it appears that todays AOT compilation will compile the protocol into a Java class, then compile the namespace that references the protocol with the assumption that the protocol's Java class is available. When we use build rules to only package our namespace's class files into the output JAR, the code fails with a NoClassDefFoundError because the protocol really needs to be recompiled, at runtime compilation, into an in-memory Java class. Obviously, supporting this correctly will be a challenge; the compiled bytecode for our namespace would ideally: I can imagine any number of ways to juggle things to make this work, so I won't suggest a specific implementation. In the meantime, our workaround is to create a "stub" module as part of our build; it simply requires in the necessary namespaces (for example, org.clojure:core.cache); this forces an AOT compile of the dependencies and we have a special rule to package such dependencies in the stub module's output JAR. This may not be a scalable problem, and it is expensive to identify what 3rd party dependencies require this treatment. |
| Comment by Stuart Halloway [ 24/May/13 1:25 PM ] |
|
I am marking this incomplete because there does not yet seem to be plurality, much less consensus or unanimity, on approach. Personally I am in favor of a solution based on a predicate that gets handed the class name and compiled bits, and then can choose whether to write the class. Pretty close to Stuart Sierra's compile-write-classes. Might be possible to flow more information than classname to the predicate. |
[CLJ-827] unsigned-bit-shift-right Created: 09/Aug/11 Updated: 24/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Joe Gallo | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 12 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Screened |
| Description |
|
Add a clojure equivalent of >>>. A simple version of this is implemented here (https://github.com/joegallo/clojure/tree/unsigned-bit-shift-right), and just follows the example set by shift-right. The downside of this implementation is that it treats all integer types as longs, and shifts them accordingly, which yields different results than you would get in java. A previous version of this did not have the same problem, when BitOps was its own thing. I'm not sure if this limitation is acceptable and appropriate, or needs to be worked around (my inclination is the latter). |
| Comments |
| Comment by Joe Gallo [ 11/Nov/11 12:58 PM ] |
|
I just realized (with the asssistance of Paul Stadig) that just doing only longs is probably sufficient, as you can get the integer version if you really want it: > (int (bit-and Integer/MAX_VALUE (unsigned-bit-shift-right -5 1))) Of course, that's less efficient than just doing it directly with java, but it's enough that I think my concern from the previous comment is addressed. |
| Comment by Tim McCormack [ 16/Jan/12 6:01 PM ] |
|
I have attached "0001-CLJ-827-Add-bit-shift-right-logical.patch", which implements a logical bit-shift-right using the same JVM bytecode as >>>. The patch mimics the implementations of << and >>. |
| Comment by Stuart Halloway [ 02/Feb/13 5:09 PM ] |
|
For context, this feature appears to be needed for Clojure-in-Clojure data structures: https://groups.google.com/d/msg/clojure-dev/iAwH7CLSFzE/6wzDH4RS1YQJ |
| Comment by Michał Marczyk [ 08/Feb/13 5:31 AM ] |
|
Just wanted to note that I've introduced this operation to ClojureScript when implementing PersistentHashMap. The name over there is bit-shift-right-zero-fill. Would it be alright for Clojure to use that name? Failing that, ClojureScript would probably have to change to match. |
| Comment by Gabriel Horner [ 24/May/13 2:23 PM ] |
|
I've added clj-827-unsigned-bit-shift-right-with-tests.patch which builds off of Tim's patch and adds tests. I also renamed the new fn to unsigned-bit-shift-right after chatting with Rich. @Michal - This may mean you need to rename the cljs fn. After this lands on master, I can open a ticket with a patch if you'd like. |
[CLJ-1160] reducers/mapcat ignores Reduced Created: 11/Feb/13 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Christophe Grand | Assignee: | Christophe Grand |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
The following code throws an exception: (->> (concat (range 100) (lazy-seq (throw (Exception. "Too eager")))) This is because r/mapcat introduces an intermediate reduce which swallows the reduced value coming from r/take. |
[CLJ-394] Add marker Interfaces for defrecords and deftypes plus boolean test fns Created: 05/Jul/10 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Sometimes one would like to know if an object is an instance of a deftype or a defrecord. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 12:04 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/394 |
| Comment by Steve Miner [ 20/Apr/12 1:55 PM ] |
|
As of Clojure 1.3, there are marker interfaces named clojure.lang.IType and clojure.lang.IRecord. You can use instance? with those interfaces. I'm not sure if they're actually documented for public use, but they seem to work as expected in 1.3 and 1.4. If you want record?, you can try this: (defn record? [rec] (instance? clojure.lang.IRecord rec)) |
| Comment by Devin Walters [ 20/Oct/12 6:38 PM ] |
|
See attached code and test. I'm unsure as to whether or not the location of the tests and predicates make sense. Please let me know if I should move them elsewhere. |
[CLJ-858] Improve speed of STM by removing System.currentTimeMillis Created: 17/Oct/11 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stefan Kamphausen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
Tested on Ubuntu and OSX |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Original post: https://groups.google.com/d/topic/clojure/kc99LcUK8Tk/discussion This patch removes the milliseconds from inner class TVal in LockingTransaction.java and Ref.java. Using a little test suite[1] a increase of performance by up to 25% could be measured. If necessary I can recreate the patch against current MASTER. References: |
[CLJ-1190] Javadoc for public Java API Created: 03/Apr/13 Updated: 03/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stuart Halloway | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
We should publish javadoc for http://dev.clojure.org/jira/browse/CLJ-1188.
This ticket should wait until |
[CLJ-937] cl-format prints ratio arguments with bad format for E, F, G directives Created: 21/Feb/12 Updated: 08/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
user=> (use 'clojure.pprint) Patch changes cl-format so that when E, F, or G directive is used, the corresponding arg is coerced from a clojure.lang.Ratio to a double before formatting. |
| Comments |
| Comment by Tom Faulhaber [ 29/Mar/12 8:48 PM ] |
|
I have reviewed this patch and recommend that it be applied. (This one has actually been on my to do list for about 4 years. Thanks, Andy!) |
| Comment by Andy Fingerhut [ 08/Apr/13 12:02 PM ] |
|
Patch clj-937-cl-format-coerces-ratios-patch2.txt dated Apr 8 2013 supersedes the previous patch cl-format-efg-coerce-ratios-to-doubes-patch1.txt dated Feb 21 2013. The newer patch works with ratios that cannot be represented as a double, using BigDecimal in those cases. The older patch would print garbage from the string "Infinity" if the ratios were larger than Double/MAX_VALUE, or 0 if the ratio was between 0 and Double/MIN_VALUE. |
[CLJ-196] *file* returns "NO_SOURCE_PATH", but the doc says it should be nil Created: 10/Oct/09 Updated: 12/Apr/13 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Alexander Redington | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Ok |
| Waiting On: | Rich Hickey |
| Description |
|
According to http://clojure.org/api, *file* should return nil in the repl, but it returns "NO_SOURCE_PATH". This has been true for a long time. Latest patch changes only the docstring of *file* to accurately reflect current behavior. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 4:47 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/196 |
| Comment by Colin Jones [ 31/Dec/10 2:41 PM ] |
|
I think this is a pretty trivial docstring fix - "NO_SOURCE_PATH" has been the default value of file since 3dd4c1cf18ea8456b5b4aec607cd54ecfdd85eea (April 2009). |
| Comment by Andy Fingerhut [ 24/Feb/12 4:36 PM ] |
|
Colin's patch still applies cleanly to latest master as of Feb 24, 2012. |
| Comment by |