[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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-1217] for consumes sequence argument more eagerly than necessary Created: 14/Jun/13 Updated: 14/Jun/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
In a call like (do (for [x (do (println "realized") nil)] x) nil), no elements of the for comprehension are ever requested, and so it is not actually necessary to evaluate the inner do-block. However, this expression causes "realized" to be printed, because the first sequence-expression in for is evaluated even if no items are ever requested from the output lazy-seq. It's not documented whether this is intended or unintentional, but I was surprised by this behavior, and a brief unscientific survey on #clojure suggests that other users, even "old hands" who've been using clojure for years, don't expect this either. I've attached a patch that wraps the problematic expression in a lazy-seq call. This is not quite ideal, because it means that the first iteration is "lazied" twice, as in ((fn step [s] (lazy-seq ...)) (lazy-seq xs)), but a change to make this not happen would be much broader in scope, and this seemed the least dangerous. |
[CLJ-1214] Compiler runs out of memory on a small snippet of code Created: 31/May/13 Updated: 02/Jun/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Praki Prakash | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux 3.2.0-39-generic |
||
| Attachments: |
|
| Description |
|
Clojure compiler runs out of memory when loading the attached file. Transcript below. $ java -cp ~/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar:. clojure.main Clojure 1.5.1 user=> (load "fubar") OutOfMemoryError GC overhead limit exceeded [trace missing] user=> The file contents are: (ns fu.bar) (defn foo[l] (concat (drop-last l) (repeat (last l)))) (def ^:const bar (foo [#(print "") #(println ";")])) bar If I remove the metadata on bar, it works. Removal of namespace seems to fix it as well. Pretty strange. Although I realize this code is not quite kosher, it would be nice to have the compiler deal with it. |
| Comments |
| Comment by Andy Fingerhut [ 01/Jun/13 7:40 PM ] |
|
If you really do have 'bar' on a line by itself at the end of file fubar.clj, it seems you are asking it to evaluate the value of bar, which by the definitions is an infinite list, and will of course exhaust all available memory if you attempt to evaluate it. It seems to me the more odd thing is not that it runs out of memory as shown, but that it does not run out of memory when you remove the metadata on bar. What is the purpose of having 'bar' on a line by itself at the end of the file? If I try this but remove 'bar' as the last line of the file, loading the file causes no errors regardless of whether there is metadata on bar's definition or not. It is strange that doing (load "fubar") followed by (first fu.bar/bar) seems to go into an infinite loop if the :const is there on bar, but quickly returns the correct answer if the metadata is removed. |
| Comment by Praki Prakash [ 01/Jun/13 8:40 PM ] |
|
This code snippet is a minimal test case to show that the compiler runs out of memory. What I meant by "it works" was that the compiler doesn't run out of memory and successfully loads the file (or in my real code base, the namespace is compiled). In my code, I use bar (or whatever the real thing is) as source of sequence of functions. The sole reference to bar is needed to trigger this issue. I believe that bar is not being fully evaluated here and thus no infinite loop. If I try to print it, yes, it will ultimately fail. |
| Comment by Praki Prakash [ 01/Jun/13 9:04 PM ] |
|
Having thought about this a bit more, it seems to me that when bar is annotated with const, the compiler is trying to evaluate the associated expression which exhausts the heap? I have never looked at the compiler source and thus not sure if this is what is happening. If it is, then it seems like one should be really careful when adding metadata. That still leaves the other question about the namespace requirement to cause memory exhaustion. I quite distinctly recall having to add the namespace when trying to come up with minimal test case to reproduce the bug. If you think this is really user error, I would accept it |
| Comment by Andy Fingerhut [ 02/Jun/13 4:56 AM ] |
|
It is not just any old metadata that causes this issue, only :const metadata. I tried testing with :const replaced with :dynamic and :private, and there was no problem. This might shed some light on the issue: https://github.com/clojure/clojure/blob/master/changes.md#215-const-defs It appears that ^:const is causing the compiler to evaluate the value at compile time. The value in your example is unbounded, so that can never complete. |
[CLJ-1212] Silent truncation/downcasting of primitive type on reflection call to overloaded method (Math/abs) Created: 28/May/13 Updated: 29/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Matthew Willson | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Clojure 1.5.1 |
||
| Description |
|
I realise relying on reflection when calling these kinds of methods isn't a great idea performance-wise, but it shouldn't lead to incorrect or dangerous behaviour. Here it seems to trigger a silent downcast of the input longs, giving a truncated integer output: user> (defn f [a b] (Math/abs (- a b))) |
| Comments |
| Comment by Matthew Willson [ 28/May/13 12:50 PM ] |
|
For an even simpler way to replicate the issue: user> (#(Math/abs %) 1000000000000) |
| Comment by Andy Fingerhut [ 28/May/13 1:36 PM ] |
|
I was able to reproduce the behavior you see with these Java 6 JVMs on Ubuntu 12.04.2: java version "1.6.0_27" java version "1.6.0_45" However, I tried two Java 7 JVMs, and it gave the following behavior which looks closer to what you would hope for. I do not know what is the precise difference between Java 6 and Java 7 that leads to this behavior difference, but this is some evidence that this has something to do with Java 6 vs. Java 7. user=> (set! warn-on-reflection true) Above behavior observed with Clojure 1.5.1 on these JVMs: Ubuntu 12.04.2 plus this JVM: Mac OS X 10.8.3 plus this JVM: |
| Comment by Matthew Willson [ 29/May/13 5:17 AM ] |
|
Ah, interesting. Here's the bytecode generated incase anyone's curious: public java.lang.Object invoke(java.lang.Object); |
| Comment by Matthew Willson [ 29/May/13 5:20 AM ] |
|
Just an idea (and maybe this is what's happening under java 7?) but given it's a static method and all available overloaded variants are presumably known at compile time, perhaps it could generate code along the lines of: (cond |
| Comment by Andy Fingerhut [ 29/May/13 3:19 PM ] |
|
In Reflector.java method invokeStaticMethod(Class c, String methodName, Object[] args) there is a call to getMethods() followed by a call to invokeMatchingMethod(). getMethods() returns the 4 java.lang.Math/abs methods in different orders on Java 6 and 7, causing invokeMatchingMethod() to pick a different one on the two JVMs: java version "1.6.0_39" user=> (pprint (seq (clojure.lang.Reflector/getMethods java.lang.Math 1 "abs" true))) java version "1.7.0_21" user=> (pprint (seq (clojure.lang.Reflector/getMethods java.lang.Math 1 "abs" true))) That might be a sign of undesirable behavior in invokeMatchingMethod() that is too dependent upon the order of methods given to it. As you mention, type hinting is good for avoiding the significant performance hit of reflection. |
[CLJ-1208] Namespace is not loaded on defrecord class init Created: 03/May/13 Updated: 03/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Tim McCormack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
As a user of Clojure interop from Java, I want defrecords (and deftypes?) to load their namespaces upon class initialization so that I can simply construct and use AOT'd record classes without manually requiring their namespaces first. Calling the defrecord's constructor may or may not result in "Attempting to call unbound fn" exceptions, depending on what code has already been run. This issue has been raised several times over the years, but I could not find an existing ticket for it:
|
[CLJ-1207] Importing a class that does not exist fails to report the name of the class that did not exist Created: 29/Apr/13 Updated: 26/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Howard Lewis Ship | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | feedback | ||
| Environment: |
1.5.1, OS X |
||
| Waiting On: | Howard Lewis Ship |
| Description |
|
Pop quiz: What Java class is missing from the classpath? java.lang.NoClassDefFoundError: Could not initialize class com.annadaletech.nexus.util.logging__init
at java.lang.Class.forName0 (Class.java:-2)
java.lang.Class.forName (Class.java:264)
clojure.lang.RT.loadClassForName (RT.java:2098)
clojure.lang.RT.load (RT.java:430)
clojure.lang.RT.load (RT.java:411)
clojure.core$load$fn__5018.invoke (core.clj:5530)
clojure.core$load.doInvoke (core.clj:5529)
clojure.lang.RestFn.invoke (RestFn.java:408)
clojure.core$load_one.invoke (core.clj:5336)
clojure.core$load_lib$fn__4967.invoke (core.clj:5375)
clojure.core$load_lib.doInvoke (core.clj:5374)
clojure.lang.RestFn.applyTo (RestFn.java:142)
clojure.core$apply.invoke (core.clj:619)
clojure.core$load_libs.doInvoke (core.clj:5413)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invoke (core.clj:619)
clojure.core$require.doInvoke (core.clj:5496)
clojure.lang.RestFn.invoke (RestFn.java:512)
novate.console.app$eval1736$loading__4910__auto____1737.invoke (app.clj:1)
novate.console.app$eval1736.invoke (app.clj:1)
clojure.lang.Compiler.eval (Compiler.java:6619)
clojure.lang.Compiler.eval (Compiler.java:6608)
clojure.lang.Compiler.load (Compiler.java:7064)
user$eval1732.invoke (NO_SOURCE_FILE:1)
clojure.lang.Compiler.eval (Compiler.java:6619)
clojure.lang.Compiler.eval (Compiler.java:6582)
clojure.core$eval.invoke (core.clj:2852)
clojure.main$repl$read_eval_print__6588$fn__6591.invoke (main.clj:259)
clojure.main$repl$read_eval_print__6588.invoke (main.clj:259)
clojure.main$repl$fn__6597.invoke (main.clj:277)
clojure.main$repl.doInvoke (main.clj:277)
clojure.lang.RestFn.invoke (RestFn.java:1096)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__584.invoke (interruptible_eval.clj:56)
clojure.lang.AFn.applyToHelper (AFn.java:159)
clojure.lang.AFn.applyTo (AFn.java:151)
clojure.core$apply.invoke (core.clj:617)
clojure.core$with_bindings_STAR_.doInvoke (core.clj:1788)
clojure.lang.RestFn.invoke (RestFn.java:425)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:41)
clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__625$fn__628.invoke (interruptible_eval.clj:171)
clojure.core$comp$fn__4154.invoke (core.clj:2330)
clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__618.invoke (interruptible_eval.clj:138)
clojure.lang.AFn.run (AFn.java:24)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:603)
java.lang.Thread.run (Thread.java:722)
If you guess "com.annadaletech.nexus.util.logging__init" you are wrong! Wait, I'll give you a hint: (ns com.annadaletech.nexus.util.logging
(:use [clojure.string :only [trim-newline]]
[clojure.pprint :only [code-dispatch pprint with-pprint-dispatch *print-right-margin*]])
(:import [java.io StringWriter]
[org.slf4j MDC MarkerFactory Marker LoggerFactory]
[java.util.concurrent.locks ReentrantLock]))
Oh, sorry, did that not help? The correct answer is "org.slf4j.MDC". Having that information in the stack trace would have saved me nearly an hour. I think it is worth the effort to get that reported correctly. |
| Comments |
| Comment by Gabriel Horner [ 10/May/13 1:56 PM ] |
|
When I try this on a fresh project, I get this error: Howard, could you give us a project.clj or better yet a github repository that recreates this issue? |
| Comment by Howard Lewis Ship [ 10/May/13 4:51 PM ] |
|
I'll see what I can do. Probably be next week. Thanks for looking at this. |
| Comment by Gary Fredericks [ 26/May/13 8:20 AM ] |
|
This reminds me of an issue with `lein run` that resulted from it trying to figure out whether you wanted to run a namespace or a java class: |
[CLJ-1205] Update Maven build for Nexus 2.4 Created: 22/Apr/13 Updated: 22/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Stuart Sierra | Assignee: | Stuart Sierra |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
These additions to the build configuration are necessary to support changes to the Sonatype Nexus server at oss.sonatype.org, which we use to promote our build artifacts into the Maven Central Repository. See Sonatype's announcement at https://groups.google.com/d/msg/clojure-dev/lBpfII2u6vM/LQvr_rO5UGgJ |
[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-1197] Allow fold to parallelize over lazy sequences Created: 10/Apr/13 Updated: 10/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Paul Butcher | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
This patch implements foldable-seq, which allows fold to parallelize over a lazy sequence. See this conversation on the Clojure mailing list: https://groups.google.com/forum/#!msg/clojure/8RKCjF00ukQ/b5mmmOB5Uh4J The patch is code only, sadly. No tests because I've not been able to find any existing tests for fold: https://groups.google.com/d/msg/clojure-dev/plQ16L1_FC0/CIyMVIgSZkkJ However, I have tested it in a separate project successfully. |
[CLJ-1183] java interop - cannot call a final method on non-public superclass Created: 13/Mar/13 Updated: 18/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Shlomi | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
when trying to call a method on a concrete class that is defined as final on its super class that is not public, the runtime throws: "java.lang.IllegalArgumentException: Can't call public method of non-public class" even when fully annotated, Reflection is still used and the call fails. you can read the full description here https://groups.google.com/d/msg/clojure/p2tBMT-BIYc/mDQB8cSponMJ I included a sample project that demonstrate the problem |
| Comments |
| Comment by Shlomi [ 13/Mar/13 6:51 AM ] |
|
in my sample project, i used a nested class, but i didnt have to (as pointed by Marko Topolnik). changing the java code to: abstract class AbstractParent{ public class test extends AbstractParent {} and the clojure to: (ns call-test.core (:gen-class)) would produce the same error, java.lang.IllegalArgumentException: Can't call public method of non-public class: public final int AbstractParent.x() |
| Comment by zoowar [ 16/May/13 12:05 PM ] |
|
This issue affects the upcoming netty-4.0 release in which the public modifier of AbstractBootstrap was removed. |
| Comment by Matthew Phillips [ 18/May/13 3:48 AM ] |
|
To get Netty 4 working with Clojure I had to create a set of public static Java methods for the various inaccessible Netty calls, which I then call from Clojure. A PITA, but works fine. Happy to post code if anyone would find it useful. |
| Comment by Shlomi [ 18/May/13 4:31 AM ] |
|
Matthew, i kinda left that project after running to these and other troubles (focused on previous Netty until version 4 will become ready and be properly documented), but i'd still like to see your code. you have a github account or a gist with it? Clojure devs - are there any plans of checking this problem out? it came up from Netty, but the problem is pretty generic |
| Comment by Matthew Phillips [ 18/May/13 7:22 PM ] |
|
Shlomi: here's a gist with the code I'm using in it. It's not comprehensive, just the bits I needed. |
[CLJ-1181] clojure.pprint/code-dispatch breaks on certain types of anonymous functions Created: 10/Mar/13 Updated: 18/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Devin Walters | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
(with-out-str
(with-pprint-dispatch code-dispatch
(pp/pprint (read-string "(fn* [x] x)"))))
breaks because the format string here: https://github.com/clojure/clojure/blob/master/src/clj/clojure/pprint/dispatch.clj#L378 expects a sequence. In the case of (fn* [x] x) it is passed a symbol. |
| Comments |
| Comment by Jean Niklas L'orange [ 18/Mar/13 5:40 PM ] |
|
I think the main "issue" here resides within the undocumented functionality of fn*. (fn* [x] x) is a semantically working function, but (fn [x] x) expands into (fn* ([x] x)). Anonymous function literals expand into (fn* [gensyms] (...)), and as such, it also accepts expressions like (fn* [x] x). Should pprint pretty print expressions which has used fn* directly, or should it "just" ignore it? |
[CLJ-1180] defprotocol doesn't resolve tag classnames Created: 10/Mar/13 Updated: 10/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5, Release 1.6 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Nicola Mometto | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
defprotocol doesn't resolve tag classnames, this results in exceptions being thrown when the declared protocol uses as a tag an imported class that is not imported in the namespace that uses it. user=> (import 'clojure.lang.ISeq) |
[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-1165] Forbid varargs defprotocol/definterface method declarations because those cannot be defined anyway Created: 15/Feb/13 Updated: 04/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Tassilo Horn | Assignee: | Stuart Halloway |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | enhancement, patch | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Protocol, interface method declarations don't allow for varags. Currently, for example (defprotocol FooBar
(foo [this & more]))
compiles just fine, and & is interpreted as a usual argument that happens to be Similarly, providing method implementations via defrecord, deftype, and reify So this patch makes defprotocol and definterface throw an Similarly, defrecord, deftype, and reify throw an IllegalArgumentException if This patch is a cut-down variant of my patch to http://dev.clojure.org/jira/browse/CLJ-1024 This has been discussed on the list: https://groups.google.com/d/topic/clojure-dev/qjkW-cv8nog/discussion |
| Comments |
| Comment by Stuart Halloway [ 29/Mar/13 5:27 AM ] |
|
I think that this patch would be much more helpful to users if it reported the problem form (both name and params). (And I wonder if we should be using ex-info for all errors going forward.) |
| Comment by Tassilo Horn [ 31/Mar/13 5:17 AM ] |
|
New version of the patch that mentions both method name and argument vector, and uses ex-info as Stu suggested. |
| Comment by Andy Fingerhut [ 04/Apr/13 7:24 PM ] |
|
Presumuptuously changing Approval from Incomplete back to None, since the reason for marking it Incomplete seems to have been addressed with a new patch. |
[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-1157] Classes generated by gen-class aren't loadable from remote codebase for mis-implementation of static-initializer Created: 04/Feb/13 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Tsutomu Yano | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Tested on Mac OS X 10.8 and Oracle JVM 1.7.0 update 13. |
||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
When a client program uses a remote service which uses RMI, and the service returns a object which created with gen-class with clojure as the return value, the return value is not loadable at client side. At client side, a following exeption will be thrown. Exception in thread "main" java.lang.ExceptionInInitializerError
at java.io.ObjectStreamClass.hasStaticInitializer(Native Method)
at java.io.ObjectStreamClass.computeDefaultSUID(ObjectStreamClass.java:1723)
at java.io.ObjectStreamClass.access$100(ObjectStreamClass.java:69)
at java.io.ObjectStreamClass$1.run(ObjectStreamClass.java:247)
at java.io.ObjectStreamClass$1.run(ObjectStreamClass.java:245)
at java.security.AccessController.doPrivileged(Native Method)
at java.io.ObjectStreamClass.getSerialVersionUID(ObjectStreamClass.java:244)
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:600)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1601)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1514)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:324)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:173)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
at $Proxy0.getResult(Unknown Source)
at client.SampleClient$_main.doInvoke(SampleClient.clj:12)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at client.SampleClient.main(Unknown Source)
Caused by: java.io.FileNotFoundException: Could not locate remoteserver/SampleInterfaceImpl__init.class or remoteserver/SampleInterfaceImpl.clj on classpath:
at clojure.lang.RT.load(RT.java:434)
at clojure.lang.RT.load(RT.java:402)
at clojure.core$load$fn__5039.invoke(core.clj:5520)
at clojure.core$load.doInvoke(core.clj:5519)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:415)
at remoteserver.SampleInterfaceImpl.<clinit>(Unknown Source)
... 23 more
HOW TO REPRODUCT THIS ISSUEIf you want to see this issue at your computer, clone my example project from my github. git clone git://github.com/tyano/clojure_genclass_fix.git and build them (You must have installed Leiningen 2): cd clojure_genclass_fix sh build.sh start rmiregistry: rmiregistry & start remoteserver: cd remoteserver sh start.sh You will see a message "Server ready. " or "Server ready. (rebind)". At last, start client program: cd ../client sh start.sh Without my patch, you will see a same Exception described above. But with clojure with my patch, you will see a right response message: "response = this is sample." THE REASONThe reason of this problem is in bytecodes generated by gen-class. A gen-classed class (in this case, SampleInterfaceImpl.class) uses a static-initializer for loading SampleInterfaceImpl__init.class (which load other classes which implements functions in the class). The static-initializer is like bellow: (the following code is decompiled with JD - http://java.decompiler.free.fr/?q=jdgui ) static { RT.var("clojure.core", "load").invoke("/remoteserver/SampleInterfaceImpl"); } Very simple code. it seems non-problematic. But RT.load changes the classloader for loading __init.class in the processing! RT.load in default uses a context-classloader for loading classes. But all classes depending on a gen-classed class must be loaded a same classloader with a main gen-classed class. In this case, RT.load must use a remote URLClassLoader which load a main class. So, gen-class must be create bytecodes that is same with the following java code. static { Var.pushThreadBindings(RT.map(new Object[] { Compiler.LOADER, SampleInterfaceImpl.class.getClassLoader() })); try { RT.var("clojure.core", "load").invoke("/remoteserver/SampleInterfaceImpl"); } finally { Var.popThreadBindings(); } } With this code, RT.load will uses a same classloader which load SampleInterfaceImpl.class. You can use an attached patch '20130204_fix_classloader.diff', or pull 'fix_classloader' branch from my github repositry ( git@github.com:tyano/clojure.git ). |
| Comments |
| Comment by Stuart Halloway [ 01/Mar/13 10:20 AM ] |
|
This sounds reasonable, but anything touching classloaders must be considered very carefully. |
| Comment by Stuart Halloway [ 01/Mar/13 12:12 PM ] |
|
It seems overly complex to have the patch do so much code generation. Why not implement a method that does this job, and have the generated code call that? |
[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-1142] Incorrect divide-by-zero error with floating point numbers Created: 08/Jan/13 Updated: 08/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Tim McCormack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The unary call for clojure.core// treats a dividend of 0.0 differently than the binary call, likely due to inlining. (/ 0.0) ;; java.lang.ArithmeticException: Divide by zero (/ 1 0.0) ;;= Infinity (/ 1 (identity 0.0)) ;; java.lang.ArithmeticException: Divide by zero |
| Comments |
| Comment by Tim McCormack [ 08/Jan/13 11:22 PM ] |
|
The relevant code seems to be this in clojure.lang.Numbers/divide: if(yops.isZero((Number)y)) throw new ArithmeticException("Divide by zero"); Making Numbers/divide be more restrictive than double arithmetic seems like a bug; explicitly throwing an ArithmeticException instead of letting the JVM figure it just seems like more work than necessary. |
[CLJ-1136] Type hinting for array classes does not work in binding forms Created: 20/Dec/12 Updated: 21/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Luke VanderHart | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | Compiler, bug | ||
| Environment: |
replicated on OpenJDK 7u9 on Ubuntu 12.04, and Hotspot 1.6.0_37 on OSX Lion |
||
| Description |
|
Type hints don't work as expected in binding forms. The following form results in a reflection warning: (let [^{:tag (Class/forName "[Ljava.lang.Object;")} a (make-array Object 2)] However, hinting does appear to work correctly on vars: (def ^{:tag (Class/forName "[Ljava.lang.Object;")} a (make-array Object 2)) |
| Comments |
| Comment by Ghadi Shayban [ 20/Dec/12 10:51 PM ] |
|
It's a little more insidious than type hinting: the compiler doesn't evaluate metadata in the binding vec. This doesn't throw the necessary exception... (let [^{:foo (Class/forName "not real")} bar 42] neither this... (let [^{gyorgy ligeti} a 42] Gyorgy Ligeti never resolves. These two equivalent examples don't reflect: (let [a ^objects (make-array Object 2)] |
| Comment by Ghadi Shayban [ 21/Dec/12 11:09 AM ] |
|
On only the left-hand side of a local binding, metadata on a symbol is not analyzed or evaluated. |
[CLJ-1125] Clojure can leak memory when used in a servlet container Created: 11/Dec/12 Updated: 14/Jun/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: | 9 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| 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. |
| Comment by Toby Crawley [ 14/Jun/13 7:38 AM ] |
re: Tomcat ThreadLocal warningsWith Clojure 1.5.1 using my test app (linked below), I see: Jun 14, 2013 6:35:22 AM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks SEVERE: The web application [/leak] created a ThreadLocal with key of type [clojure.lang.Var$1] (value [clojure.lang.Var$1@4902919]) and a value of type [clojure.lang.Var.Frame] (value [clojure.lang.Var$Frame@147a2aa6]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. Jun 14, 2013 6:35:22 AM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks SEVERE: The web application [/leak] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@608602ca]) and a value of type [clojure.lang.LockingTransaction] (value [clojure.lang.LockingTransaction@7e214d47]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. With the original patch (threadlocal-removal-tcrawley-2012-12-11.diff) and the one attached today (threadlocal-removal-tcrawley-2013-06-14.diff), I no longer see these warnings. re: the LockingTransaction.runInTransaction changesIn today's patch (threadlocal-removal-tcrawley-2013-06-14.diff), I modified runInTransaction to have one exit point, and only wrap a call to run with a try/finally in the outer transaction case. It does introduce two locations where run can be called to preserve the case where an inner transaction has null info: static public Object runInTransaction(Callable fn) throws Exception{ LockingTransaction t = transaction.get(); Object ret; if(t == null) { transaction.set(t = new LockingTransaction()); try { ret = t.run(fn); } finally { transaction.remove(); } } else { if(t.info != null) { ret = fn.call(); } else { ret = t.run(fn); } } return ret; } However, this will likely not reduce the speed penalty I observed in my testing, as I was only using a single level of dosync when capturing timing data. re: removing initialValue from dvalsMy original solution kept initialValue, but I then apparently discovered cases where the leak still occurred (see the mailing list thread). Unfortunately, I can neither recreate that case, nor find in my notes, test code, or the clojure code a reason why keeping initialValue would allow the ThreadLocals to leak when popThreadBindings is patched (assuming one doesn't call Var.getThreadBindings from Java without calling Var.popThreadBindings). Therefore, I've attached a simpler patch (threadlocal-removal-tcrawley-2013-06-14.diff) that just patches LockingTransaction.runInTransaction and Var.popThreadBindings. I've also created a project that demonstrates the leak with 1.5.1, and that the leak does not appear with this patch applied to 1.6.0-master. See its README for usage details. The patched version of 1.6.0-master is available as [org.clojars.tcrawley/clojure "1.6.0-clearthreadlocals"] if anyone wants to give it a try in their own projects. Note that since its group isn't 'org.clojure', you may need to add exclusions to your project to prevent another version of clojure being included. |
| Comment by Andy Fingerhut [ 14/Jun/13 10:56 AM ] |
|
Presumptuously changing ticket approval from Incomplete back to its former Vetted state, since Toby's comments and new patch seem to address the comments that led Stu to change it to Incomplete. |
[CLJ-1118] inconsistent numeric comparison semantics between BigDecimal and other Numerics Created: 30/Nov/12 Updated: 25/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Arthur Ulfeldt | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
user> clojure-version It's not clear if this is a bug or an enhancement request, Should BigDecimal's be special in comparason to their smaller equivalents? |
| Comments |
| Comment by Arthur Ulfeldt [ 30/Nov/12 1:51 PM ] |
|
I understand that the definition of equality between bigDecimals is dependent on both value and scale as in this case: user> (== 0.000000M 0.0M) I just want to make sure the decission to propagate that semantic across types is intentional. If this is on purpose than this is not a bug. |
| Comment by Arthur Ulfeldt [ 30/Nov/12 2:03 PM ] |
|
this could be fixed by calling stripTrailingZeros on bigDecimals before comparing them to Longs or BigInts. (== 2 (double (. 2.0M stripTrailingZeros))) Edited by Andy Fingerhut: Unfortunately that fails for BigDecimal values equal to 0, unless they happen to have a scale that matches what you are comparing it to. I think a more complete solution is to use BigDecimal's compareTo method, e.g.: (zero? (.compareTo 2.0M (bigdec 2))) |
| Comment by Timothy Baldridge [ 03/Dec/12 11:31 AM ] |
|
It seems we need some more eyes on this issue, can you bring this up on clojure-dev and see what they think? |
| Comment by Andy Fingerhut [ 14/Apr/13 4:03 AM ] |
|
Patch clj-1118-make-double-equals-true-for-more-bigdecimals-patch-v1.txt dated Apr 14 2013 changes equiv for BigDecimals so that instead of using BigDecimal.equals(), it uses BigDecimal.compareTo() and checks the return value is equal to 0. The Java docs for these methods explicitly state that BigDecimal.equals() will treat values that are otherwise equal numerically, but differ in scale, as not equal. They also say that BigDecimal.compareTo() will return 0 for such BigDecimals. I'm not sure if this is the preferred behavior for Clojure, but if it is, this patch should do it. |
| Comment by Andy Fingerhut [ 15/Apr/13 12:18 AM ] |
|
clj-1118-make-double-equals-true-for-more-bigdecimals-patch-v2.txt dated Apr 14 2013 is same as clj-1118-make-double-equals-true-for-more-bigdecimals-patch-v1.txt described in previous comment, except it also has some new tests included. |
| Comment by Andy Fingerhut [ 15/Apr/13 9:07 PM ] |
|
clj-1118-make-double-equals-true-for-more-bigdecimals-patch-v3.txt dated Apr 15 2013 is the same as the the previous patch clj-1118-make-double-equals-true-for-more-bigdecimals-patch-v2.txt, except for the following: By changing == behavior for BigDecimal by modifying the BigDecimalOps.equiv() method, that also changes the behavior of = when comparing BigDecimal values to other numbers. hash should be consistent with =, so now hash should return same value for all numerically equal BigDecimal values. This patch should achieve that. |
[CLJ-1108] Allow to specify an Executor instance to be used with future-call Created: 18/Nov/12 Updated: 27/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Max Penet | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
This adds an arity to future-call that expects a java.util.concurrent/ExecutorService instance to be used instead of clojure.lang.Agent/soloExecutor. |
| Comments |
| Comment by Andy Fingerhut [ 26/Dec/12 4:50 PM ] |
|
Rich Hickey committed a change on Dec 21, 2012 to the future-call function that made the patch bac37b91230d8e4ab3a1e6042a6e8c4b7e9cbf53.patch dated Nov 18 2012 no longer apply cleanly. clj-1108-enhance-future-call-patch-v2.txt dated Dec 26 2012 is identical to that earlier patch, except it has been updated to apply cleanly to the latest master. It would be best if Max Penet, author of the earlier patch, could verify I've merged his patch to the latest Clojure master correctly. |
| Comment by Max Penet [ 27/Dec/12 2:25 AM ] |
|
It's verified, it applies correctly to the latest master 00978c76edfe4796bd6ebff3a82182e235211ed0 . Thanks Andy. |
[CLJ-1100] Reader literals cannot contain periods Created: 02/Nov/12 Updated: 14/Feb/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Kevin Lynagh | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | reader | ||
| Approval: | Vetted |
| Description |
|
The LispReader tries to read a record instead of a literal if the tag contains periods: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1171 Which effectively means that reader tags cannot contain periods.
(issue opened: https://github.com/edn-format/edn/issues/39) If periods are allowed, then the LispReader should first check to see if the tag is in *data-readers* and only then if not try to initialize a Java class. I'm happy to write the patch if this behavior is what is desired. |
| Comments |
| Comment by Steve Miner [ 06/Nov/12 9:41 AM ] |
|
The suggested patch (clj-1100-reader-literal-periods.patch) will break reading records when *default-data-reader-fn* is set. Try adding a test like this: (deftest tags-containing-periods-with-default ;; we need a predefined record for this test so we (mis)use clojure.reflect.Field for convenience (let [v "#clojure.reflect.Field{:name \"fake\" :type :fake :declaring-class \"Fake\" :flags nil}"] (binding [*default-data-reader-fn* nil] (is (= (read-string v) #clojure.reflect.Field{:name "fake" :type :fake :declaring-class "Fake" :flags nil}))) (binding [*default-data-reader-fn* (fn [tag val] (assoc val :meaning 42))] (is (= (read-string v) #clojure.reflect.Field{:name "fake" :type :fake :declaring-class "Fake" :flags nil}))))) |
| Comment by Rich Hickey [ 29/Nov/12 9:36 AM ] |
|
The problem assessment is ok, but the resolution approach may not be. What happens should be based not upon what is in data-readers but whether or not the name names a class. Is the intent here to allow readers to circumvent records? I'm not in favor of that. |
| Comment by Steve Miner [ 29/Nov/12 4:01 PM ] |
|
New patch following Rich's comments. The decision to read a record is now based on the symbol containing periods and not having a namespace. Otherwise, it is considered a data reader tag. User |
| Comment by Steve Miner [ 29/Nov/12 4:17 PM ] |
|
I deleted my old patch and some comments referring to it to avoid confusion. In Clojure 1.5 beta 1, # followed by a qualified symbol with a period in the name is considered a record and causes an exception for the missing record class. With the patch, only non-qualified symbols containing periods are considered records. That allows user-defined qualified symbols with periods in their names to be used as data reader tags. |
| Comment by Andy Fingerhut [ 07/Feb/13 9:05 AM ] |
|
clj-1100-periods-in-data-reader-tags-patch-v2.txt dated Feb 7 2013 is identical to CLJ-1100-periods-in-data-reader-tags.patch dated Nov 29 2012, except it applies cleanly to latest master. The only change appears to be in some white space in the context lines. |
| Comment by Andy Fingerhut [ 07/Feb/13 12:53 PM ] |
|
I've removed clj-1100-periods-in-data-reader-tags-patch-v2.txt mentioned in the previous comment, because I learned that CLJ-1100-periods-in-data-reader-tags.patch dated Nov 29 2012 applies cleanly to latest master and passes all tests if you use this command to apply it. % git am --keep-cr -s --ignore-whitespace < CLJ-1100-periods-in-data-reader-tags.patch I've already updated the JIRA workflow and screening patches wiki pages to mention this --ignore-whitespace option. |
| Comment by Andy Fingerhut [ 13/Feb/13 11:31 AM ] |
|
Both of the current patches, CLJ-1100-periods-in-data-reader-tags.patch dated Nov 29 2012, and clj-1100-reader-literal-periods.patch dated Nov 6 2012, fail to apply cleanly to latest master (1.5.0-RC15) as of today, although they did last week. Given all of the changes around read / read-string and edn recently, they should probably be evaluated by their authors to see how they should be updated. |
| Comment by Steve Miner [ 14/Feb/13 12:23 PM ] |
|
I deleted my patch: CLJ-1100-periods-in-data-reader-tags.patch. clj-1100-reader-literal-periods.patch is clearly wrong, but the original author or an administrator has to delete that. |
| Comment by Kevin Lynagh [ 14/Feb/13 1:28 PM ] |
|
I cannot figure out how to remove my attachment (clj-1100-reader-literal-periods.patch) in JIRA. |
| Comment by Steve Miner [ 14/Feb/13 1:43 PM ] |
|
Downarrow (popup) menu to the right of the "Attachments" section. Choose "manager attachments". |
| Comment by Kevin Lynagh [ 14/Feb/13 2:02 PM ] |
|
Great, thanks Steve. Are you going to take another pass at this issue, or should I give it a go? |
| Comment by Steve Miner [ 14/Feb/13 3:04 PM ] |
|
Kevin, I'm not planning to work on this right now as 1.5 is pretty much done. It might be worthwhile discussing the issue a bit on the dev mailing list before working on a patch, but that's up to you. I think my approach was correct, although now changes would have to be applied to both LispReader and EdnReader. |
[CLJ-1096] Make destrucring emit direct keyword lookups Created: 29/Oct/12 Updated: 26/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Christophe Grand | Assignee: | Christophe Grand |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Currently associative destructuring emits calls to get. The attached patch modify desctruture to emit direct keyword lookups when possible. Approved here https://groups.google.com/d/msg/clojure-dev/MaYcHQck8VA/nauMus4mzPgJ |
[CLJ-1093] Empty record literals gets incorrectly evaluated to array-maps Created: 24/Oct/12 Updated: 13/Mar/13 |
|
| Status: | Reopened |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Nicola Mometto | Assignee: | Timothy Baldridge |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
before patch: after patch: |
| Comments |
| Comment by Timothy Baldridge [ 27/Nov/12 11:41 AM ] |
|
Unable to reproduce this bug on latest version of master. Most likely fixed by some of the recent changes to data literal readers. Marking Not-Approved. |
| Comment by Timothy Baldridge [ 27/Nov/12 11:41 AM ] |
|
Could not reproduce in master. |
| Comment by Nicola Mometto [ 01/Mar/13 1:23 PM ] |
|
I just checked, and the problem still exists for records with no arguments: Clojure 1.6.0-master-SNAPSHOT Admittedly it's an edge case and I see little usage for no-arguments records, but I think it should be addressed aswell since the current behaviour is not what one would expect |
| Comment by Herwig Hochleitner [ 02/Mar/13 8:14 AM ] |
|
Got the following REPL interaction: % java -jar ~/.m2/repository/org/clojure/clojure/1.5.0/clojure-1.5.0.jar
user=> (defrecord a [])
user.a
user=> (a.)
#user.a{}
user=> #user.a{}
{}
#user.a[]
{}
This should be reopened or declined for another reason than reproducability. |
| Comment by Nicola Mometto [ 10/Mar/13 2:18 PM ] |
|
I'm reopening this since the bug is still there. |
| Comment by Andy Fingerhut [ 13/Mar/13 2:04 PM ] |
|
Patch clj-1093-fix-empty-record-literal-patch-v2.txt dated Mar 13, 2013 is identical to Bronsa's patch 001-fix-empty-record-literal.patch dated Oct 24, 2012, except that it applies cleanly to latest master. I'm not sure why the older patch doesn't but git doesn't like something about it. |
[CLJ-1081] REPL binding not working that works with with-bindings Created: 30/Sep/12 Updated: 01/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Steven Devijver | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
This works as expected: java -jar clojure-1.4.0.jar -e "(do (require 'clojure.repl) (.setDynamic #'clojure.repl/print-doc) (with-bindings {#'clojure.repl/print-doc str} (eval '(clojure.repl/doc println))))"
Output: "{:ns #<Namespace clojure.core>, :name println, :arglists ([& more]), :added \"1.0\", :static true, :doc \"Same as print followed by (newline)\", :line 3325, :file \"clojure/core.clj\"}" But the same thing does not work in the REPL: java -jar clojure-1.4.0.jar -e "(do (require 'clojure.repl) (.setDynamic #'clojure.repl/print-doc) (clojure.main/repl :init (fn [] {#'clojure.repl/print-doc str}))))" Output for Output of {{(doc println)}}: user=> (doc println) |
| Comments |
| Comment by Steven Devijver [ 01/Oct/12 5:51 AM ] |
|
Found a work-around: java -jar clojure-1.4.0.jar -e "(do (require 'clojure.repl) (.setDynamic #'clojure.repl/print-doc) (with-bindings {#'clojure.repl/print-doc str} (clojure.main/repl)))))"
I'm still not sure whether the method above using :init should or should not work. |
[CLJ-1079] Don't squash explicit :line and :column metadata in the MetaReader Created: 29/Sep/12 Updated: 07/Feb/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
I have been experimenting with using cljx to produce Clojure and ClojureScript source from a single file. This has gone well so far, with the exception that, due to the way the source transformation works, all of the linebreaks and other formatting is gone from the output. There is an option to include the original :line metadata in the output though, like so: ;;This file autogenerated from
;;
;; src/cljx/com/foo/hosty.cljx
;;
^{:line 1} (ns com.foo.hosty)
^{:line 3} (defn ^{:clj true} system-hash [x] ^{:line 5} (System/identityHashCode x))
(Hopefully, such hackery won't be necessary in the future with sjacket or something like it...) Unfortunately, when read in using a LineNumberingPushbackReader, code like this has its :line metadata squashed by the line numbers coming from that. A REPL-friendly example would be: => (meta (read (clojure.lang.LineNumberingPushbackReader.
(java.io.StringReader. "^{:line 66} ()"))))
{:line 1}
=> (meta (read (java.io.PushbackReader.
(java.io.StringReader. "^{:line 66} ()"))))
{:line 66}
The latter seems more correct to me (and is equivalent to read-string). |
| Comments |
| Comment by Chas Emerick [ 29/Sep/12 7:07 PM ] |
|
{{CLJ-1097.diff}} contains a fix for this issue, as well as a separate commit that eliminates a series of casts in order to improve readability in the area. |
| Comment by Andy Fingerhut [ 05/Oct/12 8:23 AM ] |
|
Chas, your patch doesn't apply cleanly to latest Clojure master as of Oct 5 2012. I'm not sure, but I think some recent commits to Clojure on Oct 4 2012 caused that. I also take it as evidence of your awesomeness that you can write patches for tickets that haven't been filed yet |
| Comment by Chas Emerick [ 05/Oct/12 9:24 AM ] |
|
"patches for tickets that haven't been filed yet?" Anyway, tweaking up this patch is a small price to pay for having column meta. New {{CLJ-1097.diff}} patch attached, applies clean on master as of now. Otherwise same contents as in the original patch, except:
|
| Comment by Nicola Mometto [ 05/Oct/12 9:39 AM ] |
|
"patches for tickets that haven't been filed yet?" He was referring to the fact that you uploaded "CLJ-1097.diff" while the ticket is #1079 |
| Comment by Chas Emerick [ 05/Oct/12 9:42 AM ] |
|
Oh, hah! Twice now, even! One more data point recommending my having slight dyslexia or somesuch. :-P I've replaced the attached patch with one that is named properly to avoid any later confusion. |
| Comment by Chas Emerick [ 07/Oct/12 3:57 PM ] |
|
Refreshed patch to apply cleanly to master after the recent off by one patch for :column metadata. |
| Comment by Stuart Halloway [ 19/Oct/12 3:12 PM ] |
|
This feels backwards to me. If a special purpose tool wants to convey information via metadata, why does it use names that collide with those used by LispReader? |
| Comment by Chas Emerick [ 19/Oct/12 7:36 PM ] |
|
The information being conveyed is the same :line and :column metadata conveyed by LispReader — in fact, that's where it comes from in the first place. Kibit (and cljx) is essentially an out-of-band source transformation tool. Given an input like this: (ns com.foo.hosty)
(defn ^:clj system-hash
[x]
(System/identityHashCode x))
(defn ^:cljs system-hash
[x]
(goog/getUid x))
…it produces two files, a .clj for Clojure, and a .cljs for ClojureScript. (The first code listing in the ticket description is the former.) However, because there's no way to transform Clojure code/data without losing formatting, anything that depends on line/column numbers (stack traces, stepping debuggers) is significantly degraded. If LispReader were to defer to :line and :column metadata already available on the loaded forms (there when the two generated files are spit out with *print-meta* on), this would not be the case. |
| Comment by Andy Fingerhut [ 07/Feb/13 8:47 AM ] |
|
clj-1079-patch-v2.txt dated Feb 7 2013 is identical to Chas's CLJ-1079.diff dated Oct 7 2012, except it applies cleanly to latest master. I believe the only difference is that some white space in the context lines is updated. |
| Comment by Andy Fingerhut [ 07/Feb/13 12:35 PM ] |
|
Sorry for the noise. I've removed clj-1079-patch-v2.txt mentioned in the previous comment, because I learned that CLJ-1079.diff dated Oct 7 2012 applies cleanly to latest master and passes all tests if you use this command to apply it. % git am --keep-cr -s --ignore-whitespace < CLJ-1079.diff I will update the JIRA workflow page instructions for applying patches to mention this, too, because there are multiple patches that fail without --ignore-whitespace, but apply cleanly with that option. That will eliminate the need to update patches merely for whitespace changes. |
[CLJ-1077] thread-bound? returns true (implying set! should succeed) even for non-binding thread Created: 26/Sep/12 Updated: 01/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Paul Stadig | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
thread-bound? returns true for a non-binding thread, this result (according to the docstring) implies that set! should succeed. However, thread-bound? does not check that any binding that might exist was created by the current thread, and calling set! fails with an exception when it is called from a non-binding thread, even though thread-bound? returns true. thread-bound? should return false if there is a binding, and that binding was not established by the current thread. |
| Comments |
| Comment by Paul Stadig [ 01/Oct/12 10:07 AM ] |
|
I have attached a patch that changes clojure.lang.Var and clojure.core/thread-bound? to only return true if a Var is set!-able. |
[CLJ-1076] pprint tests fail on Windows, expecting \n Created: 26/Sep/12 Updated: 02/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Ivan Kozik | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Windows 7 |
||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
New pprint tests were committed recently, but they fail on Windows because the tests check for \n, while pprint seems to output \r\n. A log with the test failures is attached. The first failing commit is https://github.com/clojure/clojure/commit/4ca0f7ea17888ba7ed56d2fde0bc2d6397e8e1c0 |
| Comments |
| Comment by Andy Fingerhut [ 29/Sep/12 2:27 PM ] |
|
Patch clj-1076-fix-tests-on-windows-patch-v1.txt dated Sep 29 2012 when applied to the particular commit that Ivan mentions causes the tests to pass when I run "ant" on a Windows 7 machine for me, and it continues to pass all tests on Mac OS X 10.6.8, too. I may be doing something wrong, but when I try to run "ant" to build and test on Windows 7 with latest Clojure master, with or without this patch, it fails right at the beginning of the tests because it can't find clojure.test.generative. I'm probably doing something wrong somewhere. Ivan, would you be able to test this patch on Windows with the latest Clojure master to see if all tests pass for you now? |
| Comment by Ivan Kozik [ 29/Sep/12 2:59 PM ] |
|
All tests pass on Windows 7 here with the patch. Ant can't find my test.generative either because it isn't in my "${maven.test.classpath}". I put it in CLASSPATH and modified my build.xml like this: |
| Comment by Andy Fingerhut [ 10/Dec/12 1:33 PM ] |
|
Just as a rough idea of how often people are hitting this issue, |
| Comment by Mike Anderson [ 18/Jan/13 7:44 PM ] |
|
Hi there is this likely to get fixed soon? I'd like to help contribute some more patches to Clojure but it's tricky to do when I can't get the build to work |
| Comment by Andy Fingerhut [ 18/Jan/13 8:39 PM ] |
|
I do not know if or when this patch will be committed to Clojure. I can tell you that you can apply the patch to your own local copy of the Clojure source code, and then develop new Clojure patches based upon that version. The patch that fixes this problem only affects one test file, so it is unlikely to conflict with any changes you develop and submit. |
| Comment by Mike Anderson [ 21/Jan/13 6:36 AM ] |
|
I can confirm this patch works fine for me on Windows with Maven/Eclipse Suggest this patch gets pushed through approval and applied ASAP? It's a pretty obvious fix that is breaking the build.... |
| Comment by Stuart Halloway [ 01/Mar/13 12:44 PM ] |
|
This patch is sloppy – it makes unnecessary whitespace changes in several places. Would it be better to make the tests trailing whitespace agnostic? Otherwise this feels like poking and prodding until the build box is happy. |
| Comment by Andy Fingerhut [ 02/Mar/13 2:50 PM ] |
|
Patch clj-1076-fix-tests-on-windows-patch-v2.txt dated Mar 2, 2013 fixes pprint tests on Windows in a different way: Removing all occurrences of carriage return (\r) characters in the output of pprint before comparing it to the expected string. I tried simply doing str/trim-newline to remove newlines and carriage returns at the end of the string, but that does not make the tests pass. They still fail due to carriage returns in the middle of the string. |
| Comment by Andy Fingerhut [ 02/Mar/13 2:51 PM ] |
|
Presumptuously changing Approval from Incomplete back to None, since there is a new patch attached that should address the reason it was marked Incomplete. |
[CLJ-1059] PersistentQueue doesn't implement java.util.List, causing nontransitive equality Created: 03/Sep/12 Updated: 11/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Philip Potter | Assignee: | Philip Potter |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
|
PersistentQueue implements Sequential but doesn't implement java.util.List. Lists form an equality partition, as do Sequentials. This means that you can end up with nontransitive equality: (def q (conj clojure.lang.PersistentQueue/EMPTY 1 2 3)) This happens because PersistentQueue is a Sequential but not a List, ArrayList is a List but not a Sequential, and PersistentVector is both. |
| Comments |
| Comment by Philip Potter [ 15/Sep/12 3:41 AM ] |
|
Whoops, according to http://dev.clojure.org/display/design/JIRA+workflow I should have emailed clojure-dev before filing this ticket. Here is the discussion: https://groups.google.com/d/topic/clojure-dev/ME3-Ke-RbNk/discussion |
| Comment by Philip Potter [ 15/Sep/12 2:37 PM ] |
|
Attached 001-make-PersistentQueue-implement-List.diff, 15/Sep/12 Note that this patch has a minor conflict with the one I added to |
| Comment by Chouser [ 18/Sep/12 1:04 AM ] |
|
Philip, patch looks pretty good – thanks for doing this. A couple notes: This is only my opinion, but I prefer imports be listed without wildcards, even if it means an extra couple lines at the top of a .java file. I noticed the "List stuff" code is a copy of what's in ASeq and EmptyList. I suppose this is copied because EmptyList and PersistentQueue extend Obj and therefore can't extend ASeq. Is this the only reason? It seems a shame to duplicate these method definitions, but I don't know of a better solution, do you? It would also be nice if the test check a couple of the List methods you've implemented. |
| Comment by Chouser [ 18/Sep/12 1:08 AM ] |
|
oh, also "git am" refused to apply the patch, but I'm not sure why. "patch -p 1" worked perfectly. |
| Comment by Philip Potter [ 18/Sep/12 1:19 AM ] |
|
did you use the --keep-cr option to git am? I struggled to know whether I should be adding CRs or not to line endings, because the files I was editing weren't consistent in their usage. If you open them in emacs, half the lines have ^M at the end. |
| Comment by Philip Potter [ 18/Sep/12 1:21 AM ] |
|
Will submit another patch, with the import changed. I'll have a think about the list implementation and see what ideas I can come up with. |
| Comment by Philip Potter [ 18/Sep/12 3:17 PM ] |
|
Attached 002-make-PersistentQueue-implement-Asequential.diff This patch is an alternative to 001-make-PersistentQueue-implement-List.diff So I took on board what you said about ASeq, but it didn't feel right making PersistentQueue directly implement ISeq, somehow. So I split ASeq into two parts – ASequential, which implements j.u.{Collection,List} and manages List-equality and hashcodes; and ASeq, which... doesn't seem to be doing much anymore, to be honest. As a bonus, this patch fixes (It turns out that because ASeq was already implementing Obj, the fact that PersistentQueue was implementing Obj was no barrier to using it.) Would appreciate comments on this approach, and how it differs from the previous patch here and the patch on |
| Comment by Philip Potter [ 18/Sep/12 3:44 PM ] |
|
Looking at EmptyList's implementation of List, it is a duplicate of the others, but it shouldn't be. I think its implementation of indexOf is the biggest culprit - it should just be 'return -1;' but it has a great big for loop! But this is beyond the scope of this ticket, so I won't patch that here. |
| Comment by Andy Fingerhut [ 20/Oct/12 12:29 PM ] |
|
Philip, now that the patch for |
| Comment by Philip Potter [ 22/Oct/12 5:10 AM ] |
|
Andy, thanks so much for your efforts to make people aware of these things. I will indeed submit new patches, hopefully later this week. |
| Comment by Philip Potter [ 03/Nov/12 12:23 PM ] |
|
Replaced existing patches with new ones which apply cleanly to master. There are two patches: 001-clj-1059-make-persistentqueue-implement-list.diff This fixes equality by making PersistentQueue implement List directly. I also took the opportunity to remove the wildcard import and to add tests for the List methods, as compared with the previous version of the patch. 002-clj-1059-asequential.diff This fixes equality by creating a new abstract class ASequential, and making PersistentQueue extend this. My preferred solution is still the ASequential patch, but I'm leaving both here for comparison. |
| Comment by Timothy Baldridge [ 30/Nov/12 3:37 PM ] |
|
Vetting. |
| Comment by Andy Fingerhut [ 11/Dec/12 12:50 PM ] |
|
Philip, this time I think it was patches that were committed for |
| Comment by Philip Potter [ 11/Dec/12 1:57 PM ] |
|
Thanks Andy. Submitted a new patch, 002-clj-1059-asequential-rebased-to-cached-hasheq.diff, which supersedes 002-clj-1059-asequential.diff. The patch 001-clj-1059-make-persistentqueue-implement-list.diff still applies cleanly, and is still an alternative to 002-clj-1059-asequential-rebased-to-cached-hasheq.diff. |
[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-1046] Drop-while as a reducer Created: 18/Aug/12 Updated: 18/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Implement drop-while as a reducer. Follows the same atom-based strategy as drop and take. Does not depend on any of my other reducer patches, but there will probably be some minor merge conflicts unless it is merged after CLJ-1045, and before CLJ-992 and CLJ-993. |
[CLJ-1045] Generalize/refactor implementation of PersistentVector/coll-fold Created: 18/Aug/12 Updated: 25/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Vector currently contains a specialized implementation of the folding algorithm "split the collection in half until the pieces are small enough". The attached commit lifts out the general strategy so that it can be reused by other collection types amenable to splitting. CLJ-993 depends on this patch, as it uses the new fold-by-halves function. |
| Comments |
| Comment by Andy Fingerhut [ 25/Jan/13 2:29 PM ] |
|
clj-1045-fold-by-halves-patch-v2.txt dated Jan 25 2013 is identical to fold-by-halves.patch dated Aug 18 2012, except it updates one line of context changed by a recent commit to Clojure master. |
[CLJ-1037] Allow doc strings for both interfaces and concrete implementations Created: 04/Aug/12 Updated: 04/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Warren Lynn | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In this post I mentioned the rationale (I think) why this is important and needed. Thank you for consideration. |
[CLJ-1036] Util/hasheq should be hashing a BigInteger to the same values as Long, and BigInt Created: 02/Aug/12 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Paul Stadig | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Not Approved |
| Description |
|
The doc string for hash states that it defines a hash code function that is consistent with =, but for java.math.BigInteger hash is not consistent with =. user=> (apply = [(Long. -1) -1N (biginteger -1)]) true user=> (map hash [(Long. -1) -1N (biginteger -1)]) (0 0 -1) user=> It is possible to have a PHM with two key/value pairs where the keys are equal, and the hash codes are different: user=> (assoc clojure.lang.PersistentHashMap/EMPTY (biginteger -1) :oops! -1N :one)
{-1N :one, -1 :oops!}
The expected behavior is the same as PersistentArrayMap, which does not have this issue, because it does not hash its keys: user=> (assoc clojure.lang.PersistentArrayMap/EMPTY (biginteger -1) :oops! -1N :one)
{-1 :one}
This same misbehavior also occurs for Doubles and Floats: thalia.core=> (apply = [(Float. 1e9) (Double. 1e9)]) true thalia.core=> (map hash [(Float. 1e9) (Double. 1e9)]) (1315859240 1104006501) That leads to the same difference in array-map and hash-map behavior as above for BigInteger and BigInt. |
| Comments |
| Comment by Paul Stadig [ 02/Aug/12 9:55 AM ] |
|
Also, the biginteger function has metadata saying that it has been added since 1.0, but it was actually added in 1.3. The bigint function has metadata saying that it has been added since 1.3, but it has been added since 1.0. I think during the work to implement BigInt someone renamed the existing bigint function (which used to return a BigInteger) to biginteger, and the metadata got carried with it, then a new bigint function was added with :since 1.3 metadata even though that function name has existed since 1.0. |
| Comment by Andy Fingerhut [ 26/Sep/12 11:59 AM ] |
|
clj-1036-hasheq-for-biginteger-patch-v1.txt dated Sep 26 2012 makes BigInteger's return equal hash values for values considered equal by =. It does the same for Float and Double types, which before returned different hash values for values considered equal by = I went ahead and changed the :added metadata on bigint and biginteger, although I can see that without my change, the person who did that may have meant for the :added to go with the behavior of the function, not with the name. Paul's suggested change that I have in the patch is for the :added metadata to go with the name, not the function behavior. It is easy to remove that part of the patch if that change is not desired. |
| Comment by Rich Hickey [ 13/Nov/12 3:29 PM ] |
|
You can't just consider only the lower long of bigints. Also, what's the rationale for the float stuff? |
| Comment by Andy Fingerhut [ 13/Nov/12 9:44 PM ] |
|
clj-1036-hasheq-for-biginteger-patch-v2.txt dated Nov 13 2012 is identical to clj-1036-hasheq-for-biginteger-patch-v1.txt except that it addresses Rich's comment that for BigInt's and BigInteger values that don't fit in a long, their entire value must be hashed. The rationale for the changes to hasheq for Float and Double types is the same as the rationale for the change for BigInteger: without that change, Float and Double types that are = can have different hasheq values. |
| Comment by Paul Stadig [ 14/Nov/12 5:18 AM ] |
|
Although you are correct that Double and Float are =, but have different hashes: user=> (apply = [(Double. -1.0) (Float. -1.0)]) true user=> (map hash [(Double. -1.0) (Float. -1.0)]) (-1074790400 -1082130432) I could not get the same errant behavior out of PHM: user=> (assoc clojure.lang.PersistentHashMap/EMPTY (Float. -1.0) :oops! (Double. -1.0) :one)
{-1.0 :one}
I haven't taken the time to investigate exactly what is happening here, but either way I think this ticket is very specifically about BigInteger and the Float/Double issue could be explored in another ticket. |
| Comment by Andy Fingerhut [ 14/Nov/12 10:08 AM ] |
|
I can open another ticket for the Float/Double issue if that is what people would prefer. I think what is happening in the test case you give, Paul, is that the hash values for (Float. -1.0) and (Double. -1.0) happen to be the same in their least significant 20 bits, and PHM isn't using the upper bits where the hash values differ. Clojure 1.5.0-beta without patch: There are other Float/Double values where this lucky accident doesn't happen, e.g. Clojure 1.5.0-beta1 without patch: user=> (= (Float. 1e9) (Double. 1e9)) With 1.5.0-beta1 plus patch clj-1036-hasheq-for-biginteger-patch-v2.txt: user=> (= (Float. 1e9) (Double. 1e9)) |
| Comment by Andy Fingerhut [ 01/Jan/13 11:30 AM ] |
|
Presumptuously changing status from Not Approved to Vetted, since patch clj-1036-hasheq-for-biginteger-patch-v2.txt should address the reasons that Rich marked the previous patch as Not Approved. Changing it to Vetted on the assumption that if Stuart Halloway marked the previous patch as Screened, the ticket itself is good enough to be Vetted. |
| Comment by Rich Hickey [ 12/Apr/13 8:48 AM ] |
|
Patches and tickets need to be better than this. Talks about BigInteger, changes hash for doubles. Lists problem but not approach, need to trawl through comments and code to see what's going on, etc. |
[CLJ-1022] gen-class destroys method annotations Created: 03/Jul/12 Updated: 03/Jul/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Maris Orbidans | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug | ||
| Description |
|
When extending a class gen-class doesn't preserve method annotations. If class com.bar.Foo has annotated methods then in MyClass all annotations are gone. (gen-class (defn demo-post-init [this] (defn demo-get [_] Class<?> aClass = Class.forName("com.my.MyClass"); for (Method m : methods) { |
[CLJ-1016] Global scope overrides lexical scope for classes (Clojure assumes no classes in default package / Clojure cannot handle yFiles JARs in classpath) Created: 21/Jun/12 Updated: 24/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Edward Z. Yang | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
The most visible symptom of this bug is having a class named 'w' (default package) in your classpath (such classes are produced by Java obfuscation tools such as yFiles) and then attempting to load Clojure's core class. For example: java -cp hotspotapi.jar:clojure-1.4.0-slim.jar clojure.main (where hotspotapi.jar is a stereotypical example of an obfuscated JAR) results in: Exception in thread "main" java.lang.ExceptionInInitializerError To understand what is going on, consider this simple test: import java.io.StringReader; import clojure.lang.Compiler; public class Test { It should be clear that 'mumble' in the dot operator is referencing the locally defined mumble. However, if we define a class named 'mumble' in the default package, Clojure picks that one up instead. To forestall any objections: yes, we know that placing classes in the default package is extremely poor form. Point of the matter is, the Java ecosystem is extremely diverse and there are a lot of JARs people may not have control over. While one might argue, "Don't put classes in the default namespace", point of the matter is, Clojure is wrong here, and these situations arise in practice, through no fault of the implementer. |
| Comments |
| Comment by Edward Z. Yang [ 21/Jun/12 11:01 AM ] |
|
Here is a workaround patch which makes this error less likely to occur. |
| Comment by Andy Fingerhut [ 27/Aug/12 7:37 PM ] |
|
Edward, it is Rich Hickey's policy only to consider for inclusion in Clojure patches written by people who have signed a Contributor Agreement: http://clojure.org/contributing Were you interested in becoming a contributor? |
| Comment by Edward Z. Yang [ 27/Aug/12 9:24 PM ] |
|
Sure, although the patch attached is emphatically not the one you want to actually applying, since it only band-aids the problem. |
| Comment by Andy Fingerhut [ 24/May/13 1:21 PM ] |
|
I am not sure, but this ticket may be related to CLJ-1171. At least, there the issue was a global name not being shadowed by a local name bound with let. That seems similar to this issue. |
[CLJ-1013] Clojure's classloader cannot handle out-of-order loading Created: 13/Jun/12 Updated: 13/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Edward Z. Yang | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Here is a minimal test-case: import java.io.IOException; import clojure.lang.PersistentTreeMap; public class TestClass { static Class y = RT.class; /**
} This results in the exception: Exception in thread "main" java.lang.ExceptionInInitializerError The crux of the issue appears Clojure's classloader doesn't understand how to handle out-of-order classloading. |
[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-1001] Proxy cannot call proper super-class method Created: 23/May/12 Updated: 23/May/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2, Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Guanpeng Xu | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux herberteuler 3.2.0-2-amd64 #1 SMP Sat May 12 23:08:28 UTC 2012 x86_64 GNU/Linux |
||
| Attachments: |
|
| Description |
|
Attached is a program that reproduces this issue. We have a proxy, `p', which sub-classes java.io.InputStream. There are three methods named `read' in java.io.InputStream: abstract int read(); int read(byte[] b); and int read(byte[] b, int off, int len); see http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html. In the definition of proxy `p', we implement the abstract variant of method `read', making `p' a concrete instance of java.io.InputStream. The first invocation, (. p read), returns -1, which is expected. The second invocation, (. p (read b 0 n)), should call int read(byte[] b, int off, int len); in java.io.InputStream. But these are actual behavior: $ clojure1.2 ~/tmp/proxy-bug.clj $ clojure1.2 ~/tmp/proxy-bug.clj |
| Comments |
| Comment by Guanpeng Xu [ 23/May/12 10:24 PM ] |
|
The second behavior should be in Clojure 1.3: $ clojure1.3 ~/tmp/proxy-bug.clj Sorry for the inconvenience. |
[CLJ-995] sorted-set doesn't support IEditableCollection Created: 13/May/12 Updated: 04/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Moritz Ulrich | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I think sorted-set (PersistentTreeSet) should implement the transient interface. It's a special-purpose set and should be usable just like every normal set. |
| Comments |
| Comment by Michel Alexandre Salim [ 04/Jun/12 2:32 AM ] |
|
Note that this would require PersistentTreeMap to implement IEditableCollection as well. |
[CLJ-994] repeat reducer Created: 11/May/12 Updated: 14/Sep/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Jason Jackson | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
i'm working on clojure.core/repeat reducer. |
| Comments |
| Comment by Andy Fingerhut [ 17/May/12 6:18 PM ] |
|
Jason, have you tried to build this using JDK 1.6.0? I've tried on Mac OS X 10.6.8 + Oracle/Apple JDK 1.6.0 and Ubuntu 11.10 + IBM JDK 1.6.0, and on both it compiles, but during the tests fails with a ClassNotFoundException for class jsr166y.ForkJoinTask. It builds and tests cleanly on Ubuntu 11.10 + Oracle JDK 1.7.0 for me. |
| Comment by Jason Jackson [ 17/May/12 6:41 PM ] |
|
That's an issue that applies to all of core.reducers. Alan Malloy experienced it as well. I tried fixing it, but eventually just upgraded to JDK 1.7. I don't understand why it's happening. |
| Comment by Jason Jackson [ 19/May/12 2:55 PM ] |
|
This issue is isolated to mvn test afaik. When I include clojure inside a leiningen project, and add jsr166y.jar to lib directory, core.reducers works fine with java 1.6. |
| Comment by Andy Fingerhut [ 20/May/12 3:00 AM ] |
|
Jason, you say it applies to all of core.reducers in your May 17, 2012 comment. I don't understand. Without your patch applied, I can run "./antsetup.sh ; ant" in a freshly-pulled Clojure git repo on either of the JDK 1.6.0 versions mentioned in my earlier comment, and do not get any errors during the tests. Are you saying perhaps that core.reducers currently has no tests that exercise the problem now, but your patch adds such tests that fail, even with no other changes to the code? |
| Comment by Jason Jackson [ 20/May/12 11:55 AM ] |
|
Yah that's right. Now that you mention it, my patch is the first unit test to call r/fold (the existing tests do non-parallel reductions). |
| Comment by Andy Fingerhut [ 08/Jun/12 7:11 PM ] |
|
With Stuart Halloway's commit to Clojure master on June 8, 2012 titled "let reducers tests work under ant", patch 0001-repeat-for-clojure.core.reducers.patch dated May 11, 2012 now runs correctly even the new unit tests requiring class jsr166y.ForkJoinTask with Oracle/Apple JDK 1.6 and Linux IBM JDK 1.6. |
| Comment by Jason Jackson [ 14/Aug/12 1:17 AM ] |
|
I'm on the contributors list. Is this patch still needed? |
| Comment by Jason Jackson [ 14/Sep/12 2:37 PM ] |
|
This patch should wait until http://dev.clojure.org/jira/browse/CLJ-993 is committed. I think there's a some shared code. |
[CLJ-993] `range` reducer Created: 10/May/12 Updated: 18/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Rich mentioned in IRC today he'd welcome a reducer implementation of clojure.core/range. Now that I've figured out how to do iterate, I figure I'll knock out range as well by the end of the night. Just opening the issue early to announce my intentions to anyone else interested in doing it. |
| Comments |
| Comment by Alan Malloy [ 10/May/12 10:45 PM ] |
|
Implemented range. A separate commit is attached, making iterate and range also Seqable, since I'm not sure if that's desired. Apply it or not, as you prefer. |
| Comment by Jason Jackson [ 11/May/12 11:20 AM ] |
|
Range should be foldable |
| Comment by Alan Malloy [ 11/May/12 12:53 PM ] |
|
Yep, so it should. Time for me to dig into the folding implementations! |
| Comment by Alan Malloy [ 11/May/12 2:42 PM ] |
|
Should I fold (har har) all of these commits into one? I don't know what is preferred on JIRA, and I also don't know whether range/iterate should be seqable or if I should just drop the second commit. |
| Comment by Rich Hickey [ 11/May/12 3:21 PM ] |
|
Yes, please merge these together, it's hard to see otherwise (I can barely read diffs as is |
| Comment by Alan Malloy [ 11/May/12 3:30 PM ] |
|
So you want clojure.core/range to return some object (a Range), which implements Counted and Seqable (but isn't just a lazy-seq), and then inside of clojure.core.reducers I extend CollReduce and CollFold to that type? Okay, I can do that. I don't quite follow what you mean by an allocating protocol. I see your point that my fold-by-halves which takes a function in is analogous to a protocol with a single function, but it doesn't allocate anything more than foldvec already does - I just pulled that logic out so that the fork/join fiddly work doesn't need to be repeated in everything foldable. Do you have an alternative recommendation, or is it just something that makes you uneasy and you're still thinking about? |
| Comment by Rich Hickey [ 11/May/12 3:52 PM ] |
|
While vector-fold allocs subvecs, the halving-fn must return a new vector, for all implementations. It's ok, I don't think it's likely to dominate (since fj needs new closures anyway). Please proceed, but keep range and iterate in core. They are sources, not transformers, and only transformers (which must be different from their seq-based counterparts) must reside in reducers. Thanks! |
| Comment by Stuart Sierra [ 11/May/12 5:01 PM ] |
|
One big patch file is preferred, although that file may contain multiple commits if that makes the intent clearer. When adding a patch, update the description of the ticket to indicate which file is the most recent. Leave old patch files around for historical reference. |
| Comment by Alan Malloy [ 11/May/12 9:00 PM ] |
|
It's looking harder than I expected to move iterate and range into core.clj. My plan was to just have them implement Seqable, which is easy enough, but currently they are actually instances of ISeq, because they inherit from LazySeq. A bunch of code all over the place (eg, to print them in the repl) depends on them being ISeq, so I can't just ignore it. To implement all of these methods (around thirty) would take a large amount of code, which can't easily be shared between Iteration, Range, and any future reducible sources that are added to core.clj. I could write a macro like (defseq Range [start end step] Counted (count [this] ...) ...) which takes normal deftype args and also adds in implementations for ISeq, Collection, and so forth in terms of (.seq this), which will be a LazySeq. However, this seems like a somewhat awkward approach that I would be a little embarrassed to clutter up core.clj with. If anyone has a better alternative I will be pleased to hear it. In the mean time, I will go ahead with this macro implementation, in case it turns out to be the best choice. |
| Comment by Alan Malloy [ 11/May/12 11:52 PM ] |
|
– This patch subsumes all previous patches to this issue and to CLJ-992 – In order to create an object which is both a lazy sequence and a If we wanted, we could use this macro to implement lazy-seq in clojure instead of in java, but that's unrelated so I didn't do that in this patch. As noted in a previous comment, defseq may not be the right approach, but this works until something better is suggested. |
| Comment by Alan Malloy [ 11/May/12 11:58 PM ] |
|
I accidentally included an implementation of drop-while in this patch, which I was playing around with to make sure I understood how this all works. I guess I'll leave it in for the moment, since it works and is useful, but I can remove it, or move it to a new JIRA ticket, if it's not wanted at this time. |
| Comment by Rich Hickey [ 12/May/12 10:52 AM ] |
|
Ok, I think this patch is officially off the rails. There must be a better way. Let's start with: touching core/deftype and reimplementing lazy-seq as a macro are off the table. The return value of range doesn't have to be a LazySeq, it has to be a lazy seq, .e.g. implement ISeq (7 methods, not 30) which it can do by farming out to its existing impl. It can also implement some new interface for use by the reducer logic. There is also still clojure.lang.Range still there, which is another approach. Please take an extremely conservative approach in these things. |
| Comment by Alan Malloy [ 12/May/12 5:53 PM ] |
|
Okay, thanks for the feedback - I'm glad I went into that last patch knowing it was probably wrong It's still an unpleasant chunk of boilerplate for each new source, though; would you welcome a macro like defseq if I didn't put it in core_deftype? If so, it seems like it might as well implement the interop interfaces; if not, I can skip them and implement the 7 (isn't it more like 9?) methods in ISeq, IPersistentCollection, and Seqable for each new source type. Thanks for pointing out clojure.lang.Range to me - I didn't realize we had it there. Of course with implementation inheritance it would be easy to make Range, Iteration, etc inherit from LazySeq and just extend protocols from them. But that means moving functionality out of clojure and into java, which I didn't think we'd want to do. I'll put together a patch that just implements ISeq by hand for both of these new types, and attach it probably later today. |
| Comment by Alan Malloy [ 12/May/12 7:49 PM ] |
|
So I've written a patch that implements ISeq, but not the java Collections interfaces, and it mostly works but there are definitely assumptions in some parts of clojure.core and clojure.lang that assume seqs are Collections. The most obvious to me (ie, it shows up when running mvn test) is RT/toArray - it tests for Collection, but never for ISeq, implying that it's not willing to handle an ISeq that is not also a collection. Functions which rely on toArray (eg to-array and vec) now fail. This patch subsumes all previous patches on this issue, but is not suitable for application because it leaves some failing tests behind - it is intended only for intermediate feedback. |
| Comment by Rich Hickey [ 13/May/12 8:50 AM ] |
|
It would be a great help if, time permitting, you could please write up the issues, challenges and options you've discovered somewhere on the dev wiki (even a simple table would be fantastic). I realize this has been a challenging task, and at this point perhaps we should opt for the more modest reducers/range and reducers/iterate and leave the two worlds separate. I'd like at some point to unify range, as there are many extant ranges it would be nice to be able to fold, as we can extant vectors. |
| Comment by Jason Jackson [ 13/May/12 9:24 AM ] |
|
Should r/range return something Seqable and Counted? If so, I'll do the same for r/repeat. |
| Comment by Alan Malloy [ 13/May/12 1:59 PM ] |
|
I've sketched out a description of the issues and options. I'm not very familiar with the dev wiki and couldn't figure out where was the right place to put this. "release.next" seems to still be about 1.4 issues, and I don't know if it's "appropriate" to create a whole new category for this. It's available as a gist until a better home can be found for it. |
| Comment by Alan Malloy [ 23/May/12 7:54 PM ] |
|
Here's a single patch summing up the state Rich suggested "rolling back" to: separate r/range and r/iterate functions. I haven't heard any feedback since doing the writeup Rich asked for, so am not making any further progress at the moment; if something other than this patch is desired just let me know. |
| Comment by Rich Hickey [ 14/Aug/12 2:07 PM ] |
|
I prefer not to see the use of extend like this for new types. Perhaps this code is too DRY? Also, it does a lot in one patch which makes it hard to parse and accept. This adds Range, switches impl of vector folds etc. Can it be broken up into separate tickets that do each step that builds on the previous, e.g. one ticket could be: capture vector fold impl for reuse by similar things. |
| Comment by Alan Malloy [ 18/Aug/12 6:19 PM ] |
|
Okay, I should be able to split it up over the weekend. I'll also see about converting fold-by-halves into a function that is used by Range/Vector, rather than a function that gets extended onto them. |
| Comment by Alan Malloy [ 18/Aug/12 7:18 PM ] |
|
As requested, I have split up the large patch on this issue into four smaller tickets. The other three are: CLJ-1045, CLJ-1046, and CLJ-992. CLJ-1045 contains the implementation of fold-by-halves, and as such this patch cannot be applied until CLJ-1045 is accepted. This ticket does not depend on the other two, but there will be minor merge conflicts if this is merged before them. |
[CLJ-992] `iterate` reducer Created: 10/May/12 Updated: 12/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
|
Added a reducer implementation mirroring clojure.core/iterate. |
| Comments |
| Comment by Alan Malloy [ 10/May/12 9:50 PM ] |
|
Should I have made this implement Seqable as well? It wasn't clear to me, because as far as I could see this was the only function in clojure.core.reducers that's generating a brand-new sequence rather than transforming an existing one. |
| Comment by Alan Malloy [ 10/May/12 10:24 PM ] |
|
Previous version neglected to include the seed value of the iteration in the reduce. |
| Comment by Jason Jackson [ 11/May/12 11:23 AM ] |
|
Currying iterate seems useless, albeit not harmful. While implementing repeat, I couldn't use currying. Because 1-arity is already reserved for infinite repeat ([n x] and [x], not [n x] and [n] if currying) How about we just support currying for functions where last param is reducible? |
| Comment by Alan Malloy [ 18/Aug/12 7:16 PM ] |
|
This new patch replaces the previous patch. As requested, I am splitting up the large issue CLJ-993 into smaller tickets. Does not depend on any of my other reducer patches, but there will probably be some minor merge conflicts unless it is merged after CLJ-1045 and CLJ-1046, and before CLJ-993. |
[CLJ-986] Adds an exit function to exit clojure process Created: 06/May/12 Updated: 06/May/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | dennis zhuang | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | exit, function, quit | ||
| Description |
|
There is no standard function to exit the clojure process. Why not add a standard function in clojure.core? (defn exit I think it's useful for us. |
[CLJ-979] map->R returns different class when invoked from AOT ccode Created: 03/May/12 Updated: 13/May/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Edmund Jackson | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Mac OS X 10.5, lein 1.7 and lein 2.0 |
||
| Description |
|
(defrecord Dontwork [a]) (= (type (Dontwork. nil)) Will return true if the namespace is not AOT compiled and false if it is. I have created a small example project with AOT and non-AOT namespaces to demonstrate |
| Comments |
| Comment by Scott Lowe [ 12/May/12 9:05 PM ] |
|
I can't reproduce this under Clojure 1.3 or 1.4, and Leiningen 1.7.1 on either Java 1.7.0-jdk7u4-b21 OpenJDK 64-Bit or Java 1.6.0_31 Java HotSpot 64-Bit. OS is Mac OS X 10.7. Edmund, how are you running this AOT code? I wrapped your code in a main function and built an uberjar from it. |
| Comment by Edmund Jackson [ 13/May/12 2:20 AM ] |
|
Hi Scott, Interesting. I have two use cases 2. My original use case, which I've minimised here, is an AOT ns, producing a genclass that is called instantiated from other Java (no main). This produces the same error. I will produce an example of this and post it too. |
| Comment by Edmund Jackson [ 13/May/12 4:23 AM ] |
|
Hi Scott, Here is an example of it failing in the interop case: https://github.com/ejackson/aotquestion2 git clone git@github.com:ejackson/aotquestion2.git and it dies with this: Exception in thread "main" java.lang.ClassCastException: cljside.core.Dontwork cannot be cast to cljside.core.Dontwork The error message is really confusing (to me, anyway), but I think its the same root problem as for the REPL case. What do you see when you run the above ? |
| Comment by Scott Lowe [ 13/May/12 8:41 AM ] |
|
Ah, yes, looks like my initial attempt to reproduce was too simplistic. I used your second git repo, and can now confirm that it's failing for me with the same error. |
| Comment by Scott Lowe [ 13/May/12 10:35 PM ] |
|
I looked into this a little further and the AOT generated code looks correct, in the sense that both code paths appear to be returning the same type. However, I wonder if this is really a ClassLoader issue, whereby two definitions of the same class are being loaded at different times, because that would cause the x.y.Class cannot be cast to x.y.Class exception that we're seeing here. |
[CLJ-978] bean unable to handle non-public classes Created: 30/Apr/12 Updated: 29/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Charles Duffy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Take the following Java as an example: public interface IFoo { String getBar(); } class FooImpl { String getBar() { return "bar"; } } As presently implemented, (bean my-foo) tries to invoke the following: (. #<Method public java.lang.String FooImpl.getBar> (invoke my-foo nil)) However, as FooImpl is not public, this fails: java.lang.IllegalAccessException: Class clojure.core$bean$fn__1827$fn__1828 can not access a member of class FooImpl with modifiers "public" at sun.reflect.Reflection.ensureMemberAccess (Reflection.java:65) java.lang.reflect.Method.invoke (Method.java:588) clojure.core$bean$fn__1827$fn__1828.invoke (core_proxy.clj:382) clojure.core$bean$v__1832.invoke (core_proxy.clj:388) clojure.core$bean$fn__1838$thisfn__1839$fn__1840.invoke (core_proxy.clj:406) clojure.lang.LazySeq.sval (LazySeq.java:42) clojure.lang.LazySeq.seq (LazySeq.java:60) clojure.lang.RT.seq (RT.java:473) However, the same thing succeeds if we call #<Method public java.lang.String Foo.getBar> rather than #<Method public java.lang.String FooImpl.getBar>. |
| Comments |
| Comment by Charles Duffy [ 30/Apr/12 10:40 PM ] |
|
Fix inaccurate documentation string |
| Comment by Charles Duffy [ 01/May/12 9:41 AM ] |
|
Apache Commons Beanutils has their own implementation of this, at http://www.docjar.com/html/api/org/apache/commons/beanutils/MethodUtils.java.html#771 – notably, it tries to reflect a method with the given signature and catches the exception on failure, rather than iterating through the whole list. This may be a better approach – I'm unfamiliar with how the cost of exception handling compares with that of reflecting on the full method list of a class. |
| Comment by Charles Duffy [ 01/May/12 10:11 AM ] |
|
Prior version of patch were missing new test suite files. Corrected. |
| Comment by Andy Fingerhut [ 04/May/12 2:48 AM ] |
|
Thanks for the patches, Charles. Could you please create a patch in the desired format and attach that, and then remove the obsolete patches? Instructions for creating a patch are under the heading "Development" at this page: http://dev.clojure.org/display/design/JIRA+workflow Instructions for removing patches are under the heading "Removing patches" on that same page. |
| Comment by Charles Duffy [ 06/May/12 2:59 PM ] |
|
Added a patch created per documented process. |
| Comment by Gary Trakhman [ 04/Oct/12 6:44 PM ] |
|
I found in my code that it's possible to get a NPE if there is no read-method, for instance on the http://docs.cascading.org/cascading/2.0/javadoc/cascading/flow/hadoop/HadoopFlow.html object which has a setCascade method but no getter. I fixed this in our code by inlining the is-zero-args check into the public-method definition and and-ing the whole thing with 'method' like the original 'bean' code, like so: public-method (and method (zero? (alength (. method (getParameterTypes)))) |
| Comment by Rich Hickey [ 29/Nov/12 10:01 AM ] |
|
Charles, I think we should follow Apache BeanUtils on this. Exceptions not thrown are cheap. Ordinarily, exception for control flow are bad, but this is forced by bad design of reflection API. |
[CLJ-971] Jar within a jar throws a runtime error Created: 10/Apr/12 Updated: 10/Apr/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2, Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Ron Romero | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug | ||
| Environment: |
Maven using the one-jar plugin |
||
| Description |
|
I've created two jar files in my multi-project Maven setup. The first jar is the "engine", and it includes the clojure jar in it. The other jar is the "application". It includes the engine and then packages itself into a one-jar jar file. This means we have a jar within a jar: The "onejar" contains the engine jar, which in turn contains that clojure jar. I then get an error in the runtime: Exception in thread "main" java.lang.reflect.InvocationTargetException See also my Stack Overflow question on this at http://stackoverflow.com/questions/7763480/making-an-executable-jar-that-evals-clojure-strings In researching it, I've found the problem lies in RT.lastModified, where it tries to determine last modified time by looking at the modified time on the jar file for Clojure. But there's not actually a jar file, since it's embedded in another. I've found that adding a null check solves the problem. My lastModified looks like this now: static public long lastModified(URL url, String libfile) throws Exception{ return url.openConnection().getLastModified(); This runs successfully. If you'd prefer, I can submit a patch, or commit directly. |
[CLJ-969] Symbol/keyword implements IFn for lookup but a non-collection argument produces non-intuitive results Created: 09/Apr/12 Updated: 09/Apr/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Sean Corfield | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
('+ 1 2) ;; return 2 because it is treated as (get 1 '+ 2) Whilst this is "consistent" once you know the lookup behavior, it's confusing for Clojure newbies and it seems to be a non-useful behavior. Proposal: modify Keyword.invoke() and Symbol.invoke() to restrict first Object argument to instanceof ILookup, Map or IPersistentSet (or null) so that the "not found" behavior doesn't produce non-intuitive behavior. |
[CLJ-968] ns emitting gen-class before imports results in imported annotations being discarded. Created: 09/Apr/12 Updated: 09/Apr/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Charles Duffy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The following discards the imported annotations: (ns com.example.BaseXModuleTest (:import (org.basex.query QueryModule QueryModule$Deterministic)) (:gen-class :extends org.basex.query.QueryModule :methods [ [^{QueryModule$Deterministic {}} addOne [int] int]])) However, when moving the gen-class call out of the ns declaration, the annotation is correctly applied: (ns com.example.BaseXModuleTest (:import (org.basex.query QueryModule QueryModule$Deterministic))) (gen-class :extends org.basex.query.QueryModule :name com.example.BaseXModuleTest :methods [ [^{QueryModule$Deterministic {}} addOne [int] int]]) It appears that imported names are not yet in-scope when gen-class is run from a ns declaration. |
[CLJ-959] after call to clojure.java.shell/sh, jvm won't exit Created: 26/Mar/12 Updated: 08/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Jeff Chiu | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | shell | ||
| Environment: |
Reproduced on Ubuntu using Sun Java 1.6, OpenJDK 1.6, and Sun Java 1.7 |
||
| Description |
|
Create the following four-line file, shell_example.clj: ;; simple example of call to sh that causes jvm to hang after print Run: After the message is printed, the jvm doesn't quit. It just sits there. I have to hit Ctrl-C to force the jvm to quit. This happens on 1.3 and the most recent code in github as of 3/26/2012. I imagine the jvm is waiting for a thread that hasn't terminated, but the code in the sh function doesn't look like it's doing anything obviously wrong. I'm too much of a newcomer to Clojure to dig any deeper. My workaround right now is to do (System/exit 0) to force the jvm to quit. Thank you for your work on Clojure, it's simply an amazing language. |
| Comments |
| Comment by Andy Fingerhut [ 27/Mar/12 12:19 AM ] |
|
Jeff, this occurs in any Clojure program where certain threading mechanisms are invoked. In your case, clojure.java.shell/sh uses future, which causes threads to be created that then sit around for about 60 seconds after everything else quits, and the main Java process does not exit until that happens. Another way to get the program to exit quickly is to call (shutdown-agents), but that isn't any more convenient than (System/exit 0), nor is there any obvious way you can tell as a newcomer that you should be doing this. The ticket CLJ-124 is marked with status "Approved" at this time, which leads me to believe that perhaps soon there will be a change made to Clojure such that this situation will change. |
| Comment by Andy Fingerhut [ 08/Jun/12 12:47 PM ] |
|
This behavior is now documented on clojuredocs.org for future, and both pmap and clojure.java.shell/sh refer to future for details. |
[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-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-939] Exceptions thrown in the top level ns form are reported without file or line number Created: 24/Feb/12 Updated: 15/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Hugo Duncan | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Incomplete |
| Waiting On: | Rich Hickey |
| Description |
|
If there is an error in the `ns` form, an exception is thrown, which is not caught in `load`. For example, with an invalid :only clause; (ns clj14.myns (:use [clojure.core :only seq])) This generates a Don't know how to create ISeq from: clojure.lang.Symbol exception, with source file or line number. |
| Comments |
| Comment by Hugo Duncan [ 25/Feb/12 8:26 AM ] |
|
Corrected patch |
| Comment by Andy Fingerhut [ 09/Mar/12 9:26 AM ] |
|
Patch 0001-report-load-exception-with-file-and-line.diff fails build. Patch 0002-report-load-exception-with-file-and-line.diff applies, builds, and tests cleanly as of March 9, 2012. Hugo has signed a CA. |
| Comment by Andy Fingerhut [ 05/Oct/12 8:13 AM ] |
|
clj-939-report-load-exceptions-with-file-and-line-patch-v2.txt dated Oct 5 2012 is intended to be an update to Hugo Duncan's patch 0002-report-load-exceptions-with-file-and-line.diff dated Feb 25 2012. Because of Brandon Bloom's recently commited patch adding column numbers in addition to line numbers, this is not simply updating some lines of context, but I think it is correct. It would be good if Hugo could take a look at it and confirm. |
| Comment by Stuart Sierra [ 09/Nov/12 9:38 AM ] |
|
Screened. The error messages are better than what we had before. The line/column numbers are not particularly informative, probably because ns is a macro. |
| Comment by Rich Hickey [ 13/Nov/12 3:37 PM ] |
|
This patch doesn't change the reporting on any other (e.g. nested) exceptions? It looks like it might. |
[CLJ-919] cannot create anonymous primitive functions Created: 27/Jan/12 Updated: 27/Jan/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Ben Mabey | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Primitive functions only work (e.g. return primitive types) when defined with `defn`. An equivalent function created with `fn` does not behave the same way as when created with `defn`. For example: (definterface IPrimitiveTester (deftype PrimitiveTester [] (defmacro pt [x] (defn with-defn ^double [^double x] (pt (with-defn 1.0)) ; => :double (let [a (fn ^double [^double x] (+ x 0.5))] Please see the discussion on the mailing list for more details and thoughts on what is happening: |
[CLJ-911] 'proxy' prevents overriding Object.finalize (and doesn't document it) Created: 16/Jan/12 Updated: 16/Jan/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Norman Gray | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
OS X, Java 1.6.0? |
||
| Description |
|
It appears to be impossible to override Object.finalize() using proxy. If the method is defined using proxy, then it cannot be called straightforwardly (see below), and it is not called as a finalizer during normal program execution (not demonstrated below). See extensive discussion at: https://groups.google.com/group/clojure/browse_thread/thread/a1e2fca45af6c1af
There is at least one of two bugs here (thanks to Cedric Greevey for summarising this way):
|
[CLJ-903] extend-protocol does not allow classnames as a String Created: 30/Dec/11 Updated: 30/Dec/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2, Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Meikel Brandmeyer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In various places Clojure accepts classnames as String, eg. in gen-class or type hints. However it does not in extend-protocol. This does not allow simple specification of array types. See also here: http://groups.google.com/group/clojure/browse_thread/thread/722a0c09d02bb0ac |
[CLJ-899] Accept and ignore colon between key and value in map literals Created: 18/Dec/11 Updated: 19/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Stuart Halloway | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 4 |
| Labels: | None | ||
| Description |
|
Original title was 'treat colons as whitespace' which isn't a problem description but a (flawed) implementation approach For JSON compatibility |
| Comments |
| Comment by Tassilo Horn [ 23/Dec/11 3:22 AM ] |
|
Discussed here: https://groups.google.com/d/msg/clojure/XvJUzaY1jec/l8xEwlFl8EUJ |
| Comment by Kevin Downey [ 11/Jan/12 2:23 PM ] |
|
please no |
| Comment by Tavis Rudd [ 16/Jan/12 12:17 PM ] |
|
Alan Malloy raises a good point in the google group discussion (https://groups.google.com/d/msg/clojure/XvJUzaY1jec/aVpWBicwGhsJ) about accidental confusion between trailing (or floating) and leading colons: This issue could be avoided by only treating a colon as whitespace when followed by a comma. As easy cut-paste of json seems the be the key motivation here, the commas are going to be there anyway: valid {"v":, 1234} vs syntax error {a-key: should-be-a-keyword}. |
| Comment by Alex Baranosky [ 16/Jan/12 5:23 PM ] |
|
This would be visually confusing imo. |
| Comment by Laurent Petit [ 17/Jan/12 5:01 PM ] |
|
Please, oh please, no. |
| Comment by Tavis Rudd [ 18/Jan/12 2:40 PM ] |
|
Er, brain fart. I was typing faster than I was thinking and put the comma in the wrong place. In my head I meant the form following the colon would have to have a comma after it. Thus, {"a-json-key": 1234, ...} would be valid while {"a-json-key": was-supposed-to-be-a-keyword "another-json-key" foo} would complain about the colon being an Invalid Token. I don't see the need for it, however. |
| Comment by Joseph Smith [ 27/Feb/12 10:55 AM ] |
|
Clojure already has reader syntax for a map. If we support JSON, do we also support ruby map literals? Seems like this addition would only add confusion, imo, given colons are used in keywords and keywords are frequently used in maps - e.g., when de-serializing from XML, or even JSON. |
| Comment by David Nolen [ 27/Feb/12 11:19 AM ] |
|
Clojure is no longer a language hosted only on the JVM. Clojure is also hosted on the CLR, and JavaScript. In particular ClojureScript can't currently easily deal with JSON literals - an extremely common (though problematic) data format. By allowing colon whitespace in map literals - Clojure data structures can effectively become an extensible JSON superset - giving the succinctness of JSON and the expressiveness of XML. +1 from me. |
| Comment by Tim McCormack [ 13/Nov/12 7:27 PM ] |
|
Clojure is only hosted on the JVM; ClojureScript is hosted on JS VMs. If this is useful for CLJS, it should just be a CLJS feature. |
| Comment by Mike Anderson [ 10/Dec/12 11:51 PM ] |
|
-1 for this whole idea: that way madness lies.... If we keep adding syntactical oddities like this then the language will become unmaintainably complex. It's the exact opposite of simple to have lots of special cases and ambiguities that you have to remember. If people want to use JSON that is fine, but then the best approach use a specific JSON parser/writer, not just paste it into Clojure source and expect it to work. |
| Comment by Laszlo Török [ 11/Dec/12 4:54 AM ] |
|
-1 for reasons mentioned by Allan Malloy and Mike Anderson |
[CLJ-887] Error when calling primitive functions with destructuring in the arg vector Created: 29/Nov/11 Updated: 29/Nov/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Alexander Taggart | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
If one defines a primitive-taking function with destructuring, calling that function will result in a ClassCastException, IFF the primitive return-type hint is present. Clojure 1.4.0-master-SNAPSHOT user=> (defn foo [[a b] ^long x ^long y] 0) #'user/foo user=> (foo [1 2] 3 4) 0 user=> (defn foo ^long [[a b] ^long x ^long y] 0) #'user/foo user=> (foo [1 2] 3 4) ClassCastException user$foo cannot be cast to clojure.lang.IFn$OLLL user/eval9 (NO_SOURCE_FILE:4) user=> (pst) ClassCastException user$foo cannot be cast to clojure.lang.IFn$OLLL user/eval9 (NO_SOURCE_FILE:4) clojure.lang.Compiler.eval (Compiler.java:6493) clojure.lang.Compiler.eval (Compiler.java:6459) clojure.core/eval (core.clj:2796) clojure.main/repl/read-eval-print--5967 (main.clj:244) clojure.main/repl/fn--5972 (main.clj:265) clojure.main/repl (main.clj:265) clojure.main/repl-opt (main.clj:331) clojure.main/main (main.clj:427) clojure.lang.Var.invoke (Var.java:397) clojure.lang.Var.applyTo (Var.java:518) clojure.main.main (main.java:37) nil |
[CLJ-884] Reflector error messages can be improved when no matching method is found. Created: 27/Nov/11 Updated: 23/Mar/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Rahul Pilani | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
All |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
When accessing a java method with an arity mismatch or a mismatched parameter type, Reflector.java returns the following error on REPL: eventhough method xyz might exist on MyClass, but was being called with the wrong number of arguments. Attached is a patch that fixes that problem. |
| Comments |
| Comment by Andy Fingerhut [ 22/Mar/12 8:47 PM ] |
|
diff.patch of Nov 27, 2011 does not apply cleanly to latest master version of Clojure code (using "patch -p1 < diff.patch", at least). It is preferred by Clojure team that patches are in git format-patch format. Instructions for producing such a patch are given at http://clojure.org/patches Rahul, are you planning to sign a Clojure Contributor Agreement? Without that, this code cannot be included in Clojure, unless a contributor reimplements it on their own. |
| Comment by Andy Fingerhut [ 23/Mar/12 1:14 AM ] |
|
In private communication with the patch author today, he expressed an interest in submitting a signed CA so this patch can be considered for inclusion in Clojure. |
[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-865] Macroexpansion discards &form metadata Created: 26/Oct/11 Updated: 06/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 7 |
| Labels: | Compiler | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
As discussed in http://groups.google.com/group/clojure/browse_thread/thread/2690cb6ca0e8beb8 there is a "surprise factor" when type-hinting an expression that represents a macro, such as with (.length ^String (doto (identity "x") prn)). Here the doto macro discards the metadata on &form, causing a reflective lookup. This has the effect that while expressions representing function calls can be type-hinted, expressions representing macros in general cannot. The doto macro could be rewritten to respect its &form metadata, but doing this for every macro in existence would be tedious and error-prone. Instead, I propose a change to the compiler, to cause macroexpansion to hang onto the metadata automatically. The first patch attached adds a test for the behavior I propose: this test fails. After applying the second patch, the test passes. There are a couple points that merit further consideration before accepting my patch:
|
| Comments |
| Comment by Alan Malloy [ 28/Oct/11 1:12 AM ] |
|
So I went ahead and did the work of making this change in clojure.core/defmacro instead of clojure.lang.Compiler/macroexpand1. It was even worse than I expected: I didn't realize we don't yet have syntax-quote or apply at this stage in bootstrapping, so writing a non-trivial macroexpansion requires a huge amount of (list `foo (list `bar 'local-name)) and so forth. I'm sure the version I wrote is not optimal, but it seemed simpler to piggyback on defn, and then use alter-var-root to shim the metadata management in, than it would have been to expand to the correct thing in the first place. Anyway, attached patch #3 could be applied instead of #2 to resolve the issue in clojure.core instead of clojure.lang. The tests added in patch #1 pass either way. |
| Comment by Alan Malloy [ 13/Nov/11 8:29 PM ] |
|
I realized I can do this with a named private function instead of an anonymous function, reducing the amount of mess defmacro itself has to generate. Patch 4 is, I think, strictly better than Patch 3, if a Clojure implementation is preferred to one in Java. |
| Comment by Chouser [ 20/Nov/11 10:43 PM ] |
|
I prefer patch 0002 in Java over either 0003 or 0004. Patch 0002 keeps the knowledge of how to invoke macro fns (specifically the extra &form and &env args) in one place, macroexpand1 rather than duplicating that knowledge in core.clj as well. Note patch 0001 is just tests. The proposed default macroexpansion behavior is more useful than what we currently have, but there are two details I'd like to think about a bit more: 1) In exchange for a more useful default, macro writers lose the ability to consume their &form metadata and have control over the resulting form metadata without the &form metadata overridding it. That is, macros are no longer in complete control of their output form. 2) Rule (1) above has hardcoded exceptions for :line and :file, where &form metadata is unable to override the results returned by the macro. |
| Comment by Alan Malloy [ 01/Jun/12 2:04 PM ] |
|
This patch incorporates all previous patches to this issue. On the clj-dev mailing list, Andy Fingerhut suggested a new metadata key for allowing the macro author to specify "I've looked at their &form metadata, and this form is exactly what I want to expand to, please don't change the metadata any further." I've implemented this, and I think it addresses Chouser's concern about needing a way to "break out" of the improved-default behavior. One open question is, is :explicit-meta the right key to use? I spent some time tracking down a bug caused by my forgetting the keyword and using :explicit-metadata in my test; perhaps something more difficult to get confused by is available. |
[CLJ-864] defrecord positional arity factory fn should have an inline version that calls the record constructor Created: 26/Oct/11 Updated: 26/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Kevin Downey | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
defrecord positional arity factory fn should have an inline version that calls the record constructor |
| Comments |
| Comment by Gary Fredericks [ 26/May/13 3:39 PM ] |
|
I had the idea recently that the factory fn was useful partly for being a redefinable var, e.g. that you could wrap with contracts or anything else. This idea would preclude that. It makes sense though if the only purpose of ->Foo is to avoid having to :import something. |
[CLJ-859] Built in dynamic vars don't have :dynamic metadata Created: 19/Oct/11 Updated: 24/Feb/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Anthony Simpson | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I'm sure 'built in' is probably not the right term here, but I'm not sure what these are called. I ran into this issue earlier today while fixing a bug in clojail. Built in vars, particularly ones listed here without a source link: http://clojure.github.com/clojure/clojure.core-api.html, do not have :dynamic metadata despite being dynamic. This includes *in*, *out*, and *err* among others. Here are some examples: user=> (meta #'*err*)
{:ns #<Namespace clojure.core>, :name *err*, :added "1.0", :doc "A java.io.Writer object representing standard error for print operations.\n\n Defaults to System/err, wrapped in a PrintWriter"}
user=> (meta #'*in*)
{:ns #<Namespace clojure.core>, :name *in*, :added "1.0", :doc "A java.io.Reader object representing standard input for read operations.\n\n Defaults to System/in, wrapped in a LineNumberingPushbackReader"}
user=> (meta #'*out*)
{:ns #<Namespace clojure.core>, :name *out*, :added "1.0", :doc "A java.io.Writer object representing standard output for print operations.\n\n Defaults to System/out, wrapped in an OutputStreamWriter", :tag java.io.Writer}
user=> (meta #'*ns*)
{:ns #<Namespace clojure.core>, :name *ns*, :added "1.0", :doc "A clojure.lang.Namespace object representing the current namespace.", :tag clojure.lang.Namespace}
|
| Comments |
| Comment by Ben Smith-Mannschott [ 19/Oct/11 12:03 PM ] |
|
This recent discussion on the users list seems relevant: Should intern obey :dynamic?. It seems to boil down to this the information that a Var is dynamic (or not) is duplicated. Once as metadata with the key :dynamic, and once as a boolean field on the Var class which implements Clojure's variables. This boolean can be obtained by calling the method isDynamic() on the Var. The confusion arises because apparently :dynamic and .isDynamic can get out of sync with each other. .isDynamic is the source of truth in this case. |
| Comment by Ben Smith-Mannschott [ 19/Oct/11 12:18 PM ] |
|
Compiler$Parser.parse(...) finds the :dynamic entry left in the metadata of the symbol by LispReader and passes this on when creating a new DefExpr, which in turn, generates the code that will call setDynamic(...) on the var when it is created at runtime. As far as I can tell, the :dynamic entry is irrelevant once that has occurred. It seems to be implemented only as a way to communicate (by way of the reader) with the compiler. Once the compiler's gotten the message, it isn't needed anymore. Keeping it around seems to just cause confusion. Dynamic vars created by the Java layer of Clojure core don't use the :dynamic mechanism, they just setDynamic() directly. That's why they don't have :dynamic in their meta-data map.
Or, perhaps one might consider, for 1.4, replacing :dynamic altogether and just enforcing the established naming convention: *earmuffs* are dynamic, everything-else isn't. (The compile warns about violations of this convention in 1.3.) |
| Comment by Andy Fingerhut [ 24/Feb/12 11:39 AM ] |
|
I recently noticed several lines like this one in core.clj. Depending upon how many symbols are like this, perhaps this method could be used to add :dynamic metadata to symbols in core, along with a unit test to verify that all symbols in core have :dynamic if and only if .isDynamic returns true? |
| Comment by Andy Fingerhut [ 24/Feb/12 12:41 PM ] |
|
Ugh. In my previous comment, by "several lines like this one" I meant to paste the following as an example: (alter-meta! #'agent assoc :added "1.0") |
[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-840] Add a way to access the current test var in :each fixtures for clojure.test Created: 21/Sep/11 Updated: 18/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Hugo Duncan | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
When looking at (log) output from tests written with clojure.test, I would like to be able to identify the output associated with each test. A mechanism to expose the current test var within an :each fixture would enable this. One mechanism might be to bind a test-var var with the current test var before calling the each-fixture-fn in clojure.test/test-all-vars. |
| Comments |
| Comment by Stuart Sierra [ 07/Oct/11 4:33 PM ] |
|
Or just pass the Var directly into the fixture. Vars are invokable. |
| Comment by Hugo Duncan [ 07/Oct/11 4:45 PM ] |
|
I don't think that works, since the the function passed to the fixture is not the test var, but a function calling test-var on the test var. |
| Comment by Hugo Duncan [ 21/Oct/11 10:34 PM ] |
|
Patch to add test-var |
| Comment by Stuart Sierra [ 25/Oct/11 6:04 PM ] |
|
*testing-vars* already has this information, but it's not visible to the fixture functions because it gets bound inside test-var. Perhaps the :each fixture functions should be called in test-var rather than in test-all-vars. (The namespace of a Var is available in its metadata.) But then we have to call join-fixtures inside test-var every time. |
| Comment by Stuart Sierra [ 25/Oct/11 6:26 PM ] |
|
Try this patch: clj840-2.diff. This makes *testing-vars* visible to :each fixture functions, which seems intuitively more correct. BUT it slightly changes the behavior of test-var, which I'm less happy about. |
| Comment by Hugo Duncan [ 25/Oct/11 8:07 PM ] |
|
Might it make sense to provide a function on top of testing-vars to return the current test-var? |
| Comment by Stuart Sierra [ 28/Oct/11 9:14 AM ] |
|
No, that function is first |
| Comment by Hugo Duncan [ 28/Oct/11 11:31 AM ] |
|
I agree with having the dynamic vars as part of the extension interface, but would have thought that having a function for use when writing tests would have been cleaner. Just my 2c. |
[CLJ-827] unsigned-bit-shift-right Created: 09/Aug/11 Updated: 10/Jun/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. |
| Comment by Michał Marczyk [ 31/May/13 3:43 PM ] |
|
@Gabriel: Thanks! bit-shift-right-zero-fill is not marked private in ClojureScript, so it'll be a breaking change; if it's going to happen eventually (that is, if the name is settled), I suppose it's best to make it without waiting for Clojure. At any rate, I went ahead and created CLJS-514 to track the coordination effort. No patch attached; if you'd like to do the patching on both sides, that would be cool, otherwise I'll be happy to provide the CLJS patch. |
| Comment by Gabriel Horner [ 03/Jun/13 10:10 AM ] |
|
@Michal - I didn't mark it private. Are we taking about the same with-tests.patch? I'll try to get around to the cljs patch but feel free to beat me to it if I'm slow. |
| Comment by Michał Marczyk [ 10/Jun/13 1:57 AM ] |
|
@Gabriel: I mean it's not marked private in ClojureScript, so ClojureScript already exports the ...-zero-fill name, technically speaking. As per David Nolen's comment on CLJS-514, this is probably not a big deal. |
[CLJ-825] Protocol implementation inconsistencies Created: 08/Aug/11 Updated: 08/Aug/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2, Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Carl Lerche | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Environment: |
All |
||
| Attachments: |
|
| Description |
|
There seems to be some inconsistencies when implementing protocols that have multi arity functions depending on how the protocol is implemented. I have attached a clj file illustrating this. The short version is that multi arity must be defined as such w/ defrecord: (defrecord Zomg [] And as such with extend-type (extend-type Object I have only tested defrecord & extend-type. I am unsure how it works with deftype and extend-protocol. |
[CLJ-792] Refactor method resolution code out of Compiler and into Reflector Created: 11/May/11 Updated: 20/Feb/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Alexander Taggart | Assignee: | Alexander Taggart |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Issues:
By consolidating the duplicated code, moving the reflection-related parts into Reflector, and providing a straightforward API, it should be easier to read and understand the method resolution process. Further, improvements to (e.g., CLJ-445) the mechanism for reflecting on class members can largely be isolated from the Compiler. And the few points of coordination (e.g., Compiler emitting same arg and return types as Reflector does when invoking) can be clearly identified and documented. |
| Comments |
| Comment by Stuart Sierra [ 17/Feb/12 2:28 PM ] |
|
Patch does not apply as of commit f5bcf64. |
| Comment by Alexander Taggart [ 17/Feb/12 3:14 PM ] |
|
Yeah, year-old patches tend to do that. |
| Comment by Andy Fingerhut [ 20/Feb/12 1:11 PM ] |
|
I don't know if this is helpful or not, but this updated version of Alexander's patch applies cleanly to latest Clojure head as of Feb 20, 2012. It compiles, but does not pass ant test. |
[CLJ-790] Primitive type hints on function names should print error message Created: 10/May/11 Updated: 10/May/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alan Dipert | Assignee: | Alan Dipert |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Functions returning primitives are hinted with metadata on the argument list, not on the function name. Using a primitive type hint on a function name should print an error message. Currently, misplaced primitive hints are read without error. |
[CLJ-760] ClassNotFound when AOT compiling a self-referring deftype extended to a protocol Created: 18/Mar/11 Updated: 18/Mar/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Ryan Senior | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Clojure 1.2.0, 1.2.1, 1.3.0-alpha6, JDK 1.6.0_24, Ubuntu 10.10 |
||
| Attachments: |
|
| Description |
|
If I create a deftype that refers to itself in a protocol extension like below: (ns type-test)
(defprotocol Foo
(isa-foo [x]))
(deftype TypeTest []
Foo
(isa-foo [x]
(instance? TypeTest x)))
And use that code via another namespace: (ns test-type-user (:use [type-test :only (isa-foo)]) (:import [type-test TypeTest])) (isa-foo (TypeTest.)) When I try to AOT compile the test-type-user namespace with Clojure 1.2.0, I get java.lang.NoClassDefFoundError: compilestub/type-test/TypeTest (test_type_user.clj:5). Full stack trace attached. Running the same code on 1.2.1 and 1.3.0-alpha6 yielded the same exception with a slightly different error message (stacktrace for 1.2.1 is also in the attached file). This came up in a test at Revelytix. We worked around this issue by not using instance? and instead comparing based on class name. Another workaround is to define the deftype and the extension separately (using extend-type or something similar). This problem also doesn't occur if the usage of the deftype and the definition of it are in the same namespace (i.e. if type-test and test-type-user were in the same file). |
| Comments |
| Comment by Alex Miller [ 18/Mar/11 10:27 AM ] |
|
The first case where we saw this was actually in having a deftype implement a Java interface (not a protocol) and in that case you cannot extend the interface outside the deftype (although comparing based on class name of course works). |
[CLJ-740] Unnecessary boxing of primitives in case form Created: 17/Feb/11 Updated: 01/Mar/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Mikhail Kryshen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Found this while profiling some performance-critical code. Consider the following Clojure function: (defn test-case ^double [^long i ^double d1 ^double d2] (case (int i) 0 d1 d2)) Current Clojure 1.3 snapshot compiles it to: public final double invokePrim(long, double, double) throws java.lang.Exception; Code: 0: lload_1 1: invokestatic #67; //Method clojure/lang/RT.intCast:(J)I 4: istore 7 6: iload 7 8: i2l 9: invokestatic #73; //Method clojure/lang/Numbers.num:(J)Ljava/lang/Number; 12: invokestatic #79; //Method clojure/lang/Util.hash:(Ljava/lang/Object;)I 15: iconst_0 16: ishr 17: iconst_1 18: iand 19: tableswitch{ //0 to 0 0: 36; default: 58 } 36: iload 7 38: i2l 39: invokestatic #73; //Method clojure/lang/Numbers.num:(J)Ljava/lang/Number; 42: getstatic #45; //Field const__3:Ljava/lang/Object; 45: invokestatic #83; //Method clojure/lang/Util.equals:(Ljava/lang/Object;Ljava/lang/Object;)Z 48: ifeq 58 51: dload_3 52: invokestatic #88; //Method java/lang/Double.valueOf:(D)Ljava/lang/Double; 55: goto 63 58: dload 5 60: invokestatic #88; //Method java/lang/Double.valueOf:(D)Ljava/lang/Double; 63: checkcast #92; //class java/lang/Number 66: invokevirtual #96; //Method java/lang/Number.doubleValue:()D 69: dreturn } This bytecode contains boxing of primitives (calls to clojure/lang/Numbers.num and java/lang/Double.valueOf) and calls to clojure/lang/Util.hash and clojure/lang/Util.equals that does not seem necessary. At 60-66 primitive double is boxed into Double only to be converted back into primitive. The equivalent Java code compiles to much simpler and faster bytecode: public double testCase(long, double, double); Code: 0: lload_1 1: l2i 2: lookupswitch{ //1 0: 20; default: 22 } 20: dload_3 21: dreturn 22: dload 5 24: dreturn } |
| Comments |
| Comment by Alexander Taggart [ 28/Feb/11 2:16 PM ] |
|
Improved via patch on (defn test-case ^double [^long i ^double d1 ^double d2]
(case (int i)
0 d1
d2))
now emits as 0 lload_1 [i]
1 invokestatic clojure.lang.RT.intCast(long) : int [67]
4 istore 7 [G__7903] // let-bound expression
6 iload 7 [G__7903]
8 tableswitch default: 32
case 0: 28
28 dload_3 [d2]
29 goto 34
32 dload 5 [arg2]
34 dreturn
or if the int cast of the expression is omitted: 0 lload_1 [i]
1 lstore 7 [G__7903] // let-bound expression
3 lload 7 [G__7903]
5 l2i
6 tableswitch default: 35
case 0: 24
24 lconst_0 // match, verify long expr wasn't truncated
25 lload 7 [G__7903]
27 lcmp
28 ifne 35
31 dload_3 [d2]
32 goto 37
35 dload 5 [arg2]
37 dreturn
|
[CLJ-705] Make sorted maps and sets implement j.u.SortedMap and SortedSet interfaces Created: 05/Jan/11 Updated: 02/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Rich Hickey | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Comments |
| Comment by Andy Fingerhut [ 02/Jun/12 2:29 PM ] |
|
This might be a duplicate of CLJ-248. See that one before working on this one, at least. |
[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-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 cle |