[CLJ-1193] bigint, biginteger throw on double values outside of long range Created: 07/Apr/13 Updated: 17/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
|
This works fine: user> (bigint (* 0.99 Long/MAX_VALUE)) but this and any other Float or Double values outside the range of a user> (bigint (* 1.01 Long/MAX_VALUE)) Similarly for biginteger |
| Comments |
| Comment by Andy Fingerhut [ 07/Apr/13 4:38 PM ] |
|
Patch clj-1197-make-bigint-work-on-all-doubles-v1.txt dated Apr 7 2013 changes bigint and biginteger so that they return the correct value for all float and double values, and no longer throw an exception. |
| Comment by Gabriel Horner [ 17/May/13 10:52 AM ] |
|
Looks good. Tests pass and the failing example now converts correctly |
[CLJ-1117] Partition does not follow docs Created: 29/Nov/12 Updated: 17/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.6 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Timothy Baldridge | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
OS X, 10.8 |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
The doc for partition states "In case there are not enough padding elements, return a partition with less than n items." However, the behavior of this function is as follows: user=> (partition 3 (range 10)) Either the doc should be updated to make it clear that not providing a pad will mean that items are dropped, or the functionality of partition should be fixed to the following: user=> (partition 3 (range 10)) |
| Comments |
| Comment by Andy Fingerhut [ 29/Nov/12 2:15 PM ] |
|
That would be a potentially breaking change for some people's code that uses partition. partition-all behaves as you wish. Also, your concern with the documentation is for when there are padding elements specified as an argument, but your examples don't specify any padding elements. |
| Comment by Timothy Baldridge [ 29/Nov/12 2:55 PM ] |
|
I agree, but I think the docs should then explicitly state: "if no padding is given, not all input elements may be returned in the output partitions" or something to that line. |
| Comment by Andy Fingerhut [ 29/Nov/12 4:43 PM ] |
|
More precise documentation of current behavior is always welcome in my opinion. |
| Comment by Gabriel Horner [ 17/May/13 10:14 AM ] |
|
I've uploaded a patch that calls out when and how partition drops tail elements: |
[CLJ-1122] Add contributing.md file to github repository (shows clear message on issues/pull request create form) Created: 09/Dec/12 Updated: 17/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Max Penet | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
This adds a clear message when someone wants to create a pull request/issue and invites the user to read the contribution guidelines: see https://github.com/blog/1184-contributing-guidelines. The same thing could be done for all the clojure/* repositories. The content of the file is just a markdown version of http://clojure.org/contributing Preview here: https://github.com/mpenet/clojure/blob/aef170ca5eca1b71a2eb1ef320223d1277df0e5e/CONTRIBUTING.md |
| Comments |
| Comment by Stuart Halloway [ 02/Jan/13 6:31 AM ] |
|
Please change this to link to the definitive prose, so we don't have to maintain that in two places. |
| Comment by Max Penet [ 02/Jan/13 6:51 AM ] |
|
Feel free to correct the wording, I used something simple. |
| Comment by Gabriel Horner [ 17/May/13 9:04 AM ] |
|
Stu, he linked to clojure.org as you requested so I'm moving this along. |
[CLJ-1125] Clojure can leak memory when used in a servlet container Created: 11/Dec/12 Updated: 13/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Toby Crawley | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 8 |
| 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]. |
[CLJ-1209] Teach clojure.test reporting about ex-info/ex-data Created: 11/May/13 Updated: 11/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Thomas Heller | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
When clojure.test/deftest does error reports on unexpected exceptions it currently ignores ExceptionInfo and the valuable ex-data it carries. So this patch simple prints this data, it might be helpful to pprint or format it in another way but this was good enough for me. See example from my tests: https://gist.github.com/thheller/5559391 |
[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-1176] clojure.repl/source fails when *read-eval* bound to :unknown Created: 06/Mar/13 Updated: 04/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Tim McCormack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
clojure.repl/source is broken in Clojure 1.5.0 when *read-eval* is bound to :unknown, since source-fn reads without binding. Reproduce:
Expected: Source of drop-last. Actual: RuntimeException Reading disallowed - *read-eval* bound to :unknown |
| Comments |
| Comment by Tim McCormack [ 06/Mar/13 4:04 PM ] |
|
The attached patch just binds *read-eval* to true inside source-fn. |
| Comment by Stuart Halloway [ 29/Mar/13 6:24 AM ] |
|
Note: Allowing this implies that you trust the data on your classpath. If there are reasons somebody might not, we should reject this patch and people will have to be explicit when calling source. |
| Comment by Tim McCormack [ 29/Mar/13 6:37 AM ] |
|
Ugh, that's a fair point when it comes to sandboxing. I'll check with the owners of clojurebot and lazybot. |
| Comment by Tim McCormack [ 04/May/13 10:40 PM ] |
|
I haven't come up with any scenarios where this is problematic, and I haven't heard anything back from the bot owners. As for sandboxing, clojure.repl can easily be excluded. |
[CLJ-428] subseq, rsubseq enhancements to support priority maps? Created: 20/Aug/10 Updated: 01/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
See dev thread at http://groups.google.com/group/clojure-dev/browse_thread/thread/fdb000cae4f66a95. Note: subseq currently returns () instead of nil in some situations. If the rest of this idea dies we might still want to fix that. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 10:10 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/428 |
| Comment by Andy Fingerhut [ 28/Apr/13 2:14 AM ] |
|
Patch clj-428-change-Sorted-seqFrom-to-take-inclusive-patch-v1.txt dated Apr 28 2013 was written by Mark Engelberg in July 2010, and was attached to a message he sent to the dev thread linked in the description. The approach he takes is described by him in that thread, copied here: ---------------------------------------- In this patch, I do not address one issue I raised before, which is whether subseq implies by its name that it should return a seq rather than a sequence (in other words nil rather than ()). If seq behavior is desired, it would be necessary to wrap a call to seq around the calls to take-while. But for now, I'm just making the behavior match the current behavior. Although I think this is the cleanest way to address the extensibility issue with subseq, the change to seqFrom will break anyone who currently is overriding that method. I didn't see any such classes in clojure.contrib, so I don't think it's an issue, but if this is a concern, my other idea is to fix the problem entirely within subseq by changing the calls to next into calls to drop-while. I have coded this to confirm that it works, and can provide that alternative patch if desired. I can also supply a patch that uses drop-while in clojure.core/subseq and rsubseq if such an approach is preferred to the one in this patch. |
| Comment by Andy Fingerhut [ 28/Apr/13 12:12 PM ] |
|
clj-428-change-Sorted-seqFrom-to-take-inclusive-patch-v2.txt dated Apr 28 2013 is same as clj-428-change-Sorted-seqFrom-to-take-inclusive-patch-v1.txt (soon to be deleted), except it adds tests for subseq and rsubseq, and corrects a bug in that patch. The approach is the same as described above for that patch. |
| Comment by Andy Fingerhut [ 01/May/13 2:44 AM ] |
|
Patch clj-428-change-Sorted-seqFrom-to-take-inclusive-patch-v3.txt dated May 1 2013 is the same as clj-428-change-Sorted-seqFrom-to-take-inclusive-patch-v1.txt, still with the bug fix mentioned for -v2, but with some unnecessary changes removed from the patch. The comments for -v1.txt on the approach still apply. |
[CLJ-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-1204] hash is inconsistent with = for many BigInteger values Created: 18/Apr/13 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: | Minor |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
The function hash is documented to be consistent with =. For many BigInteger values, hash is inconsistent with =. This leads to incorrect behavior for data structures like hash maps that use hash. user> (apply = [-1 -1N (biginteger -1)])
true
user> (map hash [-1 -1N (biginteger -1)])
(0 0 -1)
;; Incorrect return value with multiple keys = to each other
user> (assoc (hash-map -1N :should-be-replaced) (biginteger -1) :new-val)
{-1N :should-be-replaced, -1 :new-val}
;; array-map gives correct value, since it uses =, not hash
user> (assoc (array-map -1N :should-be-replaced) (biginteger -1) :new-val)
{-1N :new-val}
|
| Comments |
| Comment by Andy Fingerhut [ 18/Apr/13 8:10 PM ] |
|
Patch clj-1204-make-hash-consistent-with-equal-for-bigintegers-v1.txt dated Apr 18 2013 takes the following approach to the issue: Change the behavior of hasheq so that when given a BigInteger value that could fit into a long, returns the same hash code as that long value. hasheq continues to return x.hashCode() if the BigInteger value does not fit into a long. This is consistent with the hash value returned by a BigInt value that does not fit into a long. New tests are included, some of which fail without the change to hasheq, but pass with the change. |
| Comment by Andy Fingerhut [ 18/Apr/13 8:19 PM ] |
|
Overwrite patch with one that leaves out some unnecessary code. |
| Comment by Andy Fingerhut [ 25/Apr/13 6:42 PM ] |
|
Changing priority to minor, since I suppose one could work around this issue, if you were diligent about it, by converting all BigIntegers to BigInts before they are ever used in a place where they are hashed. |
[CLJ-1200] RestFn & ArraySeq performance Created: 14/Apr/13 Updated: 18/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | patch | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
I was profiling one of my projects and noticed a hotspot inside functions using rest arguments. Most overloads of RestFn.invoke will construct an ArraySeq object. The ArraySeq constructor calls java.lang.Class.getComponentType, which seems to be pretty slow. The array's component type is cached in a field on the ArraySeq object for the sole purpose of passing it to Reflector.prepRet. I'm not entirely sure of the total utility of prepRet, but it's clearly a no-op when passed Object.class, such as the case with the non-specialized base class of ArraySeq: the component type of object[] is Object.class. The attached patch eliminates the component type field from ArraySeq and passes Object.class to prepRet directly. It may be possible to eliminate calls to prepRet all together, but I'll assume that's a different ticket. With this patch, ArraySeq initialization no longer shows up as a hotspot when profiling. Before the patch: user=> (dotimes [n 10] (time (dotimes [i 5000000] ((fn [& args]) 1 2 3 4)))) "Elapsed time: 874.742 msecs" "Elapsed time: 900.277 msecs" "Elapsed time: 911.164 msecs" "Elapsed time: 872.132 msecs" "Elapsed time: 885.495 msecs" "Elapsed time: 897.537 msecs" "Elapsed time: 879.691 msecs" "Elapsed time: 888.52 msecs" "Elapsed time: 871.556 msecs" "Elapsed time: 1088.682 msecs" After the patch: user=> (dotimes [n 10] (time (dotimes [i 5000000] ((fn [& args]) 1 2 3 4)))) "Elapsed time: 628.144 msecs" "Elapsed time: 634.163 msecs" "Elapsed time: 617.397 msecs" "Elapsed time: 622.714 msecs" "Elapsed time: 646.743 msecs" "Elapsed time: 648.708 msecs" "Elapsed time: 629.223 msecs" "Elapsed time: 638.058 msecs" "Elapsed time: 725.473 msecs" "Elapsed time: 636.909 msecs" That's about a 30% reduction in execution time. Granted it only represents a change of 52 nanoseconds per RestFn invoke (181 ns to 129 ns), but this actually was a pretty decent win for a library that makes makes almost exclusively variadic function calls in a tight loop. |
[CLJ-1182] Regexp are never equal Created: 12/Mar/13 Updated: 13/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Christian Fortin | Assignee: | Omer Iqbal |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Triaged |
| Description |
|
The following (= #"asd" #"asd") will return false in CLJ, even if they are the same. Consequently, everything with a regexp in it (lists, vectors, maps...) will never be equal. It seems to have been fixed for CLJS, but not for CLJ. |
| Comments |
| Comment by Omer Iqbal [ 12/Mar/13 4:08 PM ] |
|
added an implementation for the equiv method if both args are java.util.regex.Pattern |
| Comment by Andy Fingerhut [ 12/Mar/13 5:54 PM ] |
|
Omer, could you also include in your patch a few test cases? At least one that validates that two regex's that should be equal, are equal, and another that two regex's that should be different, are non-equal. Preferably the first of those tests should fail with the existing Clojure code, and pass with your changes. |
| Comment by Omer Iqbal [ 13/Mar/13 5:39 AM ] |
|
I updated the patch with some tests. Hope I added them in the correct file. I also changed the implementation a bit, by instead of adding another implementation of equiv with a different signature, checking the type of the Object in the equiv method with signature (Object k1, Object k2). |
| Comment by Andy Fingerhut [ 13/Mar/13 1:04 PM ] |
|
All comments here refer to the patch named fix-CLJ-1182.diff dated Mar 13, 2013. The location for the new tests looks reasonable. However, note that your new patch has your old changes plus some new ones, not just the new ones. In particular, the new signature for equiv is still in your latest patch. You should start from a clean pull of the latest Clojure master and make only the changes you want when creating a patch, not build on top of previous changes you have made. Also, there are several whitespace-only changes in your patch that should not be included. |
| Comment by Omer Iqbal [ 13/Mar/13 1:39 PM ] |
|
I uploaded a clean patch, removing the whitespace diff and only adding the latest changes. Thanks for clarifying the workflow! |
| Comment by Stuart Halloway [ 29/Mar/13 5:46 AM ] |
|
I am recategorizing this as an enhancement, because if this is a bug it is a bug in Java – the Java Patterns class documents being immutable, but apparently does not implement .equals. Other recent "make Clojure more complicated to work around problems in Java" patches have been rejected, and I suspect this one will be too, because it might impact the performance of equality everywhere. |
| Comment by Stuart Halloway [ 12/Apr/13 9:04 AM ] |
|
At first pass, Rich and I both believe that, as regex equality is undecidable, that Java made the right choice in using identity for equality, that this ticket should be declined, and the ClojureScript should revert to match. But leaving this ticket open for now so that ClojureScript dev can weigh in. |
| Comment by Michael Drogalis [ 12/Apr/13 9:32 AM ] |
|
What do you mean when you say "undecidable"? |
| Comment by Alexander Redington [ 12/Apr/13 10:03 AM ] |
|
If Regex instances were interned by the reader, but still used identity for equality, then code like (= #"abc" #"abc") would return true, but it wouldn't diverge in the definition of equality for regular expressions between Java and Clojure. |
| Comment by Fogus [ 12/Apr/13 10:13 AM ] |
|
Undecidable means that for any given regular expression, there is no single way to write it. For example #"[a]" #"a" both match the same strings, but are they the same? Maybe. But how can we decide if /any/ given regular expression matches all of the same strings as any other? The answer is, you can't. Java does provide a Pattern#pattern method that returns the string that was used to build it, but I'm not sure if that could/should be used as a basis for equality given the potential perf hit. |
| Comment by Herwig Hochleitner [ 12/Apr/13 10:31 AM ] |
|
I posted in Stu's thread: https://groups.google.com/d/topic/clojure-dev/OTPNJQbPtds/discussion |
| Comment by Michael Drogalis [ 12/Apr/13 10:32 AM ] |
|
That makes sense to me. Thanks Fogus. |
| Comment by Herwig Hochleitner [ 12/Apr/13 9:42 PM ] |
|
From my post to the ml thread, it might not be entirely clear, why I don't think we should implement equality for host regexes: It would involve parsing and would leave a lot of room for errors and platform-idiosycracies to leak. And it would be different for every platform. As Alexander said, I also think this ticket could be resolved by interning regex literals, akin to keywords. That, however, would warrant a design page first, because there are tradeoffs to be made about how far the interning should go. |
| Comment by Rich Hickey [ 13/Apr/13 8:51 AM ] |
|
Why are we spending time on this? Where is the problem statement? Does someone actually need this for a real world purpose not solved by using regex strings as keys? |
| Comment by Michael Drogalis [ 13/Apr/13 9:13 PM ] |
|
It was prompted as a matter of consistency, which I think is valid. I can't think of a good reason to use regex's as keys though. |
[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: 12/Apr/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: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
|
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-1121] -> and ->> have unexpected behavior when combined with unusual macros Created: 06/Dec/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: | Minor |
| Reporter: | Gary Fredericks | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 4 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
|
My intuitive understanding of the classic threading macros is that the meaning of forms like (-> a b c) can be understood syntactically independent of the meaning of the symbols involved or the fact that the two threading macros are defined recursively. However the recursive definition breaks that expectation. After (macroexpand-1 (macroexpand-1 '(-> a b c))) => (c (-> a b)) c is now in control if it is a macro, and is now seeing the argument (-> a b) rather than (b a) as would be the case if we had written (c (b a)) originally. Admittedly I do not know of a realistic example where this is an important distinction (I noticed this when playing with a rather perverse use of ->> with macros from korma), but at the very least it means that the behavior of the threading macros isn't quite as easy to accurately explain as I thought it was. |
| Comments |
| Comment by Gary Fredericks [ 07/Dec/12 9:19 AM ] |
|
I just realized that my patch also implements CLJ-1086. |
| Comment by Stuart Halloway [ 22/Dec/12 9:48 AM ] |
|
Would be nice if tests also demonstrated that metadata is preserved correctly. |
| Comment by Gary Fredericks [ 26/Dec/12 8:16 PM ] |
|
New patch in response to stuarthalloway feedback. |
| Comment by Tim McCormack [ 09/Jan/13 6:47 PM ] |
|
This patch also prevents an infinite loop in the macroexpander when fed the following expression: (->> a b (->> c d)) Edit: Far simpler example. |
[CLJ-827] unsigned-bit-shift-right Created: 09/Aug/11 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Joe Gallo | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 12 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| 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. |
[CLJ-322] Enhance AOT compilation process to emit classfiles only for explicitly-specified namespaces Created: 29/Apr/10 Updated: 12/Apr/13 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 12 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Waiting On: | Chas Emerick |
| Description |
|
This was originally/erroneously reported by Howard Lewis Ship in the clojure-contrib assembla: My build file specifies the namespaces to AOT compile but if I include another namespace (even from a JAR dependency) that is not AOT compiled, the other namespace will be compiled as well. In my case, I was using clojure-contrib's clojure.contrib.str-utils2 namespace, and I got a bunch of clojure/contrib/str_utils2 classes in my output directory. I think that the AOT compiler should NOT precompile any namespaces that are transitively reached, only namespaces in the set specified by the command line are appropriate. As currently coded, you will frequently find unwanted third-party dependencies in your output JARs; further, if multiple parties depend on the same JARs, this could cause bloating and duplication in the eventual runtime classpath. Having the option of shipping either all AOT-compiled classfiles or mixed source/AOT depending upon one's distribution requirements would make that phase of work with a clojure codebase significantly easier and less error-prone. The only question in my mind is what the default should be. We're all used to the current behaviour, but I'd guess that any nontrivial project where the form of the distributable matters (i.e. the source/AOT mix), providing as much control as possible by default makes the most sense. Given the tooling that most people are using, it's trivial (and common practice, IIUC) to provide a comprehensive list of namespaces one wishes to compile, so making that the default shouldn't be a hurdle to anyone. If an escape hatch is desired, a --transitive switch to clojure.lang.Compile could be added. |
| Comments |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/322 |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
hlship said: I'd like to reinforce this. I've been doing research on Clojure build tools for an upcoming talk and all of them (Maven, Leiningen, Gradle) have the same problem: the AOT compile extends from the desired namespaces (such as one containing a :gen-class) to every reached namespace. This is going to cause a real ugliness when application A uses libraries B and C that both depend on library D (such as clojure-contrib) and B and C are thus both bloated with duplicate, unwanted AOT compiled classes from the library D. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: This behaviour is an implementation detail of Clojure's AOT compilation process, and is orthogonal to any particular build tooling. I am working on a patch that would provide a mechanism for such tooling to disable this default behaviour. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: A first cut of a change to address this issue is here (caution, work in progress!): http://github.com/cemerick/clojure/commit/6f14e0790c0d283a7e44056adf1bb3f36bb16e0e This makes available a new recognized system property, clojure.compiler.transitive, which defaults to true. When set/bound to false (i.e. -Dclojure.compiler.transitive=false when using clojure.lang.Compile), only the first loaded file (either the ns named in the call to compile or each of the namespaces named as arguments to clojure.lang.Compile) will have classfiles written to disk. This means that this compilation invocation: java -cp <your classpath> -Dclojure.compiler.transitive=false clojure.lang.Compile com.bar com.baz
will generate classfiles only for com.bar and com.baz, but not for any of the namespaces or other files they load, require, or use. The only shortcoming of this WIP patch is that classfiles are still generated for proxy and gen-class classes defined outside of the explicitly-named namespaces. What I thought was a solution for this ended up breaking the loading of generated interfaces (as produced by defprotocol, etc). I'll take a second look at this before the end of the week, but wanted to get this out there so as to get any comments people might have. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
technomancy said: Looks good, but I'm having trouble getting it to work. I tried compiling from master of Chas's fork on github, but I still got the all the .class files generated with -Dclojure.compiler.transitive=false. It could be a quirk of the way I'm using ant to fork off processes though. Is it possible to set it using System/setProperty, or must it be given as a property on the command-line? |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: Bah, that's just bad documentation. :-/ The system property is only provided by clojure.lang.Compile; the value of it drives the binding of clojure.core/transitive-compile, which has a root binding of true. You should be able to configure the transitivity the same way you configure compile-path (system prop to clojure.lang.Compile or a direct binding when at the REPL, etc). If not, ping me in irc or elsewhere. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
meikelbrandmeyer said: I think, excluding parts 'load'ed is a little strong. I have some namespaces which load several parts from different files, but which belong to the same namespace. The most prominent example of such a case is clojure.core itself. I'm find with stopping require and use, but load is a bit too much, I'd say. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
technomancy said: Chas: Thanks; will give that a go. Meikel: Do people actually use load outside of clojure.core? I thought it was only used there because clojure.core is a "special" namespace where you want more vars to be available than can reasonably fit in a single file. Splitting up a namespace into several files is quite unadvisable otherwise. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
technomancy said: I can confirm that this works for me modulo the proxy/gen-class issue that Chas mentioned. I would love to see this in Clojure 1.2; it would really clean up a lot of build-related issues. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
meikelbrandmeyer said: I used it several times and this is the first time, I hear that it is unadvisable to do so. Even with a lower number of Vars in the namespace (c.c is here certainly exceptional) and might be of use to split several "sections" of code which belong to the same namespace but have different functionality. Whether to use a big comment in the source to indicate the section or split things into subfiles is a matter of taste. But it's a perfectly reasonable thing todo. Another use case, where I use this (and c.c.lazy-xml, IIRC) is to conditionally load code depending on whether a dependency is available or not. Eg. vimclojure uses c.c.pprint and c.c.stacktrace/clj-stacktrace transparently depending on their availability. There are perfectly legal uses of load. I don't see any "unadvisable" here. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: Thanks, Meikel; I had forgotten about that use case, as I don't use load directly myself at all. I probably wouldn't say it's inadvisable, just mostly unnecessary. In any case, that's a good catch. It complicates things a bit, but we'll see what happens. I'm going to take another whack at resolving the proxy/gen-class case and narrowing the impact of nontransitivity to use and require later tonight. I agree wholeheartedly that this should be in 1.2, assuming the technical bits work out. This has been an irritant for quite a long time. I actually believe that nontransitivity should be the default – no one wants or expects to have classfiles show up for dependencies show up when a project is AOT-compiled. I think the only negative impact would be whoever still fiddles with compilation at the REPL, and doesn't use maven or lein – and even then, it's just a matter of binding another var. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
meikelbrandmeyer said: Then the var should be added to the default bindings in the clojure.main repl. Then it's set!-able like the other vars ��� warn-on-reflection and friends. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: This is looking pretty good (still WIP): http://github.com/cemerick/clojure/commit/fedfb022ecef420a932b3d69c182ec7a8e5960a6 Thank you again for mentioning load, Meikel: it was very helpful in resolving the proxy/gen-class issue as well. Just a single data point: the jar produced by the medium-sized project I've been using for testing the changes has shrunk from 1.8MB to less than 1MB. That's not the only reason this is a good change, but it's certainly a nice side-effect. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: [file:aIWFiWHeGr35ImeJe5cbLA] |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: [file:aI7Eu-HeGr35ImeJe5cbLA] |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: Patched attached. The The user impact of changing the default would be:
|
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
hlship said: Just had a brain-storm: How about an option to support transitive compilation, but only if the Clojure source file being compiled as a file: URL (i.e., its a local file on the file system, not a file stored in a JAR). That would make it easier to use compilation on the local project without transitively compiling imported libraries, such as clojure-contrib. So transitive-compile should be a keyword, not a boolean, with values :all (for 1.1 behavior), :none (to compile only the exact specified namespaces) or :local (to compile transitively, but only for local files, not source files from JARs). |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: (Crossposted to the clojure-dev list) I thought about this some, and I don't think that's a good idea, at least for now. I'm uncomfortable with semantics changing depending upon where code is being loaded from – which, depending upon a tool's implementation, might be undefined. E.g. if the com.foo.bar ns is available in source form in one directory, but as classes from a jar, and classpaths aren't being constructed in a stable fashion, then the results of compilation will change. If we decide that special treatment depending upon the source of code is warranted in the future, that's a fairly straightforward thing to do w.r.t. the API – we could have :all and :local as you suggest, with nil representing :none. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
stu said: Rich is not comfortable enough with the implementation complexity of this patch (e.g. the guard clause for proxies and gen-class) to slide this in as a minor fix under the wire for 1.2. Better to live with the pain we know a little longer than ship something we don't have enough experience with to be confident. |
| Comment by Chas Emerick [ 19/Nov/10 9:28 PM ] |
|
Updated patch to cleanly apply to HEAD and address issues raised by screening done by Cosmin Stejerean. Also includes proper tests. Note: this patch's tests require the fix for |
| Comment by Stuart Halloway [ 29/Nov/10 7:18 AM ] |
|
the "-resolved" patch resolves a conflict in main.clj |
| Comment by Stuart Halloway [ 29/Nov/10 7:25 AM ] |
|
Several questions:
|
| Comment by Stuart Sierra [ 10/Dec/10 3:34 PM ] |
|
An alternative approach: patch write-classes-1.diff.gz From my forked branch What this patch does:
This approach was prompted by the following observations:
|
| Comment by Chas Emerick [ 10/Dec/10 4:04 PM ] |
|
S. Halloway: My apologies, I didn't know you had commented. I thought that, having assigned this issue to myself, I'd be notified of updates. FWIW, I aim to review your comments and SS' approach over the weekend. |
| Comment by Chas Emerick [ 16/Dec/10 7:36 AM ] |
|
S. Halloway: 1. Certainly shouldn't happen. AFAIK, others have screened the patch, presumably with a successful build. |
| Comment by Chas Emerick [ 16/Dec/10 9:00 AM ] |
|
I think S. Sierra's approach is fundamentally superior what I offered. I have two suggestions: one slight perspective change (which implies no change in the actual implementation), and an idea for an even simpler approach (at least from a user perspective), in that order. While interop is the driving requirement behind AOT, I absolutely do not want to have to keep an updated enumeration of all of the classes resulting from each and every defrecord et al. usages in my pom.xml/project.clj (and I wouldn't wish the task of ferreting those usages and their resulting classnames on any build tool author). Right now, *compile-write-classes* is documented to be a set of classname strings, but could just as easily be any other function. *compile-write-classes* should be documented to accept any predicate function (renamed to e.g. *compile-write-class?*?). There's no reason why it shouldn't be bound to, e.g. #(re-matches #"foo\.bar\.[\w_]+$" %) if I know that all my records are defined in the foo.bar namespace. To go along with that, I think some package/classname-globbing utilities along with corresponding options to clojure.lang.Compile would be most welcome. Classname munging rules are not exactly obvious, and it'd be good to make things a little easier for users in this regard. Another alternativeIf there's a closed set of forms that generate classes that one might reasonably be interested in having in a build result (outside of use cases for pervasive AOT), then why not have a simple option that only those forms utilize? gen-class and gen-interface already do this, but reusing the all-or-nothing *compile-files* binding; if they keyed off of a binding that implied a diminished scope (e.g. *compile-interop-forms* – which would be true if *compile-files* were true), then they'd do exactly what we wanted. Extending this approach to deftype (and therefore defrecord) should be straightforward. An implementation of this would probably be somewhat more complicated than S. Sierra's patch, though not as complex as my original stab at the problem (i.e. no *load-level*). On the plus side: 1. No additional configuration for users or implementation work for build tool authors, aside from the addition of the boolean diminished-scope AOT option I can see wanting to further restrict AOT to specific classnames in certain circumstances, in which case the above and S. Sierra's patch might be complimentary. |
| Comment by Stuart Sierra [ 16/Dec/10 11:49 AM ] |
|
I like the idea of *compile-interop-forms*. But is it always possible to determine what an "interop form" is? I think it is, I'm just not sure. |
| Comment by Allen Rohner [ 09/Oct/11 12:50 PM ] |
|
I'm also in favor of compile-interop-forms. As far as determining, how about sticking metadata on the var? (defmacro ^{:interop-form true} deftype ...) |
| Comment by Stuart Sierra [ 21/Oct/11 8:38 AM ] |
|
Summary and design discussion on wiki at http://dev.clojure.org/display/design/Transitive+AOT+Compilation |
| Comment by Stuart Sierra [ 29/Nov/11 6:54 PM ] |
|
New attachment compile-interop-1.patch has new approach: Add a third possible value for *compile-files*. True and false keep their original meanings, but :interop causes only interop-related forms to be written out as .class files. "Interop forms" are gen-class, gen-interface, deftype, defrecord, defprotocol, and definterface. Pros:
Cons:
|
| Comment by Stuart Sierra [ 02/Dec/11 8:12 AM ] |
|
Just realized my patch doesn't solve the transitive compilation problem. If library A loads library B, then compiling interop forms in A will also emit interop .class files in B. |
| Comment by Paudi Moriarty [ 01/Jan/13 3:55 AM ] |
|
It's disappointing to see an important issue like this still unresolved after 2.5 years. This is a real pain for us. We have a large closed source project where shipping source is not an option. This forces us to manage the AOT'ing of dependencies due to the hard dependency on protocol interfaces introduced by transitive AOT compilation (see https://groups.google.com/forum/?fromgroups=#!topic/clojure-dev/r3A1JOIiwVU). |
| Comment by Andy Fingerhut [ 01/Jan/13 4:27 PM ] |
|
Paul, do you have a suggestion for which of the approaches described in comments here, or on the wiki page http://dev.clojure.org/display/design/Transitive+AOT+Compilation would be preferable solution for you? Or perhaps even a patch that implements your preferred approach? |
| Comment by Howard Lewis Ship [ 04/Jan/13 4:18 PM ] |
|
Andy, I'm now consulting with Paudi's organization, so I think I can speak for him (I'm now the default buildmeister). I like Stuart's :interop idea, but that is somewhat orthogonal to our needs. I return to what I would like; compilation would compile specific namespaces; dependencies of those namespaces would not be compiled. To be honest, I'm still a little hung up on the interop forms: especially defprotocol and friends; from a cursory glance, it appears that todays AOT compilation will compile the protocol into a Java class, then compile the namespace that references the protocol with the assumption that the protocol's Java class is available. When we use build rules to only package our namespace's class files into the output JAR, the code fails with a NoClassDefFoundError because the protocol really needs to be recompiled, at runtime compilation, into an in-memory Java class. Obviously, supporting this correctly will be a challenge; the compiled bytecode for our namespace would ideally: I can imagine any number of ways to juggle things to make this work, so I won't suggest a specific implementation. In the meantime, our workaround is to create a "stub" module as part of our build; it simply requires in the necessary namespaces (for example, org.clojure:core.cache); this forces an AOT compile of the dependencies and we have a special rule to package such dependencies in the stub module's output JAR. This may not be a scalable problem, and it is expensive to identify what 3rd party dependencies require this treatment. |
[CLJ-1187] Clojure loses quoted metdata on empty literals Created: 22/Mar/13 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5, Release 1.6 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Nicola Mometto | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
|
user=> (meta '^:foo []) while This bug propagates to ^:const vars: |
| Comments |
| Comment by Nicola Mometto [ 22/Mar/13 2:12 PM ] |
|
After patch: user=> (meta '^:foo []) |
| Comment by Stuart Halloway [ 29/Mar/13 6:13 AM ] |
|
I believe the title should read "Clojure loses quoted metdata on empty literals". |
| Comment by Stuart Halloway [ 29/Mar/13 6:16 AM ] |
|
At first glance, the implementation looks wrong in that it blocks non-IObjs ever getting to EmptyExpr. Probably all persistent collections are IObjs, but would not want to bake this in. |
| Comment by Nicola Mometto [ 29/Mar/13 7:00 AM ] |
|
You're right, I've updated my patch, it should work as expected now |
| Comment by Andy Fingerhut [ 04/Apr/13 9:44 PM ] |
|
Nicola: Your updated patch 001-CLJ-1187.patch dated Mar 29, 2013 gives syntax errors when I try to compile it. |
| Comment by Nicola Mometto [ 05/Apr/13 9:06 AM ] |
|
Oh, the irony, I messed up some parentheses writing java. Sorry for it, here's the correct patch, it applies on upstream/master. |
[CLJ-1171] Compiler macro for clojure.core/instance? disregards lexical shadows on class names Created: 27/Feb/13 Updated: 12/Apr/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: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
SummaryThe compiler tries to emit jvm native instanceof expressions for direct clojure.core/instance? calls. 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-1175] NPE in clojure.lang.Delay/deref Created: 06/Mar/13 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
|
If a Delay wraps a function which throws an exception, then forcing that delay multiple times causes behavior which is, to me at least, surprising and unexpected: the first time it is forced, the expected exception is thrown; but after that it will behave as if all locals the expression refers to are nil. This can manifest in multiple ways, depending on the expression being delayed: ;; calling a local as a function causes an NPE inside clojure.lang.Delay (let [f #(/ 1 0) d (delay (f))] [(try (force d) (catch Exception e e)) (try (force d) (catch Exception e e))]) [#<ArithmeticException java.lang.ArithmeticException: Divide by zero> #<NullPointerException java.lang.NullPointerException>] ;; if nil is a valid value, this can cause subsequent forces to "succeed" ;; even though the first fails as it should (let [x (java.util.Date.) d (delay (seq x))] [(try (force d) (catch Exception e e)) (try (force d) (catch Exception e e))]) [#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.util.Date> nil] The reason for this is that clojure.core/delay creates a ^:once function, promising to call it only once, so that the compiler can do locals-clearing on its lexical closure. However, when an exception is thrown the Delay object is left thinking it has never called the function, so when it is forced again it calls the function again, breaking its promise to the compiler and causing the function to run after its locals have been cleared. In fact, once we realize that locals-clearing is involved, we can make the delay behave differently the first N times it is forced, instead of only the first time, by constructing an expression which throws an exception before using all of its locals: (let [x (java.util.Date.)
y (Long. 1)
d (delay (let [y (seq y)]
(cons (seq x) y)))]
[(try (force d)
(catch Exception e e))
(try (force d)
(catch Exception e e))
(try (force d)
(catch Exception e e))])
[#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.util.Date>
(nil)]
I'm not sure what the right fix for this issue is: perhaps the best choice is even to leave it alone, and just document that delay's behavior is undefined if the expression throws an exception. However, I propose making the Delay remember the first exception that was thrown, and rethrow it on subsequent force attempts. This makes sense, in a way: the "result" of the expression was this exception e being thrown, and so this should happen every time. It might be preferable to have the Delay retry the expression until it succeeds, but I don't believe this is possible without abandoning locals-clearing, which would cause perfectly-valid delays to now run out of memory, holding onto no-longer-needed locals just in case the expression needs to retry at some later date. So I've attached a patch that causes Delay to rethrow the original exception, and a test for that behavior, which of course fails if the change to Delay is not made. |
[CLJ-1083] Incorrect ArityException message for function names containing -> Created: 09/Oct/12 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2, Release 1.3, Release 1.4, Release 1.5 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Alex Nixon | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
user=> (defn a->b []) Note that the reported function name in the stack trace is "user$a", where it should be "user$a->b" (or some mangled variant thereof?) See discussion here: https://groups.google.com/d/msg/clojure/PVNoLclhhB0/_NWqyE0cPAUJ |
| Comments |
| Comment by Timothy Baldridge [ 26/Nov/12 10:27 AM ] |
|
Fix for this defect. |
| Comment by Timothy Baldridge [ 26/Nov/12 10:30 AM ] |
|
The throwArity now attempts to locate and call clojure.main/demunge. If it finds the function it invokes it and uses the returned string in the error. Otherwise it just throws the actual class name. This results in the following behaviour: user=> (defn a->b []) |
[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-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-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-935] clojure.string/trim uses different defn of whitespace as triml, trimr Created: 21/Feb/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: | Defect | Priority: | Minor |
| Reporter: | Andy Fingerhut | Assignee: | Aaron Bedra |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
clojure.string/triml and trimr use Character/isWhitespace to determine whether a character is whitespace, but trim uses some other definition of white space character. For example: user=> (use 'clojure.string) The attached patch changes trim to use Character/isWhitespace. I suppose other possibilities are to change triml and trimr to use trim's notion of whitespace, whatever that is, or to just leave these functions inconsistent with each other. It does seem that it would be a nice property that (trim s) is equal to (triml (trimr s)) for all strings. The patch also changes triml to only call .length on s once. |
| Comments |
| Comment by Stuart Halloway [ 08/Jun/12 10:22 AM ] |
|
Question for Rich: do we want to be consistent across the different trim fns (per this patch) or consistent with Java, which uses one definition of whitespace in Character/isWhitespace, and a different definition in String/trim? |
| Comment by Stuart Halloway [ 08/Jun/12 10:22 AM ] |
|
Question for Andy: why the (int ...) forms, when Clojure only works with primitive longs? |
| Comment by Andy Fingerhut [ 08/Jun/12 10:33 AM ] |
|
Answer for Stuart: Looks like I was preserving the (int ...) form that was in triml before, perhaps somewhat mindlessly. Depending on Rich's answer, I can update the patch if desired. |
| Comment by Aaron Bedra [ 11/Apr/13 5:34 PM ] |
|
Bump on the discussion. This ticket seems blocked until we make a decision. |
[CLJ-1185] `reductions should respect `reduced Created: 16/Mar/13 Updated: 10/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
This returns 16: (reduce (fn [acc x]
(let [x' (* x x)]
(if (> x' 10)
(reduced x')
x')))
(range))
But replacing `reduce with `reductions will never terminate: (reductions (fn [acc x]
(let [x' (* x x)]
(if (> x' 10)
(reduced x')
x')))
(range))
This is because `reductions ignores 'clojure.lang.Reduced, it never tests for `reduced? I know that I only just discovered the `reduced, function, but `reductions is a big part of my debugging process, so it's unfortunate that they don't work together. |
| Comments |
| Comment by Brandon Bloom [ 16/Mar/13 6:10 PM ] |
|
Attaching patch |
[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-937] cl-format prints ratio arguments with bad format for E, F, G directives Created: 21/Feb/12 Updated: 08/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
user=> (use 'clojure.pprint) Patch changes cl-format so that when E, F, or G directive is used, the corresponding arg is coerced from a clojure.lang.Ratio to a double before formatting. |
| Comments |
| Comment by Tom Faulhaber [ 29/Mar/12 8:48 PM ] |
|
I have reviewed this patch and recommend that it be applied. (This one has actually been on my to do list for about 4 years. Thanks, Andy!) |
| Comment by Andy Fingerhut [ 08/Apr/13 12:02 PM ] |
|
Patch clj-937-cl-format-coerces-ratios-patch2.txt dated Apr 8 2013 supersedes the previous patch cl-format-efg-coerce-ratios-to-doubes-patch1.txt dated Feb 21 2013. The newer patch works with ratios that cannot be represented as a double, using BigDecimal in those cases. The older patch would print garbage from the string "Infinity" if the ratios were larger than Double/MAX_VALUE, or 0 if the ratio was between 0 and Double/MIN_VALUE. |
[CLJ-976] Implement reader literal and print support for PersistentQueue data structure Created: 27/Apr/12 Updated: 06/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Fogus | Assignee: | Fogus |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | data-structures, queue, reader, tagged-literals | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Test |
| Description |
|
Clojure's PersistentQueue structure has been in the language for quite some time now and has found its way into a fair share of codebases. However, the creation of queues is a two step operation often of the form: (conj clojure.lang.PersistentQueue/EMPTY :a :b :c) ;=> #<PersistentQueue clojure.lang.PersistentQueue@78d5f6bc> A better experience might be the following: #queue [:a :b :c] ;=> #queue [:a :b :c] (pop #queue [:a :b :c]) ;=> #queue [:b :c] This syntax is proposed and discussed in the Clojure-dev group at https://groups.google.com/forum/?fromgroups#!topic/clojure-dev/GQqus5Wycno Open question: Should the queue literal's arguments eval? The implications of this are illustrated below: ;; non-eval case #queue [1 2 (+ 1 2)] ;=> #queue [1 2 (+ 1 2)] ;; eval case #queue [1 2 (+ 1 2)] ;=> #queue [1 2 3] The answer to this open question will determine the implementation. |
| Comments |
| Comment by Steve Miner [ 27/Apr/12 10:18 AM ] |
|
I think the non-eval behavior would be consistent with the other reader literals in Clojure 1.4. It's definitely better for interop where some other language implementation could be expected to handle a few literal representations, but not the evaluation of Clojure expressions. Use a regular function if the args need evaluation. |
| Comment by Chas Emerick [ 27/Apr/12 10:19 AM ] |
|
The precedent of records seems relevant: => (defrecord A [b])
user.A
=> #user.A[(+ 4 5)]
#user.A{:b (+ 4 5)}
=> #user.A{:b (+ 4 5)}
#user.A{:b (+ 4 5)}
This continues to make sense, as otherwise queues would need to print with an extra (quote …) form around lists — which records neatly avoid: => (A. '(+ 4 5))
#user.A{:b (+ 4 5)}
Does this mean that a queue fn (analogous to vector, maybe) will also make an appearance? It'd be handy for HOF usage. |
| Comment by Fogus [ 27/Apr/12 11:00 AM ] |
|
Added a patch for the tagged literal support ONLY. This is only one part of the total solution. This provides the read-string and printing capability. I'd like more discussion around the eval side before I get dive into the compiler. |
| Comment by Paul Michael Bauer [ 27/Apr/12 6:45 PM ] |
|
In addition to Chas' observations on consistency with record literals, would eval in queue literals open up the same security hole as #=, needing to respect *read-eval*? |
| Comment by Fogus [ 04/May/12 1:14 PM ] |
|
Evalable queue literal support. |
| Comment by Andy Fingerhut [ 10/May/12 5:54 PM ] |
|
Neither of the patches CLJ-976-queue-literal-tagged-parse-support-only.diff dated Apr 27, 2012 nor CLJ-976-queue-literal-eval.diff dated May 4, 2012 apply cleanly to latest master as of May 10, 2012. |
| Comment by Fogus [ 11/May/12 10:15 AM ] |
|
Updated patch file to merge with latest master. |
| Comment by Fogus [ 20/Jul/12 1:14 PM ] |
|
New patch with support fixed for syntax-quote. |
| Comment by Stuart Sierra [ 17/Aug/12 12:41 PM ] |
|
Patch does not apply as of commit f5f4faf95051f794c9bfa0315e4457b600c84cef |
| Comment by Fogus [ 17/Aug/12 3:06 PM ] |
|
Weird. I was able to download the CLJ-976-queue-literal-eval-and-synquote.diff patch and apply it to HEAD as of just now (f5f4faf95051f794c9bfa0315e4457b600c84cef). There were whitespace warnings, but the patch applied, compiles and passes all tests. |
| Comment by Andy Fingerhut [ 17/Aug/12 7:29 PM ] |
|
With latest head I was able to successfully apply patch CLJ-976-queue-literal-eval-and-synquote.diff with this command: git am --keep-cr -s < CLJ-976-queue-literal-eval-and-synquote.diff with some warnings, but successfully applied. If I try it without the --keep-cr option, the patch fails to apply. I believe this is often a sign that either one of the files being patched, or the patch itself, contains CR/LF line endings, which some of the Clojure source files definitely do. The command above (with --keep-cr) is currently the one recommended for applying patches on page http://dev.clojure.org/display/design/JIRA+workflow in section "Screening Tickets". I added the suggested --keep-cr option after running across another patch that applied with the option, but not without it. |
| Comment by Andy Fingerhut [ 28/Aug/12 5:45 PM ] |
|
Presumptuously changing Approval from Incomplete back to Test, since the latest patch does apply cleanly if --keep-cr option is used. |
| Comment by Rich Hickey [ 08/Sep/12 6:48 AM ] |
|
this needs more time |
| Comment by Fogus [ 18/Sep/12 8:15 AM ] |
|
Rich, Do you mind providing a little more detail? I would be happy to make any changes if needed. However, if it's just a matter of its relationship to EDN and/or waiting until the next release then I am happy to wait. In either case, I'd like to complete this or push it to the back of my mind. Thanks. |
| Comment by Andy Fingerhut [ 05/Oct/12 7:49 AM ] |
|
clj-976-queue-literal-eval-and-synquote-patch-v2.txt dated Oct 5 2012 is identical to Fogus's patch CLJ-976-queue-literal-eval-and-synquote.diff dated Jul 20 2012. It simply removes one line addition to clojure.iml that Rich has since added in a different commit, so that this patch now applies cleanly to latest master. |
| Comment by Andy Fingerhut [ 16/Oct/12 12:20 PM ] |
|
clj-976-queue-literal-eval-and-synquote-patch-v3.txt dated oct 16 2012 is identical to Fogus's patch CLJ-976-queue-literal-eval-and-synquote.diff dated Jul 20 2012. It simply removes one line addition to clojure.iml that Rich has since added in a different commit, so that this patch now applies cleanly to latest master. |
| Comment by Andy Fingerhut [ 20/Oct/12 12:26 PM ] |
|
Fogus, with the recent commit of a patch for |
| Comment by Steve Miner [ 06/Apr/13 8:07 AM ] |
|
Related to CLJ-1078. |
[CLJ-1078] Added queue, queue* and queue? to clojure.core Created: 26/Sep/12 Updated: 06/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Timothy Baldridge | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | data-structures, queue | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
This patch adds functions for PersistentQueue. queue, queue? and queue* match the list functions of the same naming conventions. Patches include updates to tests. |
| Comments |
| Comment by Andy Fingerhut [ 28/Sep/12 8:43 AM ] |
|
Timothy, I tried applying both of these Sep 26, 2012 patches to latest Clojure master as of that date. I had to apply 0001-make-PersistentQueue-ctor-public.patch by hand since it failed to apply using git or patch. It built fine, but failed to pass several of the Clojure tests. Have you looked into those test failures to see if you can find the cause and fix them? I tested on Ubuntu 11.10 with Oracle JDK 1.6 and 1.7, and saw similar failures with both. |
| Comment by Timothy Baldridge [ 26/Oct/12 5:23 PM ] |
|
Fixed the patch. Tests pass, created the patch, applied it to a different copy of the source and the tests still pass. So this new patch should be good to go. |
| Comment by Andy Fingerhut [ 26/Oct/12 5:43 PM ] |
|
Timothy, I'm not sure how you are getting successful results when applying this patch. Can you try the steps below and see what happens for you? I get errors trying to apply the patch with latest Clojure master as of Oct 26, 2012. Also please use the steps on the JIRA workflow page to create a git format patch (http://dev.clojure.org/display/design/JIRA+workflow under "Development" heading). % git clone git://github.com/clojure/clojure.git |
| Comment by Timothy Baldridge [ 26/Oct/12 6:08 PM ] |
|
I was using git apply. I tried the method you show above, and now I'm seeing the same issues you show above. |
| Comment by Andy Fingerhut [ 26/Oct/12 6:26 PM ] |
|
Just so you know, the preferred way to create and apply patches are the "git format-patch master --stdout > patch.txt" to create a patch (after doing the branching commands described on the JIRA workflow page to create a branch for your changes), and the "git am --keep-cr -s < patch.txt" to apply a patch. If a patch was created that way and applies cleanly with that command, then you are definitely good to go. The "patch -p1 < patch.txt" command is just a secondary method sometimes used to try to apply patches that aren't in the format produced above, or have errors when applying using that method. |
| Comment by Timothy Baldridge [ 26/Oct/12 9:15 PM ] |
|
Just so you know, the preferred way to create and apply patches are the "git format-patch master --stdout > patch.txt" to create a patch (after doing the branching commands described on the JIRA workflow page to create a branch for your changes), and the "git am --keep-cr -s < patch.txt" to apply a patch. If a patch was created that way and applies cleanly with that command, then you are definitely good to go. The "patch -p1 < patch.txt" command is just a secondary method sometimes used to try to apply patches that aren't in the format produced above, or have errors when applying using that method. |
| Comment by Timothy Baldridge [ 26/Oct/12 9:16 PM ] |
|
added patch |
| Comment by Andy Fingerhut [ 26/Oct/12 9:37 PM ] |
|
That one applies cleanly and passes all tests. It should show up on the next list of prescreened patches. Thanks. |
| Comment by Rich Hickey [ 29/Nov/12 9:54 AM ] |
|
we don't use the queue* convention elsewhere, e.g. vec and vector. I think queue should take a collection like vec and set. (queue [1 2 3]) could be made to 'adopt' the collection as front. |
| Comment by Andy Fingerhut [ 11/Dec/12 1:00 PM ] |
|
Patch queue.patch dated Oct 26 2012 no longer applies cleanly after recent |
| Comment by Steve Miner [ 06/Apr/13 8:06 AM ] |
|
See also CLJ-976 (tagged literal support for PersistentQueue) |
[CLJ-1191] Improve apropos to show some indication of namespace of symbols found Created: 04/Apr/13 Updated: 05/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5, Release 1.6 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
apropos does find all symbols in all namespaces that match the argument, but the return value gives no clue as to which namespace the found symbols are in. It can even return multiple occurrences of the same symbol, which only gives a clue that the symbol exists in more than one namespace, but not which ones. For example: user=> (apropos "replace") It would be nice if the returned symbols could indicate the namespace, either always, or if the found symbol is not in the current namespace. |
| Comments |
| Comment by Andy Fingerhut [ 04/Apr/13 8:25 PM ] |
|
Path clj-1191-patch-v1.txt enhances apropos to put a namespace/ qualifier before every symbol found that is not in the current namespace ns. It also finds the shortest namespace alias if there is more than one. Examples of output with patch: user=> (apropos "replace") user=> (require '[clojure.string :as str]) user=> (in-ns 'clojure.string) |
| Comment by Colin Jones [ 05/Apr/13 1:34 PM ] |
|
+1 apropos as it already stands is quite helpful for already-referred vars, but not for vars that are only in other nses. This update includes the information someone would need to further investigate the output. |
[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-1026] Mixed end-of-line endings in the source code Created: 17/Jul/12 Updated: 30/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | John Szakmeister | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
While examining some of the Clojure source code, I discovered that some files had mixed line endings, or CRLF line endings on a non-Windows box. Using .gitattributes, we can correct that so that files have the right endings for the platform that it's on. |
| Comments |
| Comment by John Szakmeister [ 17/Jul/12 2:26 PM ] |
|
Patch to fix line endings and introduce .gitattributes. |
| Comment by Stuart Halloway [ 20/Jul/12 4:47 PM ] |
|
This looks like a change to every line in the world, which makes it hard to vet. Also: will it render incompatible all other outstanding patches at the time it is applied? |
| Comment by John Szakmeister [ 21/Jul/12 6:52 AM ] |
|
You can use git diff -w $(git merge-base HEAD master) to see the actual diff minus the line ending change. Here it is inline: :: git diff -w $(git merge-base HEAD master) diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7b89cfa --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +*.txt text +*.clj text +*.html text +*.js text +*.css text +*.java text diff=java Also, no, it won't render all the outstanding patches incompatible. For one, it seems like the files that have the eols mixed or in CRLF aren't touched much. I also went through the majority of outstanding patches and couldn't fix one that conflicts. Secondly, format-patch emits the patch inline and is intended to be sent via email. SMTP says that all lines must end with CRLF, so line endings are effectively lost. So git will convert it to the right line ending on application. It can conflict with any outstanding branches that you may have. Supplying the renormalization option on merge can help: git merge -X renormalize <branch-name> Or, you can enable this by default for your repository: git config --local merge.renormalize true
If you think it's too much trouble, let's just drop it though. |
| Comment by Stuart Halloway [ 10/Aug/12 1:15 PM ] |
|
Patch does not apply on my working copy of Clojure. I am using git am -s ...
/Users/stu/repos/clojure/.git/rebase-apply/patch:344: trailing whitespace.
p {
/Users/stu/repos/clojure/.git/rebase-apply/patch:350: space before tab in indent.
margin-left: 0.5in;
error: patch failed: epl-v10.html:1
error: epl-v10.html: patch does not apply
error: patch failed: src/jvm/clojure/asm/AnnotationVisitor.java:1
error: src/jvm/clojure/asm/AnnotationVisitor.java: patch does not apply
error: patch failed: src/jvm/clojure/asm/AnnotationWriter.java:1
error: src/jvm/clojure/asm/AnnotationWriter.java: patch does not apply
I am willing to do this, just inept. |
| Comment by Andy Fingerhut [ 10/Aug/12 1:21 PM ] |
|
Stuart, I updated this page http://dev.clojure.org/display/design/JIRA+workflow a while back when I had trouble applying some patches involving files with carriage return line endings. I did some Googling on git docs and found the option '--keep-cr' that seems to help in such cases. Try that out. |
[CLJ-1004] ArrayChunk implements Seqable Created: 28/May/12 Updated: 25/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Jim Blomo | Assignee: | Jim Blomo |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
I've found it helpful to be able to iterate over ArrayChunks. Implementing Seqable means they can be used by most collections functions. |
| Comments |
| Comment by Jim Blomo [ 28/May/12 7:55 PM ] |
|
2012-05-28 implements the seq method for vec and vector-of. It uses the array backing ArrayChunk to construct a sequence. Simple tests are included. |
| Comment by Stuart Halloway [ 01/Mar/13 9:44 AM ] |
|
Please add discussion of motivating use cases. |
| Comment by Jim Blomo [ 25/Mar/13 11:10 PM ] |
|
This was motivated by the desire to implement chunk-sequence-aware functions in Clojure elegantly. Currently, dealing with ArrayChunks in Clojure is clumsy because few of the functions dealing with collections will work with non-seqables. This functionality will mostly be used by implementers since end users shouldn't care if their sequence is chunked or not. |
[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-713] Upgrade ASM to a more current version Created: 11/Jan/11 Updated: 11/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Aaron Bedra | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
| Comments |
| Comment by Ghadi Shayban [ 10/Mar/13 6:34 AM ] |
|
Attached is a patch that externalizes and moves the ASM lib to the latest version (4.1), which has support for invokeDynamic if a brave soul wants to emit that instruction. Heed fogus's caveats [3]. ASM in this patch is not re-rooted, but an external Maven dependency. It does have the disadvantage of possibly conflicting with other dependents of ASM, but this is the same approach is used by other JVM langs. Can classloaders mitigate that problem? [1] Recent post on clojure-dev, oblivious of [2] https://groups.google.com/d/msg/clojure-dev/iX-ZFPk_zyE/Es3mDOdG3bYJ |
| Comment by Ghadi Shayban [ 11/Mar/13 10:41 AM ] |
|
Ran some of Andy Fingerhut's expression microbenchmarks on -master with the patch. There is no difference between performance compared to 1.5.1. |
| Comment by Andy Fingerhut [ 11/Mar/13 3:43 PM ] |
|
Ghadi, out of curiosity, if you do AOT compilation of some Clojure class files, does it produce byte-for-byte identical .class files after your changes vs. before your changes? If so, that would be pretty high assurance of no problems. If not, it would be good to understand what changed. |
[CLJ-1169] Add filename and line number to defn parameter declaration error Created: 22/Feb/13 Updated: 10/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Andrei Kleschinski | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Windows |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
When mistyping parameter list in defn declaration, e.g. (defn test error message shows name of parameter (without quotes), but not function name, filename or line number: Exception in thread "main" java.lang.IllegalArgumentException: Parameter declaration some-error should be a vector |
| Comments |
| Comment by Andrei Kleschinski [ 22/Feb/13 5:39 AM ] |
|
Proposed patch for issue Also patch adds quotes around invalid symbol name in error message to make them more distinguishable from rest of message. |
| Comment by Andy Fingerhut [ 01/Mar/13 9:32 AM ] |
|
Patch 0001-CLJ-1169-proposed-patch.patch dated Feb 22 2013 causes several tests to fail. Run "./antsetup.sh" then "ant" to see which ones (or "mvn package"). |
| Comment by Andrei Kleschinski [ 01/Mar/13 10:25 AM ] |
|
Fix for failed unit-tests |
[CLJ-1177] clojure.java.io/resource and non-ASCII characters Created: 07/Mar/13 Updated: 10/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Trevor Wennblom | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | bug, enhancement | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
clojure.java.io/resource corrupts path containing UTF-8 characters without issuing warning. user=> (System/getProperty "java.runtime.version") "1.8.0-ea-b79" user=> (clojure-version) "1.5.0" user=> (System/getProperty "user.dir") "/dir/déf" user=> (clojure.java.io/resource "myfile.txt") #<URL file:/dir/d%c3%a9f/resources/myfile.txt> user=> (slurp (clojure.java.io/resource "myfile.txt") :encoding "UTF-8") FileNotFoundException /dir/déf/resources/myfile.txt (No such file or directory) java.io.FileInputStream.open (FileInputStream.java:-2) |
| Comments |
| Comment by Andy Fingerhut [ 08/Mar/13 12:10 AM ] |
|
Below is a workaround, at least. I don't know, but perhaps the as-file method for URLs in io.clj of Clojure, the part that converts %hh sequences to a character with code point in the range 0 through 255, is at least partly at fault here. I don't know right now if it is possible to modify that code to handle the general case of whatever character encoding munging is going on here to when .getResource creates the URL object. clojure.java.io/resource is documented to return a Java object of type java.net.URL, which seems like it does %hh escaping of many characters. Reference [1] to a Java bug from 2001 where a Java user was surprised by the then-recent change in behavior of the getResource method [2]. Doing a little searching I found this StackOverflow question [3], which has what might be a workaround. I tried it on my Mac OS X 10.6 system running JDK 1.6 and it seemed to work: (slurp (.getContent (clojure.java.io/resource "abcíd/foo.txt"))) That getContent is a method for class java.net.URL [4] [1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4466485 |
| Comment by Trevor Wennblom [ 08/Mar/13 9:56 AM ] |
|
Hi Andy, Thanks for the background and suggestions, that's very helpful. I'm gradually learning Clojure with no Java experience. In this case I was searching for the preferred Clojure way to access items in directories declared under :resource-paths in a Leiningen project.clj file. Perhaps clojure.java.io/resource isn't the best way to do this as it's possibly too tied to the expectation for a URI instead of a more general IRI. You're suggested workaround did work for my use case: (slurp (.getContent (clojure.java.io/resource "abcíd/foo.txt"))) but hopefully there would be more native/direct Clojure way to accomplish the same eventually. I don't know if java.net.IDN would be useful internally as a fix in clojure.java.io/resource — I'm assuming not since it wasn't added until Java 6.[1] user=> (import 'java.net.IDN) java.net.IDN user=> (java.net.IDN/toASCII "/dir/déf") "xn--/dir/df-gya" user=> (java.net.IDN/toUnicode "xn--/dir/df-gya") "/dir/déf" [1]: http://docs.oracle.com/javase/6/docs/api/java/net/IDN.html |
| Comment by Andy Fingerhut [ 08/Mar/13 1:30 PM ] |
|
Patch clj-1177-patch-v1.txt dated Mar 8 2013 is an attempt to solve this issue, in what I think may be a correct way. As specified in RFC 3986, when taking a Unicode string and making a URL of it, it should be encoded in UTF-8 and then each individual byte is subject to the %HH hex encoding. This patch reverses that to turn URLs into file names. Tested on Mac OS X 10.6 with a command line like this (it doesn't work without the -Dfile.encoding=UTF-8 option on my Mac, probably because the default encoding is MacRoman): % java -cp clojure.jar:path/to/resource -Dfile.encoding=UTF-8 clojure.main |
[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-991] partition-by reducer Created: 10/May/12 Updated: 04/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Kevin Downey | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | enhancement, patch, patch, | ||
| Attachments: |
|
| Patch: | Code and Test |
| Comments |
| Comment by Rich Hickey [ 14/Aug/12 1:52 PM ] |
|
I'd like to see something much faster than this. |
| Comment by Kevin Downey [ 15/Aug/12 1:58 AM ] |
|
For reference here is a benchmark of a non-reducers (seq based) process that uses partition-by user=> (def x (vec (range 1e6)))
#'user/x
user=> (bench (reduce + (map count (partition-by #(or (zero? (mod % 3)) (zero? (mod % 5))) x))))
Evaluation count : 60
Execution time mean : 1.072157 sec 95.0% CI: (1.070606 sec, 1.073381 sec)
Execution time std-deviation : 165.818282 ms 95.0% CI: (163.873585 ms, 168.271261 ms)
Execution time lower ci : 972.562000 ms 95.0% CI: (972.562000 ms, 973.301850 ms)
Execution time upper ci : 1.419148 sec 95.0% CI: (1.419148 sec, 1.419148 sec)
Found 7 outliers in 60 samples (11.6667 %)
low-severe 2 (3.3333 %)
low-mild 5 (8.3333 %)
Variance from outliers : 85.8489 % Variance is severely inflated by outliers
nil
user=>
Same again using r/partition-by from reducer-partition-by.diff user=> (bench (r/reduce + (r/map count (r/partition-by #(or (zero? (mod % 3)) (zero? (mod % 5))) x))))
Evaluation count : 60
Execution time mean : 1.418350 sec 95.0% CI: (1.417738 sec, 1.418948 sec)
Execution time std-deviation : 66.736477 ms 95.0% CI: (66.186568 ms, 67.610777 ms)
Execution time lower ci : 1.370419 sec 95.0% CI: (1.370419 sec, 1.370419 sec)
Execution time upper ci : 1.544151 sec 95.0% CI: (1.544151 sec, 1.544156 sec)
Found 10 outliers in 60 samples (16.6667 %)
low-severe 2 (3.3333 %)
low-mild 8 (13.3333 %)
Variance from outliers : 33.5591 % Variance is moderately inflated by outliers
nil
user=>
(using https://github.com/hugoduncan/criterium for benchmarking) |
| Comment by Kevin Downey [ 15/Aug/12 2:17 AM ] |
|
same again for r/partition-by from reducers-partition-by2.diff user=> (bench (r/reduce + (r/map count (r/partition-by #(or (zero? (mod % 3)) (zero? (mod % 5))) x))))
Evaluation count : 180
Execution time mean : 307.596806 ms 95.0% CI: (307.271339 ms, 307.961550 ms)
Execution time std-deviation : 34.060809 ms 95.0% CI: (33.613169 ms, 34.416837 ms)
Execution time lower ci : 285.339333 ms 95.0% CI: (285.339333 ms, 285.339333 ms)
Execution time upper ci : 385.087950 ms 95.0% CI: (385.087950 ms, 385.087950 ms)
Found 10 outliers in 60 samples (16.6667 %)
low-severe 4 (6.6667 %)
low-mild 6 (10.0000 %)
Variance from outliers : 73.8053 % Variance is severely inflated by outliers
nil
user=>
same again driven using r/fold (for grins) instead of r/reduce user=> (bench (r/fold + (r/map count (r/partition-by #(or (zero? (mod % 3)) (zero? (mod % 5))) x))))
Evaluation count : 360
Execution time mean : 215.214486 ms 95.0% CI: (214.915417 ms, 215.664236 ms)
Execution time std-deviation : 36.588464 ms 95.0% CI: (36.305548 ms, 36.847846 ms)
Execution time lower ci : 185.575000 ms 95.0% CI: (185.575000 ms, 185.575000 ms)
Execution time upper ci : 287.605175 ms 95.0% CI: (286.547833 ms, 287.605175 ms)
Found 6 outliers in 60 samples (10.0000 %)
low-severe 3 (5.0000 %)
low-mild 3 (5.0000 %)
Variance from outliers : 87.6303 % Variance is severely inflated by outliers
nil
user=>
reducers-partition-by2.diff is faster, but I am not wild about introducing a type and a protocol. also not sure about the CollFold impl. |
| Comment by Rich Hickey [ 15/Aug/12 6:58 AM ] |
|
Let's leave fold out for this first patch, please. |
| Comment by Kevin Downey [ 15/Aug/12 2:34 PM ] |
|
reducer-partition-by3.diff is a cleaned up version of reducer-partition-by2.diff without fold |
| Comment by Devin Walters [ 20/Oct/12 7:07 PM ] |
|
Per Andy Fingerhut's email reducer-partition-by3.diff was failing to apply. This patch should apply cleanly to current master. |
| Comment by Andy Fingerhut [ 01/Nov/12 6:59 PM ] |
|
Presumptuously changing Approval from Incomplete to None, since the reason for its being marked Incomplete seems to have been addressed with the latest patch. |
| Comment by Kevin Downey [ 04/Mar/13 2:49 PM ] |
|
should this be assigned to someone? |
[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-1073] Make print-sequential interruptible Created: 21/Sep/12 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Colin Jones | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | patch | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
This allows print-sequential to be interrupted by Thread.interrupt(), rather than requiring clients to resort to Thread.stop(). This is especially helpful when printing very large sequences. See also clojure-dev discussion at https://groups.google.com/d/topic/clojure-dev/vs0RNUQXiYE/discussion |
| Comments |
| Comment by Andy Fingerhut [ 21/Sep/12 7:04 PM ] |
|
In a quickly hacked up performance test on Mac OS X 10.6.8 + Oracle/Apple JDK 1.6.0_35 which I can attach, I saw about a 9% to 10% slowdown for Colin's patch in printing large vectors. I have a modified patch that only calls Thread/interrupted after every 20 items are printed, and with that version the slowdown versus the original code was about 3% to 4%. Colin, would there be any down side to checking Thread/interrupted less often for your purposes? To run performance test, edit attachment compile.sh to point at your clojure.jar, put file perftest-print.clj in the same directory, and run ./compile.sh It should work on Mac or Linux. |
| Comment by Andy Fingerhut [ 22/Sep/12 10:47 AM ] |
|
clj-1073-allow-thread-interrupt-in-print-sequential-patch.txt dated Sep 22 2012 is similar to Colin's patch 0001-Allow-thread-interruption-in-print-sequential.patch dated Sep 21 2012, except it only checks interrupted status every 20 (or maybe 21?) times through the loop in print-sequential. It is the one that is 3-4% slower than the current latest master Clojure code in my performance test mentioned above, versus Colin's patch which is about 9-10% slower on that test. |
| Comment by Stuart Halloway [ 19/Oct/12 3:31 PM ] |
|
Is this primarily intended for dev-time use? I wouldn't want to lose performance for this if there is any way to implement it as a dev-time feature. |
| Comment by Colin Jones [ 19/Oct/12 4:27 PM ] |
|
Andy: The only caveat I can think of with checking Thread/interrupted less often is in the case of deeply nested collections. Stu: Dev-time use was the original reason for opening this, yes. But I can imagine it being needed for anytime a thread can be interrupted, whether that's by ctrl-c or other means. My original thinking, performance-wise, was that once we're already doing IO, we're probably not too concerned with CPU-bound checks like this, so I didn't bother with it. I guess with an SSD that's not as likely to be true. Locally (w/ my SSD), I'm seeing that Andy's benchmark of printing a million numbers is about a second slower than the baseline with my original patch (12.08s -> 13.10s), and about the same with Andy's patch (12.08s -> 11.75s). Decreasing to a thousand numbers doesn't really show any difference (every version completes in ~1.3s). Bumping to 2 million adds 2 seconds above the baseline with my patch, and Andy's is again just a bit faster than the baseline (somehow). Bumping to 5 million runs me out of heap space |
| Comment by Andy Fingerhut [ 08/Nov/12 4:16 PM ] |
|
clj-1073-add-print-interruptibly-patch-v1.txt dated Nov 8 2012 is the same idea as Colin's patch 0001-Allow-thread-interruption-in-print-sequential.patch dated Sep 21 2012, except it only checks (Thread/interrupted) if a new var print-interruptibly is true. Its default value is false. Performance results of the perftest-print.clj program, as driven by the test.sh script, for Clojure 1.5-beta1 and with two different patches. All run times are elapsed, in seconds, and sorted in increasing order for easier comparison. Executive summary: Performance results when print-interruptibly is left at default false value are pretty much same as today. With print-interruptibly bound to true, performance results are slower, as expected, and about the same as with Colin's patch. Original 1.5-beta1 unchanged: With this new print-interruptibly patch, with print-interruptibly With this new print-interruptibly patch, with print-interruptibly With patch 0001-Allow-thread-interruption-in-print-sequential.patch |
| Comment by Colin Jones [ 12/Nov/12 1:37 PM ] |
|
Andy's latest patch looks good & makes it easy for the REPL and other interruptible scenarios to opt into the "safe" behavior. I would personally have preferred to have the "safe" behavior on by default, but can understand the performance concerns, and this gets me what I really wanted. |
| Comment by Timothy Baldridge [ 30/Nov/12 3:09 PM ] |
|
Vetting as it sounds like the performance issues are taken care of. |
| Comment by Andy Fingerhut [ 13/Feb/13 12:28 AM ] |
|
clj-1073-add-print-interruptibly-patch-v2.txt dated Feb 12 2013 is identical to clj-1073-add-print-interruptibly-patch-v1.txt dated Nov 8 2012 (soon to be removed) except that it applies cleanly to latest master. |
[CLJ-669] clojure.java.io/do-copy: use java.nio for Files Created: 01/Nov/10 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Jürgen Hötzel | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
NIO Channels reduce CPU/Disk load when copying Files (by using CPU-Load goes from 100% to 0% on my system when copying large files, because no userspace-copying is involved: Patch: http://github.com/juergenhoetzel/clojure/commit/2b5ab103cbcfe6c49236ac6966c032d3c922233d |
| Comments |
| Comment by Jürgen Hötzel [ 27/Nov/10 5:05 AM ] |
|
Patch instead of linking to github |
[CLJ-970] extend/implement parameterized types (generics) Created: 10/Apr/12 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Jim Blomo | Assignee: | Jim Blomo |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
When extending parameterized types, class files can track the original signatures of the superclass and super interfaces so that the original types can be obtained at run time. This runtime reflection is used in some Java frameworks, and implementing it in Clojure can enable interop. See http://groups.google.com/group/clojure/browse_thread/thread/5efd692804df3f47/1336e591c2eedfa1 for examples of this request. This proposal checks the :parameters keyword in type meta information. If a parameter is found, it is added to the class signature. |
| Comments |
| Comment by Jim Blomo [ 14/Apr/12 11:30 AM ] |
|
2012-04-14 extend-implement-parameterized-types.diff is the correctly formatted `git format-patch master` for this change. It supersedes clojure-parameterized-generics.diff from 2012-04-10. |
| Comment by Andy Fingerhut [ 19/Aug/12 5:00 AM ] |
|
Patch clj-970-extend-implement-parameterized-types-patch2.txt dated Aug 19 2012 is identical to Jim Blomo's patch extend-implement-parameterized-types.diff dated Apr 14 2012, except it has updated context lines so that it applies cleanly to latest master as of today. |
[CLJ-858] Improve speed of STM by removing System.currentTimeMillis Created: 17/Oct/11 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stefan Kamphausen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
Tested on Ubuntu and OSX |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Original post: https://groups.google.com/d/topic/clojure/kc99LcUK8Tk/discussion This patch removes the milliseconds from inner class TVal in LockingTransaction.java and Ref.java. Using a little test suite[1] a increase of performance by up to 25% could be measured. If necessary I can recreate the patch against current MASTER. References: |
[CLJ-394] Add marker Interfaces for defrecords and deftypes plus boolean test fns Created: 05/Jul/10 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Sometimes one would like to know if an object is an instance of a deftype or a defrecord. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 12:04 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/394 |
| Comment by Steve Miner [ 20/Apr/12 1:55 PM ] |
|
As of Clojure 1.3, there are marker interfaces named clojure.lang.IType and clojure.lang.IRecord. You can use instance? with those interfaces. I'm not sure if they're actually documented for public use, but they seem to work as expected in 1.3 and 1.4. If you want record?, you can try this: (defn record? [rec] (instance? clojure.lang.IRecord rec)) |
| Comment by Devin Walters [ 20/Oct/12 6:38 PM ] |
|
See attached code and test. I'm unsure as to whether or not the location of the tests and predicates make sense. Please let me know if I should move them elsewhere. |
[CLJ-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: | 0 |
| 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-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-706] make use of deprecated namespaces/vars easier to spot Created: 05/Jan/11 Updated: 13/Feb/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stuart Halloway | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
From the mailing list http://groups.google.com/group/clojure/msg/c41d909bd58e4534. It is easy to use deprecated namespaces without knowing you are doing so. The documentation warnings are small, and there is no compiler warning. Some possibilities include:
I don't love the idea of stderr warnings on all the time. Rich: is there an approach to this that you would like to see a patch for? |
| Comments |
| Comment by Rich Hickey [ 07/Jan/11 9:38 AM ] |
|
I don't mind warning to stderr |
| Comment by Luke VanderHart [ 26/Oct/12 1:37 PM ] |
|
706-deprecated-var-warning.diff adds warnings when using deprecated vars. The other three patches clean up deprecation warnings. |
| Comment by Andy Fingerhut [ 26/Oct/12 2:23 PM ] |
|
Great stuff. I looked through the first patch, and didn't see anything in there that lets someone disable deprecation warnings from the command line, the way that warn-on-reflection can today be set to true with a command line option. Is that something important to have for deprecation warnings? |
| Comment by Andy Fingerhut [ 28/Oct/12 4:57 PM ] |
|
I was hoping it would be quick and easy to add source file, line, and column info to the deprecation warning messages. It isn't as easy as adding them to the format() call, because the method analyzeSymbol doesn't receive these values as args. Is this deprecation check being done in a place where it is not easy to relate it to the source file, line, and column? Could it be done in a place where that info is easily available? |
| Comment by Ghadi Shayban [ 29/Oct/12 1:02 AM ] |
|
Another patch - this time to warn on loading deprecated namespaces, instead of vars. This patch requires the first one. Re: line/column, I'll figure out how to thread the compile context through if it's desired. Re: Compile flag. I have a patch for this also, but I'm still verifying how to invoke. How is warn-on-reflection set by command line? |
| Comment by Andy Fingerhut [ 29/Oct/12 1:43 AM ] |
|
Re: Compile flag. Don't hold off on implementing a flag if you want to, but it might be worth hearing from others whether such a command line option is even desired. I was asking in hopes of eliciting such a response. For the way that it is handled in the Clojure compiler, search for REFLECTION_WARNING_PROP and related code in Compile.java. If you invoke the Clojure compiler directly via a Java command line, use -Dclojure.compile.warn-on-reflection=true (default is false). See the recent email thread sent to Clojure Dev Google group if you want to know how to do it via ant or Maven. Link: https://mail.google.com/mail/?shva=1#label/clojure-dev/13aa0e34530196c3 There is also a separate command-line flag called compiler-options (see Compile.java) that is implemented as a map inside the compiler. It was added more recently than warn-on-reflection, and might be the preferred method to add more such options, to avoid having to continue to add more arguments to the pushThreadBindings calls done in several places. |
| Comment by Ghadi Shayban [ 29/Oct/12 10:36 AM ] |
|
Thanks, Andy. Alternately for the last ns patch, it is equivalent to call (print-method msg err), rather than binding out to err, may be more readable. I'll be glad to send that in if it's preferable. |
| Comment by Andy Fingerhut [ 13/Feb/13 12:38 AM ] |
|
706-deprecated-var-warning-patch-v2.txt dated Feb 12 2013 is identical to 706-deprecated-var-warning.diff dated Oct 26 2012, except it applies cleanly to latest master. |
[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-1080] Eliminate many uses of reflection in Clojure code Created: 30/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: | Enhancement | Priority: | Minor |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
There are dozens of uses of reflection in Clojure code that can be eliminated by adding suitable type hints. This patch adds the necessary type hints for most of those. |
| Comments |
| Comment by Andy Fingerhut [ 30/Sep/12 11:39 AM ] |
|
Patch clj-1080-eliminate-many-reflection-warnings-patch-v1.txt dated Sep 30 2012 adds type hints to eliminate many uses of reflection in Clojure core code. |
| Comment by Andy Fingerhut [ 14/Nov/12 1:26 PM ] |
|
clj-1080-eliminate-many-reflection-warnings-patch-v2.txt dated Nov 14 2012 is identical to the previous patch (to be removed soon), except it applies cleanly to latest master. |
| Comment by Andy Fingerhut [ 07/Feb/13 8:54 AM ] |
|
clj-1080-eliminate-many-reflection-warnings-patch-v3.txt dated Feb 7 2013 is identical to the previous patch (to be removed soon), except it applies cleanly to latest master. One type hint in the patch was added due to a different change, and was no longer needed in the patch. |
[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-1082] Subvecs of primitive vectors cannot be reduced Created: 05/Oct/12 Updated: 26/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Ghadi Shayban | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
1.7.0-08, OS X 10.8 |
||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
|
I could reproduce on current 10/05 git. Reduce doesn't work on subvecs of primitive vectors. If reduce on a subvec doesn't work then neither will nice ops like fold. How to cause: (let [prim-vec (into (vector-of :long) (range 10000))] ->> ClassCastException clojure.core.Vec cannot be cast to clojure.lang.PersistentVector clojure.lang.APersistentVector$SubVector.iterator (APersistentVector.java:523) |
| Comments |
| Comment by Timothy Baldridge [ 27/Nov/12 11:52 AM ] |
|
Confirmed to be broken on master. Vetting. Not sure what it's going to take to fix this, however. If this is of intrest for you, you might want to help push it along by providing a patch. |
| Comment by Andy Fingerhut [ 27/Nov/12 12:09 PM ] |
|
There is no code or ticket for this yet, but I wanted to mention that I've begun working on an implementation of RRB-Tree (Relaxed Radix Balanced Tree) vectors for Clojure (see discussion at https://groups.google.com/forum/?fromgroups=#!topic/clojure-dev/xnbtzTVEK9A). Assuming it is no big deal to get reducers to work on such vectors, subvec could be implemented in O(log n) time in such a way that the result was the same concrete type of vector as you started with, and thus reducers would work on them, too. It would mean O(log n) time for subvec instead of today's O(1), but this would likely fix other limitations that exist today with subvec's, e.g. CLJ-761. |
| Comment by Mike Anderson [ 20/Jan/13 5:14 AM ] |
|
I have a fix for this and a regression test in the tree below: https://github.com/mikera/clojure/tree/winfix Not sure how best to make this into a patch though - I also have the pprint fix in here (CLJ-1076) |
| Comment by Mike Anderson [ 20/Jan/13 6:41 PM ] |
|
Attached a patch that I created with: git format-patch winfix --stdout HEAD~3..HEAD > clj-1082.patch Does this do the trick? I had to use the HEAD~3..HEAD to just get the most recent 3 commits and exclude the pprint changes that I needed in order to build on Windows. |
| Comment by Mike Anderson [ 20/Jan/13 6:42 PM ] |
|
Patch for CLJ-1082, containing 3 commits |
| Comment by Andy Fingerhut [ 21/Jan/13 1:11 AM ] |
|
Mike, your patch clj-1082.patch applies cleanly to latest master for me, so looks like you found one way to do it. Another would be as follows, and closer to the directions on the JIRA workflow page: http://dev.clojure.org/display/design/JIRA+workflow (but not identical). Note that these commands would work on Mac OS X or Linux. I'm not sure what the correct corresponding command would be on Windows for the "git am" step below, unless that just happens to work because Windows and/or git implement the input redirection with "<" somehow.
From there on down it is the same as the instructions on the JIRA workflow page. The "git format-patch master --stdout > file.patch" will create a patch for the changes you have made in the current branch fix-clj-1082 starting from the master branch, which has the CLJ-1076 fix because of the 'git am' command above. |
[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-1151] Minor Code Cleanup in core.reducers: use required walk, drop this for coll Created: 21/Jan/13 Updated: 21/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Stefan Kamphausen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
First, core.reducers requires clojure.walk :as walk, but does not use the alias. The two things seem small enough to be put into one cleanup case. |
[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-1060] 'list*' returns not a list Created: 03/Sep/12 Updated: 18/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Andrei Zhlobich | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Function 'list?' returns sequence, but not a list. user=> (list? (list* 1 '(2 3)))
false
|
| Comments |
| Comment by Stuart Halloway [ 17/Sep/12 6:52 AM ] |
|
should the docstring for list* change to say it returns a seq? |
| Comment by Timothy Baldridge [ 27/Nov/12 11:58 AM ] |
|
Is there a reason why we can't have list* actually return a list? The cost of creating a list vs a cons is negligible. |
| Comment by Marek Srank [ 04/Jan/13 2:02 PM ] |
|
The question is what to do with the one-argument case of list*, because in cases like: (list* {:a 1 :b 2}) it doesn't return IPersistentList as well. I propose just applying 'list'. I added patch 'list-star-fix.diff' (dated 04/Jan/2013) with Cons implementing IPersistentList and doing (apply list args) in one-argument case of list*. To be able to use 'apply' in list* I had to declare it before the definition of list* in the source code. The apply itself also uses list*, but luckily not the one-argument version of list*, so it should be safe... The patch also contains simple unit tests. Discussion is also here: https://groups.google.com/forum/#!topic/clojure/co8lcKymfi8 |
| Comment by Michał Marczyk [ 04/Jan/13 4:11 PM ] |
|
(apply list args) would make (list* (range)) hang, where currently it returns a partially-realized lazy seq. Also, even for non-lazy seqs – possibly lists themselves – it would always build a new list from scratch, right? Also, if I'm reading the patch correctly, it would make 2+-ary list* overloads and cons return lists – that is, IPersistentList instances – always (Conses would now be lists), but repeatedly calling next on such a list might eventually produce a non-list. The only way around that would be to make all seqs into IPersistentLists – that doesn't seem desirable at first glance...? On a side note, for the case where the final "args" argument is in fact a list, we already have a "prepend many items" function, namely conj. list* currently acts as the vararg variant of cons (in line with Lisp tradition); I'm actually quite happy with that. |
| Comment by Michał Marczyk [ 04/Jan/13 4:19 PM ] |
|
I'm in favour of the "list" -> "seq" tweak to the docstring though, assuming impl remains unchanged. |
| Comment by Marek Srank [ 04/Jan/13 6:13 PM ] |
|
Yep, these are all valid points, thanks! I see this as a question whether the list* function is a list constructor or not. If yes (and it would be possible to implement it in a satisfactory way), it should probably return a list. We could avoid building a new list by sth like: (if (list? args)
args
(apply list args))
(btw, 'vec' also creates a new vector even when the argument itself is a vector) The contract of next seems to be to return a seq, not a list - its docstring reads: "Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil." Btw, in some Lisp/Scheme impls I checked, cons seems to be a list as well. E.g. in CLisp (and similar in Guile and Racket): > (listp (cons 2 '())) T > (listp (list* 1 2 '())) T |
[CLJ-1148] adds docstring support to defonce, and stops it from stomping existing metadata Created: 17/Jan/13 Updated: 17/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Joe Gallo | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Two issues here: 1) defonce doesn't support docstrings, although def does, so it would be nice to bring the two in line with each other 2) defonce can stomp metadata, like this: (defonce ^:private foo 5) |
[CLJ-1086] Support arity-1 for ->> Created: 12/Oct/12 Updated: 12/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.1, Release 1.2, Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Shantanu Kumar | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
Clojure and ClojureScript |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Currently (as of Clojure 1.4) ->> doesn't support arity-1, though -> does. Arity-1 for ->> would be useful to let somebody comment out forms as follows: (->> foo #_(bar baz) #_quux) Discussion: https://groups.google.com/forum/?fromgroups=#!topic/clojure/_IVl0Tb7Au4 My name on contributor list page http://clojure.org/contributing is: Shantanu Kumar |
| Comments |
| Comment by Andy Fingerhut [ 08/Nov/12 1:37 PM ] |
|
Shantanu, you give your name on the contributing page, but I don't see it there. Is your CA in transit, perhaps? |
| Comment by Shantanu Kumar [ 08/Nov/12 1:43 PM ] |
|
@Andy I can see my name on the contributors page when I search for the text "Shantanu". My CA was submitted more than a year ago. |
| Comment by Andy Fingerhut [ 08/Nov/12 1:53 PM ] |
|
Right you are. I somehow accidentally got my browser to enable case matching, and was expecting it to search case insensitively. Sorry for the noise. |
| Comment by Víctor M. Valenzuela [ 12/Jan/13 6:48 PM ] |
|
Just for the record, the patch provided at http://dev.clojure.org/jira/browse/CLJ-1121 addresses this issue. |
[CLJ-1030] Misleading ClassCastException when coercing a String to int Created: 25/Jul/12 Updated: 06/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Philipp Meier | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Observed behaviour (int "0") => Expected behaviour |
| Comments |
| Comment by Andy Fingerhut [ 24/Sep/12 11:20 AM ] |
|
If someone wants to improve the behavior of int in this case, they should also consider similar improvements to the error messages for unchecked-int, char, and unchecked-char. |
| Comment by Michael Drogalis [ 06/Jan/13 8:45 PM ] |
|
Patch improved-int-char-casting-error-messages.diff on January 6, 2013. |
[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-1134] star-directive in clojure.pprint/cl-format with an at-prefix ("~n@*") do not obey its specifications Created: 18/Dec/12 Updated: 26/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: | Minor |
| Reporter: | Jean Niklas L'orange | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug, pprint | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
The star-directive in clojure.pprint/cl-format with an at-prefix (~n@*) does not obey its specifications according to Common Lisp the Language, 2nd Edition. There are two bugs within ~n@* as of right now:
What (small set of) steps will reproduce the problem?Inside a clean Clojure repl, perform these steps: user=> (require '[clojure.pprint :refer [cl-format]]) nil user=> (cl-format nil "~D ~3@*~D" 0 1 2 3) "0 0" ;; Expected: "0 3" user=> (cl-format nil "~D~D~D~D ~@*~D" 0 1 2 3) "0123 1" ;; Expected: "0123 0" What is the expected output? What do you see instead?The expected output is "0 3" and "0123 0", but is "0 0" and "0123 1" as shown above. What version are you using?Tested on both 1.4.0 and 1.5.0-beta2, both have the defect described. Please provide any additional information below.The format strings which reproduces the problem has been compared with the format function from the Common Lisp implementations SBCL, CLisp and Clozure. All of them print the expected output. |
| Comments |
| Comment by Jean Niklas L'orange [ 18/Dec/12 9:28 PM ] |
|
Patch attached. It may be easier to read the changes the patch does from within JIRA instead from the commit message, so I've added it here: This solves two issues as specified by #CLJ-1134. Issue #1 is solved by doing a Issue #2 is handled by changing the default n-parameter to * depending on In addition, new tests have been appended to test_cl_format.clj to ensure the |
[CLJ-1104] Concurrent with-redefs do not unwind properly, leaving a var permanently changed Created: 07/Nov/12 Updated: 21/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Jason Wolfe | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Mac OS, Java 6 |
||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
On 1.4 and latest master: user> (defn ten [] 10) Not sure if this is a bug per se, but the doc doesn't mention lack of concurrency safety and my expectation was that the original value would always be restored after any (arbitrarily interleaved) sequence of with-redefs calls. |
| Comments |
| Comment by Tim McCormack [ 07/Nov/12 8:50 PM ] |
|
The with-redefs doc (v1.4.0) says "These temporary changes will be visible in all threads." That sounds non-thread-safe to me. In general, changes to var root bindings are not thread safe. |
| Comment by Herwig Hochleitner [ 08/Nov/12 9:17 AM ] |
|
As I understand it, with-redefs is mainly used in test suites to mock out vars. It was introduced when vars became static by default and a lot of testsuites had been using binding for mocking. Maybe the docstring should be amended with something along the lines of: When using this you have to ensure that only a single thread is interacting with redef'd vars. |
| Comment by Stuart Halloway [ 25/Nov/12 6:41 PM ] |
|
Behavior find as is, doc string change would be fine. |
| Comment by Andy Fingerhut [ 25/Nov/12 6:57 PM ] |
|
Patch clj-1104-doc-unsafety-of-concurrent-with-redefs-v1.txt dated Nov 25 2012 updates doc string of with-redefs to make it clear that concurrent use is unsafe. |
[CLJ-1120] Introduce ex-message and ex-cause to abstract away the platform in dealing with ExceptionInfo Created: 06/Dec/12 Updated: 21/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Michał Marczyk | Assignee: | Michał Marczyk |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
As described in the title. See |
| Comments |
| Comment by Michał Marczyk [ 06/Dec/12 6:23 AM ] |
|
The attached patch implements ex-message and ex-cause to work on arbitrary Throwables. |
[CLJ-1137] Metadata on a def gets evaluated twice Created: 21/Dec/12 Updated: 21/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Ghadi Shayban | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Metadata on the symbol of a def special form is evaluated twice. (def ^{:foo (println "HA")} a []) prints out HA HA. Offending line is in Compiler$DefExpr, fixed. |
[CLJ-1044] Enable refering to ->type inside deftype Created: 18/Aug/12 Updated: 15/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Nicola Mometto | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Inside defrecord is possible to refer to ->type-ctor, that is not possible inside deftype. |
| Comments |
| Comment by Timothy Baldridge [ 03/Dec/12 11:29 AM ] |
|
Seems valid. Vetting. |
[CLJ-1128] Improve merge-with Created: 13/Dec/12 Updated: 13/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Edward Tsech | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Set a first map as an initial value for reduce to |
| Comments |
| Comment by Edward Tsech [ 13/Dec/12 1:36 PM ] |
|
Tests pass. |
| Comment by Andy Fingerhut [ 13/Dec/12 2:32 PM ] |
|
Edward, your patch replaces the expression (or m1 {}) with m1. It was changed from m1 to (or m1 {}) in a commit on Oct 16, 2008 with descriptive text "improved nil handling in merge, merge-with", so I am pretty sure it would be best to leave it as (or m1 {}). I believe the intent is to allow all but one of the map arguments to merge-with be nil, and everything will still work. The rest of the patch for avoiding one merge call seems sound to me. Your change would be even better at preserving any metadata on the first non-nil map in the list, if instead of calling with the first map, it called it with the first non-nil item of the list, and then the rest of the list after that. |
| Comment by Edward Tsech [ 13/Dec/12 5:41 PM ] |
|
I figured out that `reduce1` did pass a head of the list for me. I'm not sure about `(or m1 {})`. I don't see any problems which can happen. Probably behaviour of functions which are used internally was changed since 2008. (contains? nil :a) ;=> false I could write some tests for that. |
[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-1103] Make conj assoc dissoc and transient versions handle args similarly Created: 04/Nov/12 Updated: 09/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
A discussion came up in the Clojure Google group about conj giving an error when taking only a coll as an argument, as opposed to disj which works for this case: https://groups.google.com/forum/?fromgroups=#!topic/clojure/Z9mFxsTYTqQ I looked through the rest of the code for similar cases, and found that conj! assoc assoc! and disj! also had the same property, and there were some other differences between them in how different numbers of arguments were handled, such as: conj handles an arbitrary number of arguments, but conj! does not. |
| Comments |
| Comment by Andy Fingerhut [ 04/Nov/12 6:04 PM ] |
|
clj-1103-make-conj-assoc-dissoc-handle-args-similarly-v1.txt dated Nov 4 2012 makes conj conj! assoc assoc! dissoc dissoc! handle args similarly to each other. |
| Comment by Brandon Bloom [ 09/Dec/12 5:30 PM ] |
|
I too ran into this and started an additional discussion here: https://groups.google.com/d/topic/clojure-dev/wL5hllfhw4M/discussion In particular, I don't buy the argument that (into coll xs) is sufficient, since into implies conj and there isn't an terse and idiomatic way to write (into map (parition 2 keyvals)) So +1 from me |
[CLJ-1115] multi arity into Created: 25/Nov/12 Updated: 09/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Yongqian Li | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Any reason why into isn't multi arity? (into to & froms) => (reduce into to froms) (into #{} [3 3 4] [2 1] ["a"]) looks better than (reduce into #{} [[3 3 4] [2 1] ["a"]]) |
| Comments |
| Comment by Timothy Baldridge [ 27/Nov/12 11:25 AM ] |
|
Seems to be a valid enhancement. I can't see any issues we'd have with it. Vetted. |
| Comment by Timothy Baldridge [ 29/Nov/12 2:06 PM ] |
|
Added patch & test. This patch retains the old performance characteristics of into in the case that there is only one collection argument. For example: (into [] [1 2 3]) . Since the multi-arity version will be slightly slower, I opted to provide it as a second body instead of unifying both into a single body. If someone has a problem with this, I can rewrite the patch. At least this way, into won't get slower. |
| Comment by Rich Hickey [ 09/Dec/12 7:39 AM ] |
|
This is a good example of an idea for an enhancement I haven't approved, and thus is not yet vetted. |
[CLJ-1074] Read/print round-trip for +/-Infinity and NaN Created: 21/Sep/12 Updated: 03/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Colin Jones | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | patch | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
A few float-related forms (namely, Double/POSITIVE_INFINITY, Double/NEGATIVE_INFINITY, Double/NaN) are not eval-able after a round-trip via (read-string (binding [*print-dup* true] (pr-str f))
The two options I see are to provide print-method implementations for these and their Float cousins, or to make Infinity, -Infinity, +Infinity, and NaN readable values. Since it sounds like edn may want to provide a spec for these values (see https://groups.google.com/d/topic/clojure-dev/LeJpOhHxESs/discussion and https://github.com/edn-format/edn/issues/2), I think making these values directly readable as already printed is preferable. Something like Double/POSITIVE_INFINITY seems too low-level from edn's perspective, as it would refer to a Java class and constant. I'm attaching a patch implementing reader support for Infinity, -Infinity, +Infinity, and NaN. |
| Comments |
| Comment by Timothy Baldridge [ 03/Dec/12 11:34 AM ] |
|
Please bring this up on clojure-dev. We'll be able to vet this ticket after that. |
| Comment by Colin Jones [ 03/Dec/12 1:18 PM ] |
|
Should I respond to my original clojure-dev post about this (linked in the issue description above), or start a new one? |
[CLJ-457] lazy recursive definition giving incorrect results Created: 13/Oct/10 Updated: 03/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | Priority: | Major |
| Reporter: | Assembla Importer | Assignee: | Christophe Grand |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
If you define a global data var in terms of a lazy sequence referring to that same var, you can get different results depending on the chunkiness of laziness of the functions being used to build the collection. Clojure's lazy sequences don't promise to support this, but they shouldn't return wrong answers. In the example given in http://groups.google.com/group/clojure/browse_thread/thread/1c342fad8461602d (and repeated below), Clojure should not return bad data. An error message would be good, and even an infinite loop would be more reasonable than the current behavior. (Similar issue reported here: https://groups.google.com/d/topic/clojure/yD941fIxhyE/discussion) (def nums (drop 2 (range)))
(def primes (cons (first nums)
(lazy-seq (->>
(rest nums)
(remove
(fn [x]
(let [dividors (take-while #(<= (* % %) x)
primes)]
(println (str "primes = " primes))
(some #(= 0 (rem x %)) dividors))))))))
(take 5 primes)
It prints out:
(primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
2 3 5 7 9)
|
| Comments |
| Comment by Assembla Importer [ 13/Oct/10 3:00 PM ] | ||||||||||||||||||||||||||||||||||||
|
Converted from http://www.assembla.com/spaces/clojure/tickets/457 | ||||||||||||||||||||||||||||||||||||
| Comment by Aaron Bedra [ 10/Dec/10 9:08 AM ] | ||||||||||||||||||||||||||||||||||||
|
Stu and Rich talked about making this an error, but it would break some existing code to do so. | ||||||||||||||||||||||||||||||||||||
| Comment by Rich Hickey [ 17/Dec/10 8:03 AM ] | ||||||||||||||||||||||||||||||||||||
|
Is there a specific question on this? | ||||||||||||||||||||||||||||||||||||
| Comment by Aaron Bedra [ 05/Jan/11 9:05 PM ] | ||||||||||||||||||||||||||||||||||||
|
Stu, you and I went over this but I can't remember exactly what the question was here. | ||||||||||||||||||||||||||||||||||||
| Comment by Christophe Grand [ 28/Nov/12 12:24 PM ] | ||||||||||||||||||||||||||||||||||||
|
Tentative patch attached. | ||||||||||||||||||||||||||||||||||||
| Comment by Rich Hickey [ 30/Nov/12 9:43 AM ] | ||||||||||||||||||||||||||||||||||||
|
The patch intends to do what? We have only a problem description and code. Please enumerate the plan rather than make us decipher the patch. As a first principle, I don't want Clojure to promise that such recursively defined values are possible. | ||||||||||||||||||||||||||||||||||||
| Comment by Christophe Grand [ 30/Nov/12 10:23 AM ] | ||||||||||||||||||||||||||||||||||||
|
The proposal here is to catch recursive seq realization (ie when computing the body of a lazy-seq attempts to access the same seq) and throw an exception. Currently when such a case happens, the recursive access to the seq returns nil. This results in incorrect code seemingly working but producing incorrect results or even incorrect code producing correct results out of luck (see https://groups.google.com/d/topic/clojure/yD941fIxhyE/discussion for such an example). So this patch moves around the modification to the LazySeq state (f, sv and s fields) before all potentially recursive method call (.sval in the while of .seq and .invoke in .sval) so that, upon reentrance, the state of the LazySeq is coherent and able to convey the fact the seq is already being computed. Currently a recursive call may find f and sv cleared and concludes the computation is done and the result is in s despite s being unaffected yet. Currently:
Note that "Being realized" states overlap with Unrealized or Realized. With the patch:
| ||||||||||||||||||||||||||||||||||||
| Comment by Andy Fingerhut [ 30/Nov/12 2:06 PM ] | ||||||||||||||||||||||||||||||||||||
|
That last comment, Christophe, goes a long way to explaining the idea to me, at least. Any chance comments with similar content could be added as part of the patch? | ||||||||||||||||||||||||||||||||||||
| Comment by Christophe Grand [ 03/Dec/12 11:18 AM ] | ||||||||||||||||||||||||||||||||||||
|
New patch with a comment explaining the expected states. // Before calling user code (f.invoke() in sval and, indirectly, // ((LazySeq)ls).sval() in seq -- and even RT.seq() in seq), ensure that // the LazySeq state is in one of these states: // // State f sv // ================================ // Unrealized not null null // Realized null null // Being realized null this CLJ-1119 is also fixed by this patch. |
[CLJ-200] Extend cond to support inline let, much like for Created: 18/Oct/09 Updated: 02/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Anonymous | Assignee: | Mark Engelberg |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
I find it occasionally very useful to do a few tests in a cond, then introduce some new symbols (for both clarity and efficiency) that can be referenced in later tests (or matching expressions). This parallels similar functionality inside the for macro, where the :let keyword is matched against a vector of symbol bindings and forms an implicit let around the remainder of the comprehension. I'll be adding a patch for this shortly. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 1:51 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/200 |
| Comment by Assembla Importer [ 24/Aug/10 1:51 PM ] |
|
hlship said: Trickier than I thought because cond is really wired into other fundamentals, like let. |
| Comment by Assembla Importer [ 24/Aug/10 1:51 PM ] |
|
cgrand said: Howard, what do you think of http://gist.github.com/432712 ? |
| Comment by Mark Engelberg [ 23/Nov/12 2:33 AM ] |
|
Patch cond-let-clauses.diff on 23/Nov/12 adds inline :let clauses to cond, implementing CLJ-200. The code is based off of code by cgrand, with some tweaks so the implementation only relies on constructs defined earlier in core.clj, since when cond is defined, things aren't yet fully bootstrapped. Also added a test to control.clj. |
| Comment by Christophe Grand [ 23/Nov/12 3:06 AM ] |
|
Some comments: the docstring is missing, I believe you don't have to modify the original cond (except the docstring maybe), just redefine it later on once most of the language is defined – a bit like what is done for let for example. There is still the unlikely eventuality that some code uses :let as :else. What about shipping a cond which complains on keywords (in test position) other than :else? |
| Comment by Mark Engelberg [ 23/Nov/12 3:47 AM ] |
|
cond-let-clauses-with-docstring.diff contains the same patches as cond-let-clauses, but includes the original docstring for cond along with an additional sentence about the :let bindings. |
| Comment by Mark Engelberg [ 23/Nov/12 3:54 AM ] |
|
Cgrand, I did see your example of redefining cond after most of the language is defined, but since I was able to figure out how to do it in the proper place, that makes the :let bindings available for users of cond downstream and avoids any unforeseen complications that might come from rebinding. As for your other point, I think it is highly improbable that someone would have used :let in the :else position. However I can imagine someone intentionally using something like :true or :default. I think the idea of warning for other keywords is actually more likely to cause complications than the unlikely problem it is meant to solve. I did resubmit the patch with the docstring restored. Thanks for pointing out that problem. I'm excited about this patch – I use :let bindings within the cond in my own code all the time. Thanks again for the blog post that started me on that path. |
| Comment by Christophe Grand [ 23/Nov/12 4:13 AM ] |
|
True, it's :unlikely for :let to happen. |
| Comment by Andy Fingerhut [ 29/Nov/12 8:46 PM ] |
|
Mark, could you remove the obsolete earlier patch now that you have added the one with the doc string? Instructions for removing patches are under the heading "Removing Patches" on this page: http://dev.clojure.org/display/design/JIRA+workflow |
| Comment by Mark Engelberg [ 29/Nov/12 10:50 PM ] |
|
Done. |
| Comment by Andy Fingerhut [ 30/Nov/12 1:24 AM ] |
|
I haven't figured out what is going wrong yet. I can apply the patch cond-let-clauses-with-docstring.diff to the latest Clojure master just fine. I can do "ant jar" and it will build a jar. When I do "ant", it fails with the new test for cond with :let, throwing a StackOverflowException. I can enter that same form into the REPL and it evaluates just as the test says it should. I can comment out that new test and all of the rest pass. But the new test doesn't pass when inside of the control.clj file. Anyone know why? |
| Comment by Christophe Grand [ 30/Nov/12 4:54 AM ] |
|
It's because of the brutal replacement performed by test/are: the placeholders for this are form are x and y but in Mark's test there are used as local names and are tries to substitute them recursively... |
| Comment by Mark Engelberg [ 02/Dec/12 8:20 AM ] |
|
cond-let-clauses-fixed-test.diff on 02/Dec/12 contains the same patch, but with the x,y locals in the test case changed to a,b so that it works properly in the are clause which uses x and y. |
| Comment by Mark Engelberg [ 02/Dec/12 8:27 AM ] |
|
On Windows, I can't get Clojure's test suite task to work, either via ant or maven, which has made it difficult for me to verify the part of the patch that applies to the test suite works as expected; I had tested it as best I could in the REPL, using a version of Clojure built with the patch applied, but using this process, I missed the subtle interaction between are and the locals in the test case. Sorry about that. If someone can double-check that the test suite task now works with the newest patch, that would be great, and then I'll go ahead and remove the obsoleted patch. Thanks. |
| Comment by Andy Fingerhut [ 02/Dec/12 6:29 PM ] |
|
clj-200-cond-let-clauses-fixed-test-v2-patch.txt dated Dec 2 2012 is identical to Mark Engelberg's cond-let-clauses-fixed-test.diff of the same date, except it applies cleanly to the latest Clojure master. I've verified that it compiles and passes all tests with latest Clojure master as of this date. Mark, I've made sure to keep your name in the patch, since you wrote it. You should be able to remove your two attachments now, so the screener won't be confused which patch should be examined. |
| Comment by Andy Fingerhut [ 02/Dec/12 6:31 PM ] |
|
Mark, besides general issues with Windows not being used much (or maybe not at all?) by Clojure developers, there is the issue right now filed as CLJ-1076 that not all tests pass when run on Windows due to CR-LF line ending differences that cause several Clojure tests to fail, regardless of whether you use ant or maven to run them. |
[CLJ-1102] Better handling of exceptions with empty stack traces Created: 04/Nov/12 Updated: 30/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
I don't know what I did to cause some exceptions to be thrown while running Clojure tests that return a length 0 array from (.getStackTrace throwable), but according to the Java docs this is legal. I searched all places in the Clojure code that call .getStackTrace and found two that don't handle this correctly, one of which causes an ArrayOutOfBoundsException (that is the one I found during my testing). |
| Comments |
| Comment by Andy Fingerhut [ 04/Nov/12 5:07 PM ] |
|
clj-1102-improve-empty-stack-trace-handling-v1.txt dated Nov 4 2012 improves the handling of .getStackTrace returning a length 0 array in two places. I checked all other places .getStackTrace was called and they seem to already handle this case gracefully. |
| Comment by Timothy Baldridge [ 30/Nov/12 2:57 PM ] |
|
Vetting. |
[CLJ-1090] Indirect function calls through Var instances fail to clear locals Created: 22/Oct/12 Updated: 30/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Spencer Tipping | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | performance | ||
| Environment: |
Probably all, but observed on Ubuntu 12.04, OpenJDK 6 |
||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
If you make a function call indirectly by invoking a Var object (which derefs itself and invokes the result), the invocation parameters remain in the thread's local stack for the duration of the function call, even though they are needed only long enough to be passed into the deref'd function. As a result, passing a lazy seq into a function invoked in its Var form may run out of memory if the seq is forced inside that function. For example: (defn total [xs] (reduce + 0 xs)) I can provide a patch if it would be useful. The fix should be trivial, something along the lines of wrapping each argN in clojure/lang/Var.java inside a Util.ret1(argN, argN = null) as is done in RestFn.java. |
| Comments |
| Comment by Spencer Tipping [ 23/Oct/12 1:37 PM ] |
|
Sorry, I typo'd the example. (defn total ...) should be (defn sum ...). |
| Comment by Timothy Baldridge [ 27/Nov/12 11:45 AM ] |
|
fixed typeo in example |
| Comment by Timothy Baldridge [ 27/Nov/12 11:47 AM ] |
|
Couldn't reproduce the exception, but the 2nd example did chew through about 4x the amount of memory. Vetting. |
| Comment by Timothy Baldridge [ 29/Nov/12 2:57 PM ] |
|
adding a patch. Since most of Clojure ends up running this code in one way or another, I'd assert that tests are included as part of the normal Clojure test process. Patch simply calls Util.ret1(argx, argx=null) on all invoke calls. |
| Comment by Timothy Baldridge [ 29/Nov/12 3:17 PM ] |
|
And as a note, both examples in the original report now have extremely similar memory usages. |
| Comment by Spencer Tipping [ 30/Nov/12 2:22 PM ] |
|
Sounds great, and the patch looks good too. Let me know if I need to do anything else. |
[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-1113] `reductions` reducer Created: 23/Nov/12 Updated: 23/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Marshall T. Vandegrift | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
It would be nice to have a reducers implementation of the core `reductions` function. Initial implementation attempt included. This version requires an initial reduction value parameter (vs using (f)) and includes that initial value in the final reduction. I'm not certain either of these decisions is optimal, but results in a function which most closely mimics `clojure.core/reductions`. |
[CLJ-1112] Var *loading-verbosely* should initialize from a JVM system property Created: 21/Nov/12 Updated: 22/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Howard Lewis Ship | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | patch | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
I often find myself adding :verbose to a (require) or (use) clause of my (ns) in order to debug problems (especially macros, or bad namespace declarations). It would be very nice if I could define a JVM system property (say -Dclojure.load-verbosely=true) to default loading-verbosely to true for a REPL session, or as part of a build. Sometimes I just like to see that namespaces load as a measure of progress, when starting an application, or when running a set of tests. |
| Comments |
| Comment by Tassilo Horn [ 22/Nov/12 2:12 AM ] |
|
This patch implements the suggested feature. The new system property is called clojure.core.loading-verbosely in analogy to the existing clojure.compile.warn-on-reflection. |
[CLJ-99] GC Issue 95: max-key and min-key evaluate k multiple times for arguments Created: 17/Jun/09 Updated: 15/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
Reported by H.Duerer, Mar 13, 2009 max-key or min-key will evaluate (k value) multiple times for arguments if more than 2 arguments are passed. This is undesirable if k is expensive to calculate. Something like the code below would avoid these double calculations (at the price of generating more ephemeral garbage) (defn max-key "Returns the x for which (k x), a number, is greatest." ([k x] x) ([k x y] (if (> (k x) (k y)) x y)) ([k x y & more] (second (reduce (fn [x y] (if (> (first x) (first y)) x y)) (map #(vector (k %) %) (cons x (cons y more))))))) |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 5:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/99 |
| Comment by Assembla Importer [ 24/Aug/10 5:45 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Andy Fingerhut [ 15/Nov/12 9:36 PM ] |
|
clj-99-min-key-max-key-performance-v1.txt dated Nov 15 2012 changes min-key and max-key to evaluate the function k on each of its other arguments at most once. |
[CLJ-107] GC Issue 103: bit-count function Created: 17/Jun/09 Updated: 15/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
Reported by a...@thened.net, Apr 08, 2009 I posted this small patch to the mailing list last week but received no feedback, so I'm attaching it here to make sure it doesn't get lost. I have submitted a CA. http://groups.google.com/group/clojure/browse_thread/thread/4345f76a12bac6fe/ The new function bit-count returns the count of 1-bits in a number, like C's popcount or Common Lisp's logcount. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/107 |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
oranenj said: [file:dqone2w4er3RbzeJe5afGb] |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Andy Fingerhut [ 15/Nov/12 8:40 PM ] |
|
clj-107-add-bit-count-v1.txt is probably a correct updated version of the old patch linked above. Added a couple of unit tests. |
[CLJ-666] Add support for Big* numeric types to Reflector Created: 29/Oct/10 Updated: 15/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
This should work as expected, for example: (Integer. 1N) Probably for BigInt, BigInteger, and BigDecimal. Method to look at is c.l.Reflector.paramArgTypeMatch, per Rich in irc. |
| Comments |
| Comment by Colin Jones [ 30/Mar/11 11:52 PM ] |
|
Questions posed on the clojure-dev list around how this impacts bit-shift-left: http://groups.google.com/group/clojure-dev/browse_thread/thread/2191cbf0048d8ca6 |
| Comment by Alexander Taggart [ 31/Mar/11 12:42 AM ] |
|
Patch on CLJ-445 fixes this as well. |
| Comment by Colin Jones [ 27/Apr/11 4:41 PM ] |
|
This patch fails a test around bit-shifting a BigInt: `(bit-shift-left 1N 10000)`. The reason is that the patch changes the dispatch of (BigInt, Long) from (Object, Object) to (long, int). Clearly this can't be applied (unless another change makes it possible), but I'm putting it up as a start of the conversation. |
| Comment by Alexander Taggart [ 27/Apr/11 5:26 PM ] |
|
My comment from the mailing list: If the test breaks it likely means Numbers.shiftLeft(long,int) was The suggestion of "simply" modifying paramArgTypeMatch is not sufficient since the mechanism for preferring one method over another lives in Compiler, and isn't smart enough to make these sorts of decisions. |
| Comment by Christopher Redinger [ 28/Apr/11 9:21 AM ] |
|
Considering moving this out of Release.next - soliciting comments from Chas. |
| Comment by Chas Emerick [ 28/Apr/11 9:41 AM ] |
|
I'm afraid I don't have any particular insight into the issues involved at this point. I ran into the problem originally noted a while back, and opened the ticket at Rich's suggestion. I'm sorry if the text of the ticket led anyone down unfruitful paths… |
| Comment by Luke VanderHart [ 29/Apr/11 10:01 AM ] |
|
The issues relating to bitshift are moot since the decision was made that bit-shifts are only for 32/64 bit values. Still a valid issue, but de-prioritized as per Rich. |
| Comment by Alex Ott [ 25/Jun/12 7:19 AM ] |
|
Modified version of original patch |
| Comment by Andy Fingerhut [ 26/Jun/12 1:38 PM ] |
|
Alex, would you mind attaching it with a unique file name? I know that JIRA lets us create multiple attachments with the same file name, and I know we can tell them apart by date and the account of the person who uploaded the attachment, but giving them the same name only seems to invite confusion. |
| Comment by Alex Ott [ 28/Jun/12 1:00 PM ] |
|
Renamed updated patch to unique name |
[CLJ-849] Add a pseudo-variable containing the current line number Created: 07/Oct/11 Updated: 14/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | G. Ralph Kuntz, MD | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Any |
||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Add a pseudo-variable (similar to *file*), containing the current line number. This should be available during AOT compilation. The name "*line-number*" might be good. It will be useful for diagnostic log messages. Using exception stack traces has poor runtime performance and the line number should be available to the compiler at minimal cost. |
| Comments |
| Comment by Peter Siewert [ 14/Nov/12 3:41 PM ] |
|
Adding initial patch. A symbol's position is now stored in its metadata, just like a seq when it is read with the LispReader. The Compiler.LINE and Compiler.COLUMN values are now updated as each symbol is analyzed. This provides more exact line and column numbers for Compiler errors which will resolve ticket CLJ-420. The Compiler.LINE variable has been interned as clojure.core/line-number Adding extra metadata to symbols resulted in some tests failing due to the extra values. The failing tests have been updated to ignore the new metadata keys. |
[CLJ-842] clojure.pprint uses the old-style metadata. Created: 26/Sep/11 Updated: 14/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Baishampayan Ghose | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
I was looking through the implementation of clojure.pprint.* and found that it still uses the old-style metadata to mark vars as private - ^{:private true} instead of ^:private. I have migrated the metadata to the new style in the attached trivial patch, which can be used in case this is deemed to be an issue. FWIW, there are some other namespaces which use the old-style metadata as well; I am willing to fix those as well. |
| Comments |
| Comment by Andy Fingerhut [ 14/Nov/12 1:19 PM ] |
|
clj-842-update-clojure.pprint-metadata-v2.txt dated Nov 14 2012 is identical to Baishampayan Ghose's 0001-Migrate-the-metadata-in-clojure.pprint.-to-the-new-s.patch dated Sep 26, 2011, except it applies cleanly to latest master. |
[CLJ-1107] 'get' should throw exception on non-Associative argument Created: 13/Nov/12 Updated: 13/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stuart Sierra | Assignee: | Stuart Sierra |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
The implementation of clojure.core/get returns null if its argument is not a valid associative collection. However, calling 'get' on something which is neither nil nor an Associative collection is almost certainly a bug, and should be indicated by an exception. This behavior can obscure common programmer errors such as: (def a (atom {:a 1 :b 2})
(:foo a) ; forgot to deref a
;;=> nil
Attached patch 0001 throws an IllegalArgumentException as the fall-through case of RT.getFrom. |
[CLJ-1095] Allow map-indexed to accept multiple collections (a la map) Created: 25/Oct/12 Updated: 08/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Bo Jeanes | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Bring external interface of map-indexed in line with map. Existing usages of map-indexed unchanged both in implementation and interface. examples (map vector (range 10 20) (range 30 35)) ;=> ([10 30] [11 31] [12 32] [13 33] [14 34]) (map-indexed vector (range 10 20) (range 30 35)) ;=> ([0 10 30] [1 11 31] [2 12 32] [3 13 33] [4 14 34]) The attached patch is not necessarily the best implementation (I haven't benchmarked it or tried any alternatives yet) but hopefully enough to start a conversation about whether this is an addition that is warranted. I know I wished for this behavior a few weeks ago though I ended up finding another way. (I haven't sent my CA yet, but I have it signed and ready to send in the next few days) |
| Comments |
| Comment by Aaron Bedra [ 25/Oct/12 5:11 PM ] |
|
Can you add a test for the improved functionality? |
| Comment by Bo Jeanes [ 25/Oct/12 5:20 PM ] |
|
You bet. I tried to before submitting this but found no existing tests for map-indexed to expand upon. Given that, I decided to just start the conversation first. If you think this is a good addition, I'll find a place to stick the tests and add a new patch file. |
| Comment by Bo Jeanes [ 25/Oct/12 8:05 PM ] |
|
Add two unit tests for map-indexed. One tests old behavior (single collection) and the second tests mapping across 3 collections. There were no existing tests for map-indexed that I could see to expand upon (using git grep map-indexed src/clojure) |
[CLJ-1097] node-seq for clojure.zip Created: 29/Oct/12 Updated: 29/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Timothy Baldridge | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | clojure.zip | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Many times it's easier to get to a zipper node via (first (filter pred ...)) instead of manually walking the tree via next/up/down. Other times it's easier to process certain nodes via filter & map instead of again, walking the tree. This patch provides a single function called node-seq that uses zip/next to generate a lazy-seq of nodes. Tests provide two examples. |
[CLJ-1094] Zero-arity versions of every-pred and some-fn Created: 25/Oct/12 Updated: 25/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Tassilo Horn | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | patch, test | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
This patch adds zero-arity versions of every-pred and some-fn with these semantics. (every-pred) === (constantly true) (some-fn) === (constantly nil) These variants are useful in situations like the following: ;; compute-preds-for may return zero or many predicate fns (let [preds (compute-preds-for something)] (filter (apply every-pred preds) some-coll)) |
| Comments |
| Comment by Tassilo Horn [ 25/Oct/12 7:12 AM ] |
|
This is the thread where Max Penet suggested to have 0-arity versions of the two fns: https://groups.google.com/forum/?fromgroups=#!topic/clojure/IRlN-4LH_U0 |
[CLJ-1088] repl/source could support protocol functions Created: 21/Oct/12 Updated: 21/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Chouser | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
user=> (source clojure.core.protocols/coll-reduce) Source not found But since the protocol fn's var's metadata points to the protocol var, and the protocol var knows the file and line where it was defined, it would be trivial to improve 'source' to look like this: user=> (source clojure.core.protocols/coll-reduce)
(defprotocol CollReduce
"Protocol for collection types that can implement reduce faster than
first/next recursion. Called by clojure.core/reduce. Baseline
implementation defined in terms of Iterable."
(coll-reduce [coll f] [coll f val]))
|
| Comments |
| Comment by Chouser [ 21/Oct/12 10:00 AM ] |
|
Add one-line patch to clojure.repl/source so that it will find the protocol definition for a given protocol function. |
[CLJ-862] pmap level of parallelism inconsistent for chunked vs non-chunked input Created: 23/Oct/11 Updated: 20/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.1, Release 1.2, Release 1.3, Release 1.4 |
| Fix Version/s: | Reviewed Backlog |
| Type: | Defect | Priority: | Minor |
| Reporter: | Marshall T. Vandegrift | Assignee: | Jim Blomo |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
The code of pmap creates futures for the set of map operations it needs to perform with (map #(future %) coll), then acts on that sequence in a fashion obviously intended to keep only #CPUs+2 unfinished futures realized at any given time. It works exactly this way for non-chunked input seqs, but when pmap is passed a chunked seq, the seq of futures also becomes chunked. This causes an arbitrary number of futures to be realized as the #CPUs+2 window and chunk-size window interact. The doc-string for pmap doesn't promise any particular level of parallelism, but I think the inconsistent parallelism for chunked vs non-chunked input comprises a bug. |
| Comments |
| Comment by Stuart Halloway [ 25/Oct/11 6:51 PM ] |
|
Next person to take a deep look at pmap should probably also think through fork/join. |
| Comment by Jim Blomo [ 19/May/12 12:31 AM ] |
|
fork/join is a Java 7 feature. Would a proposed patch need to be able to fall back to Java 5 features? |
| Comment by Andy Fingerhut [ 19/May/12 1:06 AM ] |
|
Clojure/core folks can say more authoritatively, but I believe with the recent reduce enhancements that rely on jsr166 code, Clojure 1.5 will most likely require Java 6 or later, and Java 5 will no longer be supported. |
| Comment by Jim Blomo [ 28/May/12 5:29 PM ] |
|
Spinning up more threads than CPU cores is not a good idea when the work is CPU bound. Currently (1.4) pmap uses an unbounded thread pool, so chunked sequences will create more threads than intended. The least invasive change is to use a fixed sized thread pool (ForkJoinPool being one example). pmap is differentiated from core.reducers by the fact that it is lazy. This implies a one-at-a-time ThreadPool.submit model, instead of the recursive fork/join model. Tradeoffs include: Enforce look-ahead even on chunked sequences:
Move to a fixed size thread pool:
Use ForkJoinPool for fixed thread pool (instead of newFixedThreadPool):
I think using a traditional fixed size thread pool is the right option. Most of the time all of pmap's results will be realized, so I don't think it's worth saving work by being strict about the look-ahead size. This is also the decision map has made. Since we're not using ForkJoin's main strength (recursive work queuing), I don't think it is worth setting it up in clojure.core. I'll use Agent/pooledExecutor as the fixed size thread. Let me know if I forgot or misunderstood anything. |
| Comment by Jim Blomo [ 28/May/12 7:59 PM ] |
|
2012-05-28 pmap-chunking-862.diff uses a fixed size thread pool for pmap functions. |
[CLJ-1087] clojure.data/diff uses set union on key seqs Created: 15/Oct/12 Updated: 15/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Tom Jack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug, performance | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
clojure.data/diff, on line 118, defines: java.util.Map (diff-similar [a b] (diff-associative a b (set/union (keys a) (keys b)))) Since keys returns a key seq, this seems like an error. clojure.set/union has strange and inconsistent behavior with regard to non-sets, and in this case the two key seqs are concatenated. Based on a cursory benchmark, it seems that this bug The patch is easy (just call set on each key seq). |
| Comments |
| Comment by Andy Fingerhut [ 15/Oct/12 2:52 PM ] |
|
clj-1087-diff-perf-enhance-patch-v1.txt dated Oct 15 2012 implements Tom's suggested performance enhancement, although not exactly in the way he suggested. It does calculate the union of the two key sequences. |
[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-703] Improve writeClassFile performance Created: 04/Jan/11 Updated: 05/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Jürgen Hötzel | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
This Discussion about timing issues when writing class files led to the the current implementation of synchronous writes to disk. This leads to bad performance/system-load when compiling Clojure code. This Discussion questioned the current implentation. Synchronous writes are not necessary and also do not ensure (crash while calling write) valid classfiles. These Patches (0001 is just a code cleanup for creating the directory structure) ensures atomic creation of classfiles by using File.renameTo() |
| Comments |
| Comment by David Powell [ 17/Jan/11 2:16 PM ] |
|
Removing sync makes clojure build much faster. I wonder why it was added in the first place? I guess only Rich knows? I assume that it is not necessary. If we are removing sync though, I wouldn't bother with the atomic rename stuff. Doing that sort of thing can cause problems on some platforms, eg with search indexers and virus checkers momentarily locking files after they are created. The patch seems to be assuming that sync is there for some reason, but my initial assumption would be that sync isn't necessary - perhaps it was working around some issue that no longer exists? |
| Comment by Jürgen Hötzel [ 19/Jan/11 2:05 PM ] |
|
Although its unlikely: there is a possible race condition "loading a paritally written classfile"?: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L393 |
| Comment by John Szakmeister [ 25/May/12 4:22 AM ] |
|
The new improve-writeclassfile-perf version of the patch combines the two previous patches into a single patch file and brings them up-to-date with master. I can split the two changes back out into separate patch files if desired, but I figured out current tooling is more geared towards a single patch being applied. |
| Comment by John Szakmeister [ 25/May/12 4:36 AM ] |
|
FWIW, both fixes look sane. The first one is a nice cleanup. The second one is a little more interesting in that uses a rename operation to put the final file into place. It removes the sync call, which does make things faster. In general, if we're concerned about on-disk consistency, we should really have a combination of the two: write the full contents to a tmp file, sync it, and atomically rename to the destination file name. Neither the current master, nor the current patch will guarantee on-disk consistency across a machine wide crash. The current master could crash before the sync() occurs, leaving the file in an inconsistent state. With the patch, the OS may not get the file from file cache to disk before an OS level crash occurs, and leave the file in an inconsistent state as well. The benefit of the patch version is that the whole file does atomically come into view at once. It does have a nasty side effect of leaving around a temp file if the compiler crashes just before the rename though. Perhaps a little more work to catch an exception and clean up is in order? In general, I like the patched version better. |
| Comment by Ivan Kozik [ 05/Oct/12 7:07 PM ] |
|
File.renameTo returns false on (most?) errors, but the patch doesn't check for failure. Docs say "The return value should always be checked to make sure that the rename operation was successful." Failure might be especially likely on Windows, where files are opened by others without FILE_SHARE_DELETE. |
[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-1049] Make reducer/folder support reduce-kv Created: 22/Aug/12 Updated: 23/Sep/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Tom Jack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Currently, although rfn makes an effort to support reduce-kv, it is wasted effort since the return values of reducer and folder don't satisfy IKVReduce. I have a working patch for this, it's quite small. I have printed a CA but not sent it, so I won't reveal the patch yet... This also applies to ClojureScript. |
| Comments |
| Comment by Tom Jack [ 15/Sep/12 12:47 AM ] |
|
Hmm.. it's not quite as simple as I thought. My first patch simply had reducer/folder implement IKVReduce with `(clojure.core.protocols/kv-reduce coll (xf f1) init)`, but for map and mapcat, this results in strange behavior (reduce-kv reducefs being called with only 2 args). Patch 0001 includes modifications to map and mapcat so that the reduce-kv reducef will always be called with 3 args. The previous implementation of mapcat also had the converse problem: during non-kv reduce, if the mapcat fn returned a map, the reducef would be called with 3 args since maps reduce with reduce-kv. The patch gives behavior like: user> (->> {1 {2 3 4 5} 6 {7 8 9 10}}
(r/mapcat #(r/map + %2))
(reduce-kv #(conj %1 [%2 %3]) []))
[[2 5] [4 9] [7 15] [9 19]]
user> (->> [{2 3 4 5} {7 8 9 10}]
(r/mapcat identity)
(r/reduce conj []))
[[2 3] [4 5] [7 8] [9 10]]
|
| Comment by Tom Jack [ 23/Sep/12 8:34 PM ] |
|
Would like to discuss these changes (and auto-kv for maps) on clojure-dev, but my membership is still pending. My CA has been received. Anyone know who to contact to get my membership approved? |
[CLJ-1063] Missing dissoc-in Created: 07/Sep/12 Updated: 17/Sep/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Gunnar Völkel | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Not Approved |
| Description |
|
There is no clojure.core/dissoc-in although there is an assoc-in. |
| Comments |
| Comment by Andy Fingerhut [ 13/Sep/12 2:17 PM ] |
|
Patch clj-1063-add-dissoc-in-patch-v2.txt dated Sep 13 2012 supersedes 001-dissoc-in.diff dated Sep 7 2012. It fixes a typo (missing final " in doc string), and adds a test case for the new function. |
| Comment by Nicola Mometto [ 13/Sep/12 2:27 PM ] |
|
Thanks for the fix Andy |
| Comment by Andy Fingerhut [ 14/Sep/12 8:24 PM ] |
|
This proposed dissoc-in should be compared with the one in clojure.core.incubator which I just happened across. I see they look different, but haven't examined to see if there are any behavior differences. https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/incubator.clj |
| Comment by Nicola Mometto [ 15/Sep/12 6:43 AM ] |
|
dissoc-in in clojure.core.incubator recursively removes empty maps user=> (clojure.core.incubator/dissoc-in {:a {:b {:c 1}}} [:a :b :c]) while the one in this patch doesn't (as I would expect) user=> (dissoc-in {:a {:b {:c 1}}} [:a :b :c]) |
| Comment by Stuart Halloway [ 17/Sep/12 7:04 AM ] |
|
Please do this work in the incubator. |
[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-1020] clojure.inspector/inspect-table gives up when first element of coll is nil Created: 02/Jul/12 Updated: 13/Sep/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Dimitrios Piliouras | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | patch, | ||
| Environment: |
Ubuntu 12.04, Java 7, Clojure 1.4 |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
clojure.inspector/inspect-table gives up when first element of coll is nil. The patch provided is rather trivial...instead of blindly choosing the first element (which might be nil), it would be more convenient to choose the first element that is NOT nil and use its keys for columns...a similar issue exists with clojure.pprint/print-table where the keys of the first element are used (if not provided explicitly). The same is not true for 'inspect-table' though. As a result, one cannot 'inspect' a collection of maps where the first element is nil. My (trivial) patch looks for the first element which is NOT nil and uses its keys instead. Maps have to have the same length anyway so no problems there... |
| Comments |
| Comment by Andy Fingerhut [ 12/Jul/12 1:01 PM ] |
|
clj-1020-inspect-table-skip-nil-rows-patch1.txt of July 12, 2012 is identical to inspector.patch of July 2, 2012, except it is in the desired git format. Proper attribution is given to author Dimitrios Piliouras in the patch. |
[CLJ-1021] (let [i 5] (defmacro m [v] v) m) interprets m as a function, not a macro Created: 02/Jul/12 Updated: 13/Sep/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Zii Prime | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
(let [i 5] (defmacro m [& args] args) (def x (m (inc 5) (inc 6) (inc 7))) x m (meta #'m)) It appears to be interpreting m as a function despite the metadata. This behavior only shows up inside the (let ...). |
| Comments |
| Comment by Nicola Mometto [ 18/Aug/12 11:43 AM ] |
|
The problem is the same as the one for http://dev.clojure.org/jira/browse/CLJ-918 The patch linked there was mine but i had no CA signed at that time, and no account on jira. Here is the same patch in the correct format. Bug #918 should be closed as this is a duplicate |
[CLJ-700] contains? broken for TransientMaps Created: 01/Jan/11 Updated: 28/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | Priority: | Major |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
(contains? (transient {:x "fine"}) :x)
also (contains? (transient (hash-map :x "fine")) :x)
|
| Comments |
| Comment by Herwig Hochleitner [ 01/Jan/11 8:01 PM ] |
|
the same is also true for TransientVectors {{(contains? (transient [1 2 3]) 0)}}
|
| Comment by Herwig Hochleitner [ 01/Jan/11 8:25 PM ] |
|
As expected, TransientSets have the same issue; plus an additional, probably related one. (:x (transient #{:x}))
(get (transient #{:x}) :x)
|
| Comment by Alexander Redington [ 07/Jan/11 2:07 PM ] |
|
This is caused by expectations in clojure.lang.RT regarding the type of collections for some methods, e.g. contains() and getFrom(). Checking for contains looks to see if the instance passed in is Associative (a subinterface of PersistentCollection), or IPersistentSet. This patch refactors several of the Clojure interfaces so that logic abstract from the issue of immutability is pulled out to a general interface (e.g. ISet, IAssociative), but preserves the contract specified (e.g. Associatives only return Associatives when calling assoc()). With more general interfaces in place the contains() and getFrom() methods were then altered to conditionally use the general interfaces which are agnostic of persistence vs. transience. Includes tests in transients.clj to verify the changes fix this problem. |
| Comment by Stuart Halloway [ 28/Jan/11 10:35 AM ] |
|
Rich: Patch doesn't currently apply, but I would like to get your take on approach here. In particular:
|
| Comment by Alexander Redington [ 25/Mar/11 7:44 AM ] |
|
Rebased the patch off the latest pull of master as of 3/25/2011, it should apply cleanly now. |
| Comment by Stuart Sierra [ 17/Feb/12 2:59 PM ] |
|
Latest patch does not apply as of f5bcf647 |
| Comment by Andy Fingerhut [ 17/Feb/12 5:59 PM ] |
|
clj-700-patch2.txt does patch cleanly to latest Clojure head as of a few mins ago. No changes to patch except in context around changed lines. |
| Comment by Andy Fingerhut [ 07/Mar/12 3:23 AM ] |
|
Sigh. Git patches applied via 'git am' are fragile beasts indeed. Look at them the wrong way and they fail to apply. clj-700-patch3.txt applies cleanly to latest master as of Mar 7, 2012, but not if you use this command: git am -s < clj-700-patch3.txt I am pretty sure this is because of DOS CR/LF line endings in the file src/jvm/clojure/lang/Associative.java. The patch does apply cleanly if you use this command: git am --keep-cr -s < clj-700-patch3.txt |
| Comment by Andy Fingerhut [ 23/Mar/12 6:34 PM ] |
|
This ticket was changed to Incomplete and waiting on Rich when Stuart Halloway asked for feedback on the approach on 28/Jan/2011. Stuart Sierra changed it to not waiting on Rich on 17/Feb/2012 when he noted the patch didn't apply cleanly. Latest patch clj-700-patch3.txt does apply cleanly, but doesn't change the approach used since the time Stuart Halloway's concern was raised. Should it be marked as waiting on Rich again? Something else? |
| Comment by Stuart Halloway [ 08/Jun/12 12:44 PM ] |
|
Patch 4 incorporates patch 3, and brings it up to date on hashing (i.e. uses hasheq). |
| Comment by Andy Fingerhut [ 08/Jun/12 12:52 PM ] |
|
Removed clj-700-patch3.txt in favor of Stuart Halloway's improved clj-700-patch4.txt dated June 8, 2012. |
| Comment by Andy Fingerhut [ 18/Jun/12 3:06 PM ] |
|
clj-700-patch5.txt dated June 18, 2012 is the same as Stuart Halloway's clj-700-patch4.txt, except for context lines that have changed in Clojure master since Stuart's patch was created. clj-700-patch4.txt no longer applies cleanly. |
| Comment by Andy Fingerhut [ 19/Aug/12 4:47 AM ] |
|
Adding clj-700-patch6.txt, which is identical to Stuart Halloway's clj-700-patch4.txt, except that it applies cleanly to latest master as of Aug 19, 2012. Note that as described above, you must use the --keep-cr option to 'git am' when applying this patch for it to succeed. Removing clj-700-patch5.txt, since it no longer applies cleanly. |
| Comment by Stuart Sierra [ 24/Aug/12 1:08 PM ] |
|
Patch fails as of commit 1c8eb16a14ce5daefef1df68d2f6b1f143003140 |
| Comment by Andy Fingerhut [ 24/Aug/12 1:53 PM ] |
|
Which patch did you try, and what command did you use? I tried applying clj-700-patch6.txt to the same commit, using the following command, and it applied, albeit with the warning messages shown: % git am --keep-cr -s < clj-700-patch6.txt Note the --keep-cr option, which is necessary for this patch to succeed. It is recommended in the "Screening Tickets" section of the JIRA workflow wiki page here: http://dev.clojure.org/display/design/JIRA+workflow |
| Comment by Andy Fingerhut [ 28/Aug/12 5:48 PM ] |
|
Presumptuously changing Approval from Incomplete back to None, since the latest patch does apply cleanly if the --keep-cr option is used. It was in Screened state recently, but I'm not so presumptuous as to change it to Screened |
[CLJ-1047] Simplify the process of requiring fj in clojure.core.reducers Created: 21/Aug/12 Updated: 21/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Nicola Mometto | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
this patch removes compile-if in favor of import-if, removing code duplication |
[CLJ-957] Typehints for variadic methods in deftype fail to compile Created: 22/Mar/12 Updated: 19/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: |