[CLJ-1147] Threading macro (->) does not permit inline function declarations Created: 14/Jan/13 Updated: 19/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Stephen Nelson | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
(-> [1 2 3] (fn [args] apply + args)) CompilerException java.lang.Exception: Unsupported binding form: 1, compiling:(NO_SOURCE_PATH:1:13) The expression is expanded to: (fn [1 2 3] [args] apply + args) If this is intended behaviour then at the least the compiler error message is confusing. It would be preferable if the -> macro checked for (fn..) before treating a form as a sequence and injecting the argument. |
| Comments |
| Comment by Andy Fingerhut [ 15/Jan/13 12:56 AM ] |
|
Note that this works as you might have hoped: (-> [1 2 3] ((fn [args] (apply + args)))) because it expands into: ((fn [args] (apply + args)) [1 2 3]) Your suggestion that -> check for (fn ...) before treating it as a sequence and injecting the argument leaves open the question: Why only (fn ...) should be treated specially? Why not (let ...), (for ...), (doseq ...), etc? And if you go that far, how do you decide what should be allowed and what not? |
| Comment by Gabriel Horner [ 17/May/13 2:56 PM ] |
|
I agree with Andy, that it's not realistic suggestion to check for fn,let,etc. Perhaps a doc fix would help here but I'm not sure if we just want to call out (fn ...). I'd recommend closing this unless Stephen speaks up. |
| Comment by Stephen Nelson [ 19/May/13 10:29 PM ] |
|
I'm happy with Andy's synopsis of the problem, and it's reasonable not to change the behaviour of the threading macro specifically for (fn..). However, this is a mistake that I'm sure many others make/have made and it's hard to diagnose what is going wrong without dumping interpreted form – hardly a reasonable expectation for a novice user. Before closing this issue, I'd like to see improved failure reporting, such as causing the threading macro to throw a compile error or warning if passed a raw (unwrapped) function declaration (are there legitimate use cases this would affect?). |
[CLJ-1183] java interop - cannot call a final method on non-public superclass Created: 13/Mar/13 Updated: 18/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Shlomi | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
when trying to call a method on a concrete class that is defined as final on its super class that is not public, the runtime throws: "java.lang.IllegalArgumentException: Can't call public method of non-public class" even when fully annotated, Reflection is still used and the call fails. you can read the full description here https://groups.google.com/d/msg/clojure/p2tBMT-BIYc/mDQB8cSponMJ I included a sample project that demonstrate the problem |
| Comments |
| Comment by Shlomi [ 13/Mar/13 6:51 AM ] |
|
in my sample project, i used a nested class, but i didnt have to (as pointed by Marko Topolnik). changing the java code to: abstract class AbstractParent{ public class test extends AbstractParent {} and the clojure to: (ns call-test.core (:gen-class)) would produce the same error, java.lang.IllegalArgumentException: Can't call public method of non-public class: public final int AbstractParent.x() |
| Comment by zoowar [ 16/May/13 12:05 PM ] |
|
This issue affects the upcoming netty-4.0 release in which the public modifier of AbstractBootstrap was removed. |
| Comment by Matthew Phillips [ 18/May/13 3:48 AM ] |
|
To get Netty 4 working with Clojure I had to create a set of public static Java methods for the various inaccessible Netty calls, which I then call from Clojure. A PITA, but works fine. Happy to post code if anyone would find it useful. |
| Comment by Shlomi [ 18/May/13 4:31 AM ] |
|
Matthew, i kinda left that project after running to these and other troubles (focused on previous Netty until version 4 will become ready and be properly documented), but i'd still like to see your code. you have a github account or a gist with it? Clojure devs - are there any plans of checking this problem out? it came up from Netty, but the problem is pretty generic |
| Comment by Matthew Phillips [ 18/May/13 7:22 PM ] |
|
Shlomi: here's a gist with the code I'm using in it. It's not comprehensive, just the bits I needed. |
[CLJ-1131] Importing a non-existent class causes an exception that does not fully identify the source file Created: 17/Dec/12 Updated: 17/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Howard Lewis Ship | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | feedback | ||
| Description |
|
I'm in the process of stripping out some OSGi support, and I missed one import. The exception identifies "init.clj", but I'd prefer to see the full path there, as I have a few different "init.clj" files in my overall project. :core-services:compileClojure Reflection warning, com/annadaletech/nexus/services/registry.clj:37 - call to unregisterAll can't be resolved. Reflection warning, com/annadaletech/nexus/services/registry.clj:131 - call to getConfiguration can't be resolved. Reflection warning, com/annadaletech/nexus/services/registry.clj:150 - call to getConfiguration can't be resolved. Exception in thread "main" java.lang.ClassNotFoundException: org.osgi.framework.ServiceRegistration, compiling:(init.clj:1) at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3387) at clojure.lang.Compiler.compile1(Compiler.java:7035) at clojure.lang.Compiler.compile1(Compiler.java:7025) at clojure.lang.Compiler.compile(Compiler.java:7097) at clojure.lang.RT.compile(RT.java:387) at clojure.lang.RT.load(RT.java:427) at clojure.lang.RT.load(RT.java:400) at clojure.core$load$fn__4890.invoke(core.clj:5415) at clojure.core$load.doInvoke(core.clj:5414) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5227) at clojure.core$compile$fn__4895.invoke(core.clj:5426) at clojure.core$compile.invoke(core.clj:5425) at clojuresque.tasks.compile$main$fn__64.invoke(compile.clj:23) at clojuresque.cli$with_command_line_STAR_.invoke(cli.clj:92) at clojuresque.tasks.compile$main.doInvoke(compile.clj:6) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:601) at clojure.lang.Var.invoke(Var.java:419) at clojuresque.Driver.main(Driver.java:39) Caused by: java.lang.ClassNotFoundException: org.osgi.framework.ServiceRegistration |
| Comments |
| Comment by Gabriel Horner [ 17/May/13 3:56 PM ] |
|
While it's reasonable to want this for your case, having long path names in a stacktrace could be inconvenient for others. I'd recommend posting your desired change on the dev list - https://groups.google.com/forum/?fromgroups#!forum/clojure-dev . If they're ok with it, then I'd recommend submitting a patch. |
[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-1207] Importing a class that does not exist fails to report the name of the class that did not exist Created: 29/Apr/13 Updated: 10/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Howard Lewis Ship | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | feedback | ||
| Environment: |
1.5.1, OS X |
||
| Waiting On: | Howard Lewis Ship |
| Description |
|
Pop quiz: What Java class is missing from the classpath? java.lang.NoClassDefFoundError: Could not initialize class com.annadaletech.nexus.util.logging__init
at java.lang.Class.forName0 (Class.java:-2)
java.lang.Class.forName (Class.java:264)
clojure.lang.RT.loadClassForName (RT.java:2098)
clojure.lang.RT.load (RT.java:430)
clojure.lang.RT.load (RT.java:411)
clojure.core$load$fn__5018.invoke (core.clj:5530)
clojure.core$load.doInvoke (core.clj:5529)
clojure.lang.RestFn.invoke (RestFn.java:408)
clojure.core$load_one.invoke (core.clj:5336)
clojure.core$load_lib$fn__4967.invoke (core.clj:5375)
clojure.core$load_lib.doInvoke (core.clj:5374)
clojure.lang.RestFn.applyTo (RestFn.java:142)
clojure.core$apply.invoke (core.clj:619)
clojure.core$load_libs.doInvoke (core.clj:5413)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invoke (core.clj:619)
clojure.core$require.doInvoke (core.clj:5496)
clojure.lang.RestFn.invoke (RestFn.java:512)
novate.console.app$eval1736$loading__4910__auto____1737.invoke (app.clj:1)
novate.console.app$eval1736.invoke (app.clj:1)
clojure.lang.Compiler.eval (Compiler.java:6619)
clojure.lang.Compiler.eval (Compiler.java:6608)
clojure.lang.Compiler.load (Compiler.java:7064)
user$eval1732.invoke (NO_SOURCE_FILE:1)
clojure.lang.Compiler.eval (Compiler.java:6619)
clojure.lang.Compiler.eval (Compiler.java:6582)
clojure.core$eval.invoke (core.clj:2852)
clojure.main$repl$read_eval_print__6588$fn__6591.invoke (main.clj:259)
clojure.main$repl$read_eval_print__6588.invoke (main.clj:259)
clojure.main$repl$fn__6597.invoke (main.clj:277)
clojure.main$repl.doInvoke (main.clj:277)
clojure.lang.RestFn.invoke (RestFn.java:1096)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__584.invoke (interruptible_eval.clj:56)
clojure.lang.AFn.applyToHelper (AFn.java:159)
clojure.lang.AFn.applyTo (AFn.java:151)
clojure.core$apply.invoke (core.clj:617)
clojure.core$with_bindings_STAR_.doInvoke (core.clj:1788)
clojure.lang.RestFn.invoke (RestFn.java:425)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:41)
clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__625$fn__628.invoke (interruptible_eval.clj:171)
clojure.core$comp$fn__4154.invoke (core.clj:2330)
clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__618.invoke (interruptible_eval.clj:138)
clojure.lang.AFn.run (AFn.java:24)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:603)
java.lang.Thread.run (Thread.java:722)
If you guess "com.annadaletech.nexus.util.logging__init" you are wrong! Wait, I'll give you a hint: (ns com.annadaletech.nexus.util.logging
(:use [clojure.string :only [trim-newline]]
[clojure.pprint :only [code-dispatch pprint with-pprint-dispatch *print-right-margin*]])
(:import [java.io StringWriter]
[org.slf4j MDC MarkerFactory Marker LoggerFactory]
[java.util.concurrent.locks ReentrantLock]))
Oh, sorry, did that not help? The correct answer is "org.slf4j.MDC". Having that information in the stack trace would have saved me nearly an hour. I think it is worth the effort to get that reported correctly. |
| Comments |
| Comment by Gabriel Horner [ 10/May/13 1:56 PM ] |
|
When I try this on a fresh project, I get this error: Howard, could you give us a project.clj or better yet a github repository that recreates this issue? |
| Comment by Howard Lewis Ship [ 10/May/13 4:51 PM ] |
|
I'll see what I can do. Probably be next week. Thanks for looking at this. |
[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-1164] typos in instant.clj Created: 14/Feb/13 Updated: 10/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Steve Miner | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Screened |
| Description |
|
There are a few typographical mistakes in instant.clj. |
| Comments |
| Comment by Steve Miner [ 14/Feb/13 12:01 PM ] |
|
Fixes a couple of typos. No code changes. |
| Comment by Gabriel Horner [ 10/May/13 11:25 AM ] |
|
For anyone wondering about the UTC change see |
[CLJ-1143] Minor correction to doc string of ns macro Created: 10/Jan/13 Updated: 10/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.6 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Screened |
| Description |
|
The doc string of ns says "If :refer-clojure is not used, a default (refer 'clojure) is used." 'clojure should be replaced with 'clojure.core Clojure group thread: https://groups.google.com/forum/?fromgroups=#!topic/clojure/rDjZodxOMh8 |
| Comments |
| Comment by Andy Fingerhut [ 10/Jan/13 1:34 PM ] |
|
clj-1143-ns-doc-string-correction-v1.txt dated Jan 10 2013 replaces (refer 'clojure) with (refer 'clojure.core) in the doc string of the ns macro. |
[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-866] Provide a clojure.test function to run a single test case with fixtures Created: 27/Oct/11 Updated: 04/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Hugo Duncan | Assignee: | Anthony Grimes |
| Resolution: | Unresolved | Votes: | 8 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Incomplete |
| Description |
|
At present, clojure.test test cases are functions and can be invoked directly. However, in the case that the test relies on fixtures, this does not work. Please provide a function that can run a single test case with all fixtures applied. |
| Comments |
| Comment by Anthony Grimes [ 22/Oct/12 6:17 PM ] |
|
I just added clj-866-test-vars.patch (22/Oct/12 6:09PM). I had to implement this hackishly in Leiningen a few days ago, so I'm very excited to get this functionality in clojure.test itself. This patch adds a test-vars function that solves this problem (and is more general). You can test as many vars as you want with it, with fixtures. It works by grouping vars passed by their namespace and then running them all with appropriate fixtures applied. Being able to run a single test isn't the problem here, being able to run only specific tests is. If we wrote a function to run one test with fixtures but we actually needed to run several, just not all tests, we'd end up having to run once-fixtures more than once which is wasteful. I think test-vars is a good solution that solves both this problem and the one I just mentioned. |
| Comment by Alex Miller [ 04/May/13 9:36 AM ] |
|
This is highly useful. Could you add a test to the patch? |
[CLJ-766] Implicit casting behaviour of into-array differs from <primitive>-array Created: 01/Apr/11 Updated: 03/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Alexander Taggart | Assignee: | Karsten Schmidt |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Incomplete |
| Description |
|
Current patch: byte-short-array-ctors.diff The behavior of byte-array and short-array is inconsistent with the other <type>-array functions and with the into-array function when invoked with types other than byte or short. All of the other cases upcast to Number, then extract the primitive value, allowing this operation to succeed (assuming the value is in range). byte-array and short-array throw a ClassCastException. Example: base64v3a=> (into-array Byte/TYPE [1 2 3 4]) ;; int to byte ok #<byte[] [B@5ee04fd> base64v3a=> (byte-array [1 2 3 4]) ;; int to byte NOT ok!! ClassCastException java.lang.Long cannot be cast to java.lang.Byte clojure.lang.Numbers.byte_array (Numbers.java:1418) base64v3a=> (long-array [1 2 3 4]) ;; int to long ok #<long[] [J@3f9f4d1d> into-array (via RT.seqToTypedArray) and the other <type>-array functions all upcast to Number (via Numbers.<type>_array}}), then obtain the proper primitive value. Numbers.byte-array and Numbers.short-array do casts directly to Byte and Short (yielding the ClassCastException). The attached patch makes the Byte and Short cases match the other types and the into-array behavior. Tests are included. The submitter is a contributor. |
| Comments |
| Comment by Alexander Taggart [ 02/Apr/11 2:04 PM ] |
|
See |
| Comment by Andy Fingerhut [ 28/May/12 6:45 PM ] |
|
Some more details from Alexandar Taggart: This is not a duplicate of |
| Comment by Karsten Schmidt [ 02/Mar/13 5:11 PM ] |
|
I'd like to bump up this issue, since it'd be great if all the (xxx-array) factory functions have the same expected behavior (i.e. not throw an exception, especially not if the values are in range). The attached patch is changing the behaviour for byte-array & short-array to the same pattern used as for int/long/float/double and therefore will not throw an exception for valid (even if overflown) numbers. You can find more discussion in this thread on: https://groups.google.com/forum/?hl=en&fromgroups=#!topic/clojure/KyQrbph-zqo |
| Comment by Andy Fingerhut [ 03/Mar/13 8:11 AM ] |
|
Voting on a ticket (click the "Vote" link under the "People" heading while viewing the ticket on JIRA) may help draw attention to it, too. |
| Comment by Andy Fingerhut [ 04/Mar/13 1:08 PM ] |
|
Karsten, patches should be in the format created by the "git format-patch" command as described in the instructions under the heading "Development" on this page: http://dev.clojure.org/display/design/JIRA+workflow |
| Comment by Karsten Schmidt [ 04/Mar/13 2:05 PM ] |
|
Sorry Andy, I used Atlassian SourceTree to create the patch and assumed it's in standard git format... I've removed the old one and attach a (hopefully) properly formatted one. Apologies, contributing-beginners-luck! |
| Comment by Stuart Halloway [ 30/Mar/13 8:52 AM ] |
|
While investigating this, I noticed that long-array coerces across type, e.g. (seq (long-array [1.0])) => (1) Is this what we want? I don't think so. |
| Comment by Stuart Halloway [ 30/Mar/13 8:53 AM ] |
|
I agree that all the numeric array constructors should work the same way, but I am not sue we should adopt long-array's approach, which allows coercion from float to integer types. |
| Comment by Alex Miller [ 03/May/13 8:31 PM ] |
|
I think the patch approach is valid. However, the patch does not cover the same problem in the 2-arity version of byte_array and short_array (when a size is supplied). Please update the patch to include a fix in the 2-arity version of byte_array and short_array and tests for the same. Ex: (byte-array 1 [1]). Also, there is a whitespace issue in the patch - please just use spaces! /Users/alex/work/code/clojure/.git/rebase-apply/patch:24: space before tab in indent. ret[i] = ((Number)s.first()).byteValue(); warning: 1 line adds whitespace errors. Re Stuart's comments, I don't think that's in the scope of this ticket or solution. |
| Comment by Alex Miller [ 03/May/13 8:32 PM ] |
|
Sending back to Karsten for the requested patch updates. |
[CLJ-1208] Namespace is not loaded on defrecord class init Created: 03/May/13 Updated: 03/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Tim McCormack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
As a user of Clojure interop from Java, I want defrecords (and deftypes?) to load their namespaces upon class initialization so that I can simply construct and use AOT'd record classes without manually requiring their namespaces first. Calling the defrecord's constructor may or may not result in "Attempting to call unbound fn" exceptions, depending on what code has already been run. This issue has been raised several times over the years, but I could not find an existing ticket for it:
|
[CLJ-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-1206] 'eval' of closures or fns with runtime metadata within a call expr yields "No matching ctor found" exceptions Created: 28/Apr/13 Updated: 28/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Jason Wolfe | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I ran into some issues with 'eval' when writing compilation strategies for Graph. It seems these may have been known for some time [1], but I couldn't find a ticket for them, so here we are. Clojure docs [2] say "If the operator is not a special form or macro, the call is considered a function call. Both the operator and the operands (if any) are evaluated, from left to right," and "Any object other than those discussed above will evaluate to itself." While bare fns do seem to evaluate to themselves in all cases, when in a call expression, the evaluation of the operator fails on fn objects that are closures or have run-time metadata applied: ;; raw non-closures are fine ;; raw closures are fine ;; non-closures in exprs are fine ;; but closures in exprs cause an error ;; as do fns with metadata in exprs [1] http://stackoverflow.com/a/11287181 |
[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-1205] Update Maven build for Nexus 2.4 Created: 22/Apr/13 Updated: 22/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Stuart Sierra | Assignee: | Stuart Sierra |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
These additions to the build configuration are necessary to support changes to the Sonatype Nexus server at oss.sonatype.org, which we use to promote our build artifacts into the Maven Central Repository. See Sonatype's announcement at https://groups.google.com/d/msg/clojure-dev/lBpfII2u6vM/LQvr_rO5UGgJ |
[CLJ-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-1201] There should also be writing in clojure.edn Created: 15/Apr/13 Updated: 15/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Vitaly Shukela | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | edn | ||
| Description |
|
In clojure.edn I see only "read" and "read-string". For symmetry I expect "write" and "write-string" to be nearby. At first it could be just alias for "pr" and "pr-str", but in furure they may limited version of "pr" which only produces valid input for clojure.edn/read. |
[CLJ-889] Specifically allow '.' inside keywords Created: 01/Dec/11 Updated: 15/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Reviewed Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Howard Lewis Ship | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | keywords, reader | ||
| Description |
|
The documentation for keywords (on page http://clojure.org/reader) specifically states that '.' is not allowed as part of a keyword name; however '.' is specifically useful. For example, several web frameworks for Clojure use keywords to represent HTML elements, using CSS selector syntax (i.e., :div.important is equivalent to <div class='important'>). In any case, the use of '.' is not checked by the reader and it is generally useful. I would like to see '.' officially allowed (in the documentation). Further, I'd like to see additional details about which punctuation characters are allowed (my own web framework uses '&', '?' and '>' inside keywords for various purposes ... again, current reader implementation does not forbid this, but if a future reader will reject it, I'd like to know now). |
| Comments |
| Comment by Howard Lewis Ship [ 08/Dec/11 3:37 PM ] |
|
To clarify, Hiccup and Cascade both use keywords containing '#' and '.' Cascade goes further, using '&' (to represent HTML entities), '>', and (possibly in the future) '?'. |
| Comment by Devin Walters [ 20/Oct/12 6:46 PM ] |
|
I think the EDN spec mitigates some of the concern, but as of yet the official clojure.org reader documentation does not reflect the language used in the description of EDN. Where does EDN stand right now? Can the description being used on the github page be pulled over to clojure.org? References:
|
| Comment by Howard Lewis Ship [ 15/Apr/13 5:56 AM ] |
|
Unfortunately, the EDN specification does not mention '>'. |
[CLJ-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-944] (.containsKey {:one 1} :one) throws Exception Created: 04/Mar/12 Updated: 13/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4, Release 1.5 |
| Fix Version/s: | Release 1.5, Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Alf Kristian Støyle | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
Clojure 1.3 om Mac OS 10.7, Clojure 1.5.0 alpha1 on Linux x86_64 (OpenJDK 1.7.0 b147) |
||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
Patch clj944-plus-tests does three things:
Hi guys, I am getting the following exception: (.containsKey {:one 1} :one)
;=> ClassCastException clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.PersistentHashMap
The map is a clojure.lang.PersistentArrayMap, which obviously has a containsKey method (https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentArrayMap.java#L95). Casting it works fine though: (.containsKey ^clojure.lang.PersistentArrayMap {:one 1} :one)
;=> true
The mailing list suggest that the compiler injects an incorrect cast to clojure.lang.PersistentHashMap. In this case it should probably be cast to a clojure.lang.Associative, the highest common interface having the .containsKey method. The problem is not present in Clojure 1.2.1. |
| Comments |
| Comment by Nicola Mometto [ 30/Oct/12 5:02 PM ] |
|
The attached patch fixes the issue, by emitting IPersistentMap instead of Persistent{Hash|Array}Map as class type for maps literals |
| Comment by Nicola Mometto [ 01/Nov/12 3:48 PM ] |
|
I uploaded another patch fixing the same problem in a different way. This approach is more consistent, making the type of the compiler's internal representation of a map literal equal to the one of the reader. Note that this second approach while being more consistent, breaks some tests that assume some operations on maps (specifically `seq` and `print`) to be order dependent, and written with the hash-map return order implementation in mind. That should not be the case and if the second patch is preferred over the first one, I'll gladly fix those tests. |
| Comment by Stuart Halloway [ 01/Mar/13 12:09 PM ] |
|
Approach #2, relying on consistent choice of concrete map class by size throughout, feels quite fragile. Approach #1 seems to abuse the method name getJavaClass(), now having it return "get the base type I would need for cast". Maybe there needs to be a different thing entirely? |
| Comment by Nicola Mometto [ 01/Mar/13 2:17 PM ] |
|
Patch #2 should get merged (IMHO) regardless of the fragility of its approach to fixing this ticket's bug, since it fixes another bug: prior to the patch: user=> (class {:a 1}) after the patch: user=> (class {:a 1}) This should also lead to some minor performance enhancement since prior to this moment, every map def'ed would be a HashMap instead of an ArrayMap So, I think patch #2 should be applied if not for this ticket's bug, at least for the reason stated above. |
| Comment by Rich Hickey [ 13/Apr/13 9:41 AM ] |
|
This should not have passed screening. There are two issues, should be separate. I have no idea what has been screened nor what will be applied should it be approved. There's contention in the discussion but no resolution. |
| Comment by Nicola Mometto [ 13/Apr/13 12:06 PM ] |
|
I don't think that there are two issues here. The underlying cause of those two symtoms is fixed by the patch 002 that i submitted (incorporated in Stu's clj944-plus-tests patch. Stuart said that this approach feels fragile but the bug is caused by the fact that everywhere else clojure returns a PersistentArrayMap when the element count is <= than the PersistentHashMap threshold, and when emitting maps, it doesn't. Making clojure emit maps consistently with how clojure does internally everywhere else looks to me like the only solution, and I don't really see how making clojure consistent is a fragile approach. But again, if somebody can suggest a better solution to this problem, I'll gladly submit another patch. |
[CLJ-1101] *default-data-reader-fn* should be set!-able in REPL Created: 03/Nov/12 Updated: 13/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Steve Miner | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Screened |
| Description |
|
In |
| Comments |
| Comment by Steve Miner [ 03/Nov/12 9:32 AM ] |
|
Add *default-data-reader-fn* to the special bindings in main.clj so that it is set!-able in the REPL |
| Comment by Steve Miner [ 03/Dec/12 10:07 AM ] |
|
This is a one-liner that makes *default-data-reader-fn* convenient to use in the REPL, similar to how *data-readers* works. I'd like to have this fix in Clojure 1.5. |
| Comment by Steve Miner [ 12/Mar/13 8:10 PM ] |
|
work-around for REPL: (alter-var-root #'clojure.core/*default-data-reader-fn* (constantly my-default-reader)) |
[CLJ-1199] Record values are not 'eval'uated, unlike values of PersistentMap: Created: 13/Apr/13 Updated: 13/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Jason Wolfe | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I'm not sure if this is by design, but it caught me off guard. user> (defrecord A [x]) user> (eval (hash-map :x `long)) and in case it matters, here's a simplified version of the real use case where this came up, with no eval – just a macro: user> (defmacro munge-meta1 [x] (assoc x :schema (->A (:schema (meta x))))) user> (defmacro munge-meta2 [x] (assoc x :schema (hash-map :x (:schema (meta x))))) This seems to be fixed by moving the record creation post-evaluation, so it's not a big deal, just surprising (plus I haven't yet convinced myself that this will always work if the user's schema itself contains record-creating forms, although it seems to work OK): user> (defmacro munge-meta1 [x] (assoc x :schema `(->A ~(:schema (meta x))))) I brought this up on the mailing list here: https://groups.google.com/forum/?fromgroups=#!topic/clojure-dev/UgD35E1RQTo |
[CLJ-1198] Apply metadata to primitive fns causes them to lose their primitive-ness Created: 13/Apr/13 Updated: 13/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Jason Wolfe | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
user> (def f (fn [^long x] x)) We're working on libraries that use metadata on functions to track information about their arguments (schemata, etc), and this currently blocks us from fully supporting primitive fns. |
[CLJ-1099] better error message when passing non-seq to seq Created: 01/Nov/12 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stuart Halloway | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Ok |
| Description |
|
Design discussion here. This patch improves Clojure's error message for a single common error: passing a non-seq where a seq is neede. More importantly, it is intended as a prototype for other similar improvements in the future. Error message before: (cons 1 2) => IllegalArgumentException Don't know how to create ISeq from: java.lang.Long Error message after: user=> (cons 1 2)
ExceptionInfo Don't know how to create ISeq from: java.lang.Long
user=> (ex-data *e)
{:instance 2}
|
| Comments |
| Comment by Michael Klishin [ 12/Nov/12 10:34 AM ] |
|
Wouldn't it be better to make it read "Don't know how to create ISeq from: 2 (java.lang.Long)"? How many beginners will figure |
| Comment by Stuart Halloway [ 12/Apr/13 11:36 AM ] |
|
Hi Michael, ex-info messages should not, in general, pr-str things into their bodies. This raises the question of print-length and print-level in a place where the user doesn't have good control, while the whole point of ex-info is to be in the data business, not the string business. Users can control printing from ex-data any way they like. There are two possible ways to make beginners aware of ex-data: Tell them about it in one (or a few places) in docs, or in an infinite number of places saying "This would have been useful here, but we didn't use it because you might not know about it." I prefer the former. That said, I think it would be great to increase the visibility of ex-info and ex-data early on in documentation for beginners, and to make sure that things like exception printing in logs are flexible enough not to lose the benefits of ex-info. |
[CLJ-196] *file* returns "NO_SOURCE_PATH", but the doc says it should be nil Created: 10/Oct/09 Updated: 12/Apr/13 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Alexander Redington | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Ok |
| Waiting On: | Rich Hickey |
| Description |
|
According to http://clojure.org/api, *file* should return nil in the repl, but it returns "NO_SOURCE_PATH". This has been true for a long time. Latest patch changes only the docstring of *file* to accurately reflect current behavior. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 4:47 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/196 |
| Comment by Colin Jones [ 31/Dec/10 2:41 PM ] |
|
I think this is a pretty trivial docstring fix - "NO_SOURCE_PATH" has been the default value of file since 3dd4c1cf18ea8456b5b4aec607cd54ecfdd85eea (April 2009). |
| Comment by Andy Fingerhut [ 24/Feb/12 4:36 PM ] |
|
Colin's patch still applies cleanly to latest master as of Feb 24, 2012. |
| Comment by Stuart Sierra [ 23/Mar/12 8:32 AM ] |
|
Docstring only. Screened. |
| Comment by Stuart Sierra [ 24/Aug/12 8:44 AM ] |
|
Rescreened. Still applies on latest master. |
| Comment by Rich Hickey [ 19/Oct/12 5:47 PM ] |
|
I'd rather promise nothing than promise this forever. |
| Comment by Colin Jones [ 19/Oct/12 7:15 PM ] |
|
The second patch avoids promising the return value. For clarity, it does mention the lack of guarantee instead of omitting any mention. |
| Comment by Christopher Redinger [ 27/Nov/12 5:33 PM ] |
|
Patch applies cleanly and makes documentation more correct. |
[CLJ-783] clojure.inspector/inspect-tree doesn't work on sets --patch in the description by Jason Wolfe Created: 28/Apr/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: | Minor |
| Reporter: | Armando Blancas | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Any |
||
| Attachments: |
|
| Patch: | Code |
| Approval: | Ok |
| Waiting On: | Rich Hickey |
| Description |
|
As reported by Jason Wolfe on March 19, 2009 in the clojure group: clojure.inspector/inspect-tree doesn't work on sets; patch attached I was debugging with inspect-tree and noticed that it errors when it I made a small patch (below) that makes inspect-tree work on Cheers, Index: src/clj/clojure/inspector.clj
(defmulti is-leaf collection-tag) -(defmethod is-leaf :map [m]
(defn tree-model [data] |
| Comments |
| Comment by Andy Fingerhut [ 14/Feb/12 12:54 PM ] |
|
Created a properly formatted patch, attached, for Jason's enhancement. I tested it with (inspect-tree (:members (clojure.reflect/reflect java.lang.Math))) and it worked, whereas it had many errors without Jason's changes. |
| Comment by Andy Fingerhut [ 23/Feb/12 11:58 PM ] |
|
Jason Wolfe has signed a CA. Patch applies cleanly with latest master as of Feb 14, 2012. No errors, warnings, or test failures with the patch applied. No doc strings need updating. |
| Comment by Stuart Sierra [ 09/Nov/12 4:12 PM ] |
|
Screened. |
[CLJ-873] Allow the function / to be referred to in namespaces other than clojure.core Created: 10/Nov/11 Updated: 12/Apr/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: | Release 1.6 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Chris Gray | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 7 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Ok |
| Description |
|
The attached patch gives the programmer the option of referring to the division function in namespaces other than just clojure.core. For example, (ns foo The above lines do not compile without this patch. |
| Comments |
| Comment by Chris Gray [ 10/Nov/11 9:50 AM ] |
|
I have signed the CA and it is in the mail. |
| Comment by Chris Gray [ 20/Nov/11 6:21 PM ] |
|
My CA has now been applied. This patch is quite simple – can someone have a look at it please? |
| Comment by Alex Miller [ 09/Dec/11 9:34 AM ] |
|
FYI, I have run into this in actual code as well (implementing a query language function library). |
| Comment by Andy Fingerhut [ 24/Feb/12 8:00 PM ] |
|
clj-873-namespace-divides-patch.txt is same as Chris's, just updated to apply cleanly to latest master as of Feb 24, 2012. The test he added does fail without the code fix, and passes with it. He is now on the list of contributors. |
| Comment by Chris Gray [ 30/Mar/12 1:11 PM ] |
|
A short further discussion of this patch appeared here: http://groups.google.com/group/clojure-dev/browse_thread/thread/f095980802a82747/b723726c77c1ec64 Also, I assume this bug is what is referred to in Clojurescript's core.cljs, where it says ";; FIXME: waiting on cljs.core//" |
| Comment by Stuart Halloway [ 22/Oct/12 7:12 PM ] |
|
Thanks all. It is nice to have supporting real-world stories such as Alex's in the comments. |
| Comment by Andy Fingerhut [ 22/Oct/12 7:19 PM ] |
|
I should have added a comment here a while back if it would have helped, but David Nolen's |
| Comment by Brandon Bloom [ 02/Jan/13 12:49 AM ] |
|
This also affects a two of my libraries: 1) CSS generation library I'm working on, which wants to be able to do division with pixels and other units. 2) Factjor which defines binary math operators against a stack. |
[CLJ-863] interleave should accept 1 or 0 arguments Created: 24/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: | Enhancement | Priority: | Trivial |
| Reporter: | Joe Gallo | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 5 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Ok |
| Description |
|
interleave should handle 0 and 1 arguments in the same way that concat does (i.e., 0 args --> empty seq, 1 args --> identity). |
| Comments |
| Comment by Rich Hickey [ 15/Jun/12 9:31 AM ] |
|
(lazy-seq nil) should be () |
| Comment by Joe Gallo [ 15/Jun/12 10:13 AM ] |
|
Hey Rich, if you're talking about the first line of the diff: + ([] (lazy-seq nil)) Then that's the implementation, not the tests – given an empty vector of arguments, return (lazy-seq nil), which I just copied from the existing definition of concat. Cheers, |
| Comment by Marc Dzaebel [ 03/Oct/12 1:19 PM ] |
|
(defn interleave [& s] (apply mapcat list s)) |
| Comment by Matthew O. Smith [ 03/Oct/12 8:47 PM ] |
|
Marc's definition doesn't work for no arguments. Maybe: (defn interleave |
| Comment by Marc Dzaebel [ 05/Oct/12 1:07 PM ] |
|
Yes, but my solution is too slow, as it uses "apply". |
| Comment by Andy Fingerhut [ 01/Jan/13 11:54 AM ] |
|
Patch clj-863-make-interleave-handle-odd-args-like-concat-patch-v1.txt dated Jan 1 2013 is identical to Joe Gallo's 0001-make-interleave-handle-odd-arugments-in-the-same-man.patch patch dated Oct 24 2011, except it returns () instead of (lazy-seq nil) as per Rich's comment. If concat should also return () instead of (lazy-seq nil), perhaps another ticket should be created to fix that. Also presumptuously changing ticket state from Incomplete back to Vetted, since the reason it was marked Incomplete should now be addressed, and it was Screened before. |
[CLJ-896] Make browse-url aware of xdg-open Created: 13/Dec/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: | Minor |
| Reporter: | Jasper Lievisse Adriaanse | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Environment: |
All platforms that provide xdg-open (as part of freedesktop.org) benefit from this. Fix was tested on OpenBSD. |
||
| Attachments: |
|
| Patch: | Code |
| Approval: | Ok |
| Waiting On: | Rich Hickey |
| Description |
|
clojure.java.browse/browse-url tests to see if it's running on Mac OS to fall back to "/usr/bin/open" in order |
| Comments |
| Comment by Andy Fingerhut [ 28/Feb/12 6:19 PM ] |
|
|
| Comment by Andy Fingerhut [ 29/Feb/12 1:18 PM ] |
|
clj-896-browse-url-uses-xdg-open-patch2.txt is based more on the patch attached to I think this patch improves on both of the previous patches for CLJ-896 and Tested on: Mac OS X 10.6.8 It would be great if someone could test it on a BSD system. The only possible issue I can think of is whether the output of the "which" command is different there than on the Linux system I tested. If someone wants to make a patch that doesn't use "which", but instead checks the PATH, I'd recommend they also test on Windows in cmd.exe to make sure it works correctly there. |
| Comment by Stuart Sierra [ 09/Nov/12 9:04 AM ] |
|
Screened. Verified on Mac OS X. |
| Comment by Jasper Lievisse Adriaanse [ 09/Nov/12 9:41 AM ] |
|
And I've tested it on OpenBSD. |
[CLJ-908] Functions with metadata print poorly Created: 10/Jan/12 Updated: 12/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: | Enhancement | Priority: | Minor |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Ok |
| Waiting On: | Rich Hickey |
| Description |
|
1.3 removed the metadata slot on most functions, and made .withMeta return a new wrapping function that provides metadata. This changes the way functions with metadata print: instead of #<user$eval595$fn_596 user$eval595$fn_596@3d48ff04> we now see #< clojure.lang.AFunction$1@581de498>. I might argue that we should "lie" and print the class of the original wrapped function since it's more useful than AFunction$1, but that's debatable. The two things I propose changing are:
If it would be desirable to print the class of the original "wrapped" function, then I can easily add another patch for that. |
| Comments |
| Comment by Andy Fingerhut [ 19/May/12 3:30 AM ] |
|
clj-908-Print-metadata-and-anonymous-classes-better-patch2.txt dated May 19, 2012 only has context line changes from the previous one, 0001-Print-metadata-and-anonymous-classes-better.patch dated Jan 10, 2012. The previous one no longer applies cleanly to the latest master, while the new one does. |
| Comment by Stuart Sierra [ 09/Nov/12 9:21 AM ] |
|
Screened. |
[CLJ-1018] range's behavior is inconsistent Created: 29/Jun/12 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.1, Release 1.2, Release 1.3, Release 1.4, Release 1.5 |
| Fix Version/s: | Release 1.5, Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Devin Walters | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | patch, range | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Ok |
| Description |
|
Problem statement: The current behavior of range is inconsistent. (range 0 9 0) has always produced (). (range 0 9 -1) has always produced (). (range 9 0 1) has always produced (). However, (range 9 0 0) produces (9 9 9 9 ...), and (range 0 0 0) produces '(0 0 0 0 ...) Proposal: Make the behavior of range consistent when using a step of 0 to make it produce an empty list. Please see attached code and patch. |
| Comments |
| Comment by Mike Anderson [ 01/Jul/12 4:08 AM ] |
|
Agree it is good to fix the inconsistency, but I think an infinite sequence of zeros is the correct result, as implied by the current docstring definition. It's also mathematically cleanest: range should produce an arithmetic progression until the end value is equalled or exceeded. Empty lists only seem to make sense as a return value when start >= end. |
| Comment by Devin Walters [ 01/Jul/12 12:36 PM ] |
|
Hi Mike, Could you explain how you think the docstring definition implies this behavior? Maybe I'm missing something, but I was surprised. For instance, in the case of (range 3 9 0), if start were truly inclusive as the docstring says, the result would be (3), not (). You mentioned that you think the infinite sequence of 0's is consistent and in keeping with the definition of range. I'm not sure I agree. (0,0] is an empty set of length zero, and [0,0) is an empty set of length zero. You state that empty list only makes sense for start >= end, except this is not the current behavior. Could you help me understand what you believe the appropriate behavior would be in each of the following three cases? (range 0 10 0), (range 10 0 0), and (range 0 0 0)? A few options to consider: Editing to Add (Note: I don't think the way someone else did something is always the right way, just wanted to do some digging on how other people have handled this in the past): |
| Comment by Dimitrios Piliouras [ 05/Jul/12 4:13 PM ] |
|
It does make sense NOT to allow a step of zero (at least to me)... I wasn't going to say anything about this but if other popular languages do not allow 0, then I guess it makes more sense than I originally gave myself credit for... However, if we want to be mathematically correct then the answer would be to return an infinte seq with the start value like below. After all, what is a step of 0? does it make any difference how many steps you take if with every step you cover 0 distance? obviously not...you start from x and you stay at x forever...we do have repeat for this sort of thing though... (take 5 (range 3 9 0)) => (3 3 3 3 3) +1 for not allowing 0 step |
| Comment by Mike Anderson [ 08/Jul/12 8:49 AM ] |
|
@Devin quite simple: a lazy sequence of nums starting from x with step 0.0 until it reaches an end value of y (where y > x) is an infinite sequence of x. Consider the case where start is 0 and end is infinity (the default), you would expect sequences to go as follows: step +2 : 0 2 4 6 8.... It would be inconsistent to make 0 a special case, all of these are valid arithmetic progressions. And all of these are consistent with the current docstring. If you make 0 a special case, then people will need to write special case code to handle it. Consider the code to create a multiplication table for example: (for [x (range 10)] This works fine if you produce an infinite sequence of zeros for step 0, but fails if you create an empty list as a special case for step 0. As a related issue, I'd personally also favour negative step sizes also producing an infinite sequence. If we don't want to allow this though, then at least the docstring should be changed to say "a lazy seq of non-decreasing nums" and a negative step should throw an error. |
| Comment by Devin Walters [ 09/Jul/12 7:09 PM ] |
|
Carrying over a message from the clojure-dev list by Stuart Sierra:
yes
not if they have any sense
not me
I doubt it.
Not that I know of.
I doubt it. Lazy seqs are not ideal for high-performance code anyway.
I think the problem is that the result of `range` with a step of 0 was never specified. Don't assume that the tests are specifications. Many of the tests in Clojure were written by over-eager volunteers who defined the tests based on whatever the behavior happened to be. The only specification from the language designer is the docstring. By my reading, that means that `range` with a step of 0 should return an infinite seq of the start value, unless the start and end values are equal. -S |
| Comment by Devin Walters [ 09/Jul/12 7:10 PM ] |
|
Carrying over a message by Michal Marczyk: With a negative step, the comparison is reversed, so that e.g. (range 3 0 -1) evaluates to (3 2 1) I think this is the useful behaviour; the docstring should perhaps be Agreed on zero step. Cheers, |
| Comment by Devin Walters [ 20/Jul/12 5:10 PM ] |
|
Adding a new patch after hearing comments. This patch makes (range 9 3 0) => (9 9 9 9 ...), (range 3 9 0) => (3 3 3 3 ...), and () will be returned when (= start end). Also updated the docstring. |
| Comment by Timothy Baldridge [ 27/Nov/12 3:01 PM ] |
|
Marking as vetted |
| Comment by Timothy Baldridge [ 27/Nov/12 3:04 PM ] |
|
Patch applies cleanly. We've discussed this issue to death (for as simple as it is). I think it's time to mark it as screened. |
| Comment by Timothy Baldridge [ 27/Nov/12 3:06 PM ] |
|
For some reason I'm not allowed to edit the attachments list. When you apply the patch, please apply inconsistent_range_fix.diff as that is the most recent version of the fix. |
| Comment by Rich Hickey [ 09/Dec/12 6:44 AM ] |
|
As someone who has to read these tickets, I'd really appreciate it if you could keep the description up to date and accurate, with examples of the current and intended behavior and the strategy to be used in fixing. I can't follow every thread to see what the latest thinking is, especially on a patch like this where the original mission was changed. Thanks |
| Comment by Devin Walters [ 10/Dec/12 3:53 PM ] |
|
@Tim: I've removed the other attachments. @Rich: Understood. I will update the description this evening. |
[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-124] GC Issue 120: Determine mechanism for controlling automatic shutdown of Agents, with a default policy and mechanism for changing that policy as needed Created: 17/Jun/09 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Chas Emerick |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Approval: | Vetted |
| Waiting On: | Rich Hickey |
| Description |
Reported by cemer...@snowtide.com, Jun 01, 2009 There has been intermittent chatter over the past months from a couple of people on the group (e.g. http://groups.google.com/group/clojure/browse_thread/thread/409054e3542adc1f) and in #clojure about some clojure scripts hanging, either for a constant time (usually reported as a minute or so with no CPU util) or seemingly forever (or until someone kills the process). I just hit a similar situation in our compilation process, which invokes clojure.lang.Compile from ant. The build process for this particular project had taken 15 second or so, but after adding a couple of pmap calls, that build time jumped to ~1:15, with roughly zero CPU utilization over the course of that last minute. Adding a call to Agent.shutdown() in the finally block in clojure.lang.Compile/main resolved the problem; a patch including this change is attached. I wouldn't suspect anyone would have any issues with such a change. ----- In general, it doesn't seem like everyone should keep tripping over this problem in different directions. It's a very difficult thing to debug if you're not attuned to how clojure's concurrency primitives work under the hood, and I would bet that newer users would be particularly affected. After discussion in #clojure, rhickey suggested adding a *auto-shutdown-agents* var, which: - if true when exiting one of the main entry points (clojure.main, or the legacy script/repl entry points), Agent.shutdown() would be called, allowing for the clean exit of the application - would be bound by default to true - could be easily set to false for anyone with an advanced use-case that requires agents to remain active after the main thread of the application exits. This would obviously not help anyone initializing clojure from a different entry point, but this may represent the best compromise between least-surprise and maximal functionality for advanced users. ------ In addition to the above, it perhaps might be worthwhile to change the keepalive values used to create the Threadpools used by c.l.Actor's Executors. Currently, Actor uses a default thread pool executor, which results in a 60s keepalive. Lowering this to something much smaller (1s? 5s?) would additionally minimize the impact of Agent's threadpools on Java applications that embed clojure directly (and would therefore not benefit from *auto-shutdown-agents* as currently conceived, leading to puzzling 'hanging' behaviour). I'm not in a position to determine what impact this would have on performance due to thread churn, but it would at least minimize what would be perceived as undesirable behaviour by users that are less familiar with the implementation details of Agent and code that depends on it. Comment 1 by cemer...@snowtide.com, Jun 01, 2009 Just FYI, I'd be happy to provide patches for either of the suggestions mentioned above... |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/124 |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
oranenj said: [file:a56S2ow4ur3O2PeJe5afGb] |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
cemerick said: (In [[r:fa3d24973fc415b35ae6ec8d84b61ace76bd4133]]) Add a call to Agent.shutdown() at the end of clojure.lang.Compile/main Refs #124 Signed-off-by: Chouser <chouser@n01se.net> Branch: master |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: I'm closing this ticket to because the attached patch solves a specific problem. I agree that the idea of an auto-shutdown-agents var sounds like a positive compromise. If Rich wants a ticket to track that issue, I think it'd be best to open a new ticket (and perhaps mention this one there) rather than use this ticket to track further changes. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
scgilardi said: With both Java 5 and Java 6 on Mac OS X 10.5 Leopard I'm getting an error when compiling with this change present. Java 1.5.0_19 For example, when building clojure using "ant" from within my clone of the clojure repo: [java] java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThread) I reproduced this on two Mac OS X 10.5 machines. I'm not aware of having any enhanced security policies along these lines on my machines. The compile goes fine for me with Java 1.6.0_0 on an Ubuntu box. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: I had only tested it on my ubuntu box – looks like that was openjdk 1.6.0_0. I'll test again with sun-java5 and sun-java6. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: 1.6.0_13 worked fine for me on ubuntu, but 1.5.0_18 generated an the exception Steve pasted. Any suggestions? Should this patch be backed out until someone has a fix? |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
achimpassen said: [file:aqn0IGxZSr3RUGeJe5aVNr] |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: With Achim's patch, clojure compiles for me on ubuntu using java 1.5.0_18 from sun, and still works on 1.6.0_13 sun and 1.6.0_0 openjdk. I don't know anything about ant or the security error, but this is looking good to me. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
achimpassen said: It works for me on 1.6.0_13 and 1.5.0_19 (32 and 64 bit) on OS X 10.5.7. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: (In [[r:895b39dabc17b3fd766fdbac3b0757edb0d4b60d]]) Rev fa3d2497 causes compile to fail on some VMs – back it out. Refs #124 Branch: master |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
mikehinchey said: I got the same compile error on both 1.5.0_11 and 1.6.0_14 on Windows. Achim's patch fixes both. See the note for "permissions" on http://ant.apache.org/manual/CoreTasks/java.html . I assume ThreadPoolExecutor.shutdown is the problem, it would shutdown the main Ant thread, so Ant disallows that. Forking avoids the permissions limitation. In addition, since the build error still resulted in "BUILD SUCCESSFUL", I think failonerror="true" should also be added to the java call so the build would totally fail for such an error. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: I don't know if the <java fork=true> patch is a good idea or not, or if there's a better way to solve the original problem. Chas, I'm kicking back to you, but I guess if you don't want it you can reassign to "nobody". |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
richhickey said: Updating tickets (#8, #42, #113, #2, #20, #94, #96, #104, #119, #124, #127, #149, #162) |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
shoover said: I'd like to suggest an alternate approach. There are already well-defined and intuitive ways to block on agents and futures. Why not deprecate shutdown-agents and force users to call await and deref if they really want to block? In the pmap situation one would have to evaluate the pmap form. The System.exit problem goes away if you configure the threadpools to use daemon threads (call new ThreadPoolExecutor and pass a thread factory that creates threads and sets daemon to true). That way the user has an explicit means of blocking and System.exit won't hang. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
alexdmiller said: I blogged about these issues at: I think that:
|
| Comment by Alexander Taggart [ 11/Jul/11 9:33 PM ] |
|
Rich, what is the intention behind using non-daemon threads in the agent pools? If it is because daemon threads could terminate before their work is complete, would it be acceptable to add a shutdown hook to ensure against such premature termination? Such a shutdown hook could call Agent.shutdown(), then awaitTermination() on the pools. |
| Comment by Christopher Redinger [ 27/Nov/12 3:47 PM ] |
|
Moving this ticket out of approval "OK" status, and dropping the priority. These were Assembla import defaults. Also, Chas gets to be the Reporter now. |
| Comment by Chas Emerick [ 27/Nov/12 5:56 PM ] |
|
Heh, blast from the past. The comment import appears to have set their timestamps to the date of the import, so the conversation is pretty hard to follow, and obviously doesn't benefit from the intervening years of experience. In addition, there have been plenty of changes to agents, including some recent enhancements that address some of the pain points that Alex Miller mentioned above. I propose closing this as 'invalid' or whatever, and opening one or more new issues to track whatever issues still persist (presumably based on fresh ML discussion, etc). |
| Comment by Andy Fingerhut [ 27/Nov/12 6:11 PM ] |
|
Rereading the original description of this ticket, without reading all of the comments that follow, that description is still right on target for the behavior of latest Clojure master today. People send messages to the Clojure Google group every couple of months hitting this issue, and one even filed CLJ-959 because of hitting it. I have updated the examples on ClojureDocs.org for future, and also for pmap and clojure.java.shell/sh which use future in their implementations, to warn people about this and explain that they should call (shutdown-agents), but making it unnecessary to call shutdown-agents would be even better, at least as the default behavior. It sounds fine to me to provide a way for experts on thread behavior to change that default behavior if they need to. |
[CLJ-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-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-1058] StackOverflowError on exception in reducef for PersistentHashMap fold Created: 02/Sep/12 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Tom Jack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Clojure 1.5.0-alpha4, Sun Java 1.6.0_35, with [org.codehaus.jsr166-mirror/jsr166y "1.7.0"] |
||
| Approval: | Vetted |
| Description |
|
If reducef throws an exception, the PHM fold code can descend into an infinite loop, causing a stack overflow which masks the problem. This situation is commented "aargh" in PersistentHashMap.java line 444 (as of 412a51d). To reproduce: user> (require '[clojure.core.reducers :as r])
nil
user> (r/fold (fn ([]) ([ret k v] (+ 3 "foo") ret)) (into {} (map (juxt identity identity) (range 10000))))
;; boom
This results in a stack like: https://raw.github.com/gist/3bab917287a7fd635a84/f38bfe3e270556e467f3fc02062af7ea10781390/gistfile1.txt |
| Comments |
| Comment by Timothy Baldridge [ 30/Nov/12 3:40 PM ] |
|
Verified as a bug. |
[CLJ-1184] Evaling #{do ...} or [do ...] is treated as the do special form Created: 16/Mar/13 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: | Trivial |
| Reporter: | Jiřà MarÅ¡Ãk | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | Compiler, bug | ||
| Approval: | Vetted |
| Description |
|
Evaluating a persistent collection for which the function 'first' returns the symbol 'do' leads to that collection being treated as the do special form, even though it may be a vector or even a set. IMHO, the expected result would be to report that 'do' cannot be resolved. For the cause, see the if condition on line 6604 of Compiler.java in clojure-1.5.1. E.g.: #{"hello" "goodbye" do} |
[CLJ-420] Some compiler exceptions erroneously using REPL line numbers. Created: 08/Aug/10 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Alexander Redington | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but what seems to be the REPL line number. jawolfe@[~/Projects/testproj]: cat > src/test.clj bla (bla) |
| Comments |
| Comment by Assembla Importer [ 28/Sep/10 9:59 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/420 |
| Comment by Assembla Importer [ 28/Sep/10 9:59 PM ] |
|
stu said: Updating tickets (#427, #426, #421, #420, #397) |
| Comment by Assembla Importer [ 28/Sep/10 9:59 PM ] |
|
stu said: Updating tickets (#429, #437, #397, #420) |
[CLJ-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-701] Compiler loses 'loop's return type in some cases Created: 03/Jan/11 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Chouser | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Clojure commit 9052ca1854b7b6202dba21fe2a45183a4534c501, version 1.3.0-master-SNAPSHOT |
||
| Approval: | Vetted |
| Description |
(set! *warn-on-reflection* true)
(fn [] (loop [b 0] (recur (loop [a 1] a))))
Generates the following warnings: recur arg for primitive local: b is not matching primitive, had: Object, needed: long Auto-boxing loop arg: b This is interesting for several reasons. For one, if the arg to recur is a let form, there is no warning: (fn [] (loop [b 0] (recur (let [a 1] a)))) Also, the compiler appears to understand the return type of loop forms just fine: (use '[clojure.contrib.repl-utils :only [expression-info]])
(expression-info '(loop [a 1] a))
;=> {:class long, :primitive? true}
The problem can of course be worked around using an explicit cast on the loop form: (fn [] (loop [b 0] (recur (long (loop [a 1] a)))))
Reported by leafw in IRC: http://clojure-log.n01se.net/date/2011-01-03.html#10:31 |
| Comments |
| Comment by a_strange_guy [ 03/Jan/11 4:36 PM ] |
|
The problem is that a 'loop form gets converted into an anonymous fn that gets called immediately, when the loop is in a expression context (eg. its return value is needed, but not as the return value of a method/fn). so (fn [] (loop [b 0] (recur (loop [a 1] a)))) gets converted into (fn [] (loop [b 0] (recur ((fn [] (loop [a 1] a)))))) see the code in the compiler: this conversion already bites you if you have mutable fields in a deftype and want to 'set! them in a loop |
| Comment by Christophe Grand [ 23/Nov/12 2:28 AM ] |
|
loops in expression context are lifted into fns because else Hotspot doesn't optimize them.
Adressing all those problems isn't easy. [1] beware of |
[CLJ-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-1105] defrecord classes implement IPersistentCollection but not .empty, clojure.walk assumes collections support empty Created: 08/Nov/12 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Jouni K. Seppänen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
Using clojure.walk functions fails surprisingly for data containing records defined with defrecord: user=> (defrecord Foo [x]) This seems to be because clojure.walk/walk guards a call to (empty form) with a (coll? form) check. The check succeeds because records implement IPersistentCollection, but (empty form) throws an exception. This looks to me like a bug in clojure.walk (it should check records separately and either treat them as atomic or implement a way of walking through them) but perhaps it is a sign of some unclarity in the contract of collections. |
| Comments |
| Comment by Nicola Mometto [ 08/Nov/12 2:35 PM ] |
|
maybe clojure should follow clojurescript's footsteps and move empty out of IPersistentCollection and create an |
| Comment by Stuart Halloway [ 25/Nov/12 6:39 PM ] |
|
Can whoever claims this please consider walk's behavior in the face of all different collection types? I think it also fails with Java collections. Also, the collection partitioning code in clojure.data may be of use. |
[CLJ-787] transient blows up when passed a vector created by subvec Created: 03/May/11 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Backlog |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Alexander Redington | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
Subvectors created with subvec from a PersistentVector cannot be made transient: user=> (transient (subvec [1 2 3 4] 2)) ClassCastException clojure.lang.APersistentVector$SubVector cannot be cast to clojure.lang.IEditableCollection clojure.core/transient (core.clj:2864) |
| Comments |
| Comment by Stuart Sierra [ 31/May/11 9:28 AM ] |
|
Confirmed. APersistentVector$SubVector does not implement IEditableCollection. The current implementation of TransientVector depends on implementation details of PersistentVector, so it is not a trivial fix. The simplest fix might be to implement IEditableCollection.asTransient in SubVector by creating a new PersistentVector, but I do not know the performance implications. |
[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-1161] sources jar has bad versions.properties resource Created: 11/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: | Release 1.5, Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Steve Miner | Assignee: | Stuart Sierra |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | patch | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
The "sources" jar (at least since Clojure 1.4 and including 1.5 RC) has a bad version.properties file in it. The resource clojure/version.properties is literally: version=${version} The regular Clojure jar has the correct version string in that resource. I came across a problem when I was experimenting with the sources jar (as used by IDEs). I naively added the sources jar to my classpath, and Clojure died on start up. The bad clojure/versions.properties file was found first, which led to a parse error as the clojure version was being set. |
| Comments |
| Comment by Steve Miner [ 11/Feb/13 10:04 AM ] |
|
Notes from the dev mailing list: The "sources" JAR is generated by another Maven plugin, configured here: The simplest solution might be to just exclude the file from the sources jar. It looks like maven-source-plugin has an excludes option which would do the trick: http://maven.apache.org/plugins/maven-source-plugin/jar-mojo.html#excludes |
[CLJ-1154] Compile.java closes out preventing java from reporting exceptions Created: 31/Jan/13 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | Release 1.5, Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Robert (Bobby) Evans | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
I was trying to compile a project that has some native dependencies. I am using clojure-maven-plugin version 1.3.13 with Maven 2.0. I forgot to set java.library.path properly so that the native library could be found, and only got an error of [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Clojure failed. [INFO] ------------------------------------------------------------------------ I traced this down to Compile.java, where it is flushing and closing out |
| Comments |
| Comment by Stuart Halloway [ 01/Mar/13 10:45 AM ] |
|
I have encountered this problem as well. Did not verify the explanation, but sounds reasonable. |
[CLJ-823] Piping seque into seque can deadlock Created: 03/Aug/11 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Greg Chapman | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Windows 7; JVM 1.6; Clojure 1.3 beta 1 |
||
| Approval: | Vetted |
| Description |
|
I'm not sure if this is a supported scenario, but the following deadlocks in Clojure 1.3: (let [xs (seque (range 150000)) As I understand it, the problem is that ys' fill takes place on an agent thread, so when it calls xs' drain, the (send-off agt fill) does not immediately trigger xs' fill, but is instead put on the nested list to be performed when ys' agent returns. Unfortunately, ys' fill will eventually block trying to take from xs, and so it never returns and the pending send-offs are never sent. Wrapping the send-off in drain to: (future (send-off agt fill)) is a simple (probably not optimal) way to fix the deadlock. |
| Comments |
| Comment by Peter Monks [ 07/Jan/13 3:43 PM ] |
|
Reproduced on 1.4.0 and 1.5.0-RC1 as well, albeit with this example: (seque 3 (seque 3 (range 10))) |
| Comment by Stuart Halloway [ 30/Mar/13 9:16 AM ] |
|
release-pending-sends? |
[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-1072] Replace old metadata reader macro syntax Created: 21/Sep/12 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Sam Aaron | Assignee: | Stuart Sierra |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Ok |
| Description |
|
5 files still have old metadata reader syntax hash-caret instead of just caret: src/clj/clojure/core.clj |
| Comments |
| Comment by Stuart Sierra [ 21/Sep/12 7:56 AM ] |
|
Modified this ticket to cover all remaining cases of old metadata syntax. Added patch. |
[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-1195] emit-hinted-impl expands to non-ns-qualified invocation of 'fn' Created: 09/Apr/13 Updated: 09/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Jason Wolfe | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Mac os X Clojure 1.5.1 |
||
| Description |
|
(ns plumbing.tmp (defprotocol Foo (extend-protocol Foo yields CompilerException java.lang.RuntimeException: Unable to resolve symbol: fn in this context, compiling This makes it difficult to construct a namespace that provides a replacement def for fn. |
[CLJ-1053] Locals still cleared too aggressively on delay in specific cases Created: 30/Aug/12 Updated: 09/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Jean Niklas L'orange | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
This seems to be an extension of #CLJ-232. Locals are still cleared too aggressively in some specific instances: If the delay throws an exception when realized, and you dereference a local within the delay, the local may or may not be cleared depending on its need in the tail positions (without any obvious pattern). Examples of functions which works as intended and doesn't work as intended follows. (def d (let [y (delay 0)]
(delay (if (zero? @y) (/ 0 0) (/ @y 1))))) ; works properly
(def d (let [y (delay 0)]
(delay (if (zero? @y) (/ 0 0) (/ 1 1))))) ; does not work properly
(def d (let [y (delay 0)]
(delay (if (zero? @y) (/ @y 0) (/ 1 1))))) ; does not work properly
(def d (let [y (delay 0)]
(delay (if (zero? @y) (/ @y 0) (/ @y 1))))) ; does not work properly
(def d (let [y (delay 0)]
(delay @y (/ 0 0)))) ; does not work properly
(def d (let [y (delay 0)]
(delay @y (/ 0 0) @y))) ; works properly
By "works", d will throw "ArithmeticException Divide by zero" every single time it is dereferenced. By "does not work", d will throw "ArithmeticException Divide by zero" on first dereferencing, but from second and onwards it will throw "NullPointerException [trace missing]". |
| Comments |
| Comment by Jean Niklas L'orange [ 09/Apr/13 11:55 AM ] |
|
With Clojure 1.5.1, the trace is given and returns NullPointerException clojure.core/deref-future (core.clj:2NullPointerException clojure.core/deref-future (core.clj:2108)108), which refers to a .get call. The stacktrace reveals the following: NullPointerException clojure.core/deref-future (core.clj:2108) clojure.core/deref (core.clj:2129) user/fn--1/fn--4 (NO_SOURCE_FILE:2) clojure.lang.Delay.deref (Delay.java:33) clojure.core/deref (core.clj:2128) user/eval13 (NO_SOURCE_FILE:-1) clojure.lang.Compiler.eval (Compiler.java:6619) clojure.lang.Compiler.eval (Compiler.java:6582) clojure.core/eval (core.clj:2852) clojure.main/repl/read-eval-print--6588/fn--6591 (main.clj:259) clojure.main/repl/read-eval-print--6588 (main.clj:259) clojure.main/repl/fn--6597 (main.clj:277) |
[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-1192] vec function is substantially slower than into function Created: 06/Apr/13 Updated: 07/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Luke VanderHart | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
(vec coll) and (into [] coll) do exactly the same thing. However, due to into using transients, it is substantially faster. On my machine: (time (dotimes [_ 100] (vec (range 100000)))) (time (dotimes [_ 100] (into [] (range 100000)))) This is consistently repeatable. Since vec's sole purpose is to transform collections into vectors, it should do so at the maximum speed available. |
| Comments |
| Comment by Andy Fingerhut [ 07/Apr/13 5:50 PM ] |
|
I am pretty sure that Clojure 1.5.1 also uses transient vectors for (vec (range n)) (probably also some earlier versions of Clojure, too). Look at vec in core.clj. It checks whether its arg is a java.util.Collection, which lazy seqs are, so calls (clojure.lang.LazilyPersistentVector/create coll). LazilyPersistentVector's create method checks whether its argument is an ISeq, which lazy seqs are, so it calls PersistentVector.create(RT.seq(coll)). All 3 of PersistentVector's create() methods use transient vectors to build up the result. I suspect the difference in run times are not because of transients or not, but because of the way into uses reduce, and perhaps may also have something to do with the perhaps-unnecessary call to RT.seq in LazilyPersistentVector's create method (in this case, at least – it is likely needed for other types of arguments). |
[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-1190] Javadoc for public Java API Created: 03/Apr/13 Updated: 03/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stuart Halloway | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
We should publish javadoc for http://dev.clojure.org/jira/browse/CLJ-1188.
This ticket should wait until |
[CLJ-1189] Map-destructuring :or fumble needs compiler warning Created: 31/Mar/13 Updated: 31/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Phill Wolf | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Here is a map-destructuring blunder that I wish the compiler warned about: (defn server It would be splendid to get a warning that :or keys that are not symbols being bound have no effect. The incomplete code snippet above comes from Pedestal.service 0.1.0. Here is a complete one-line example with the coding error: user> (defn picnic [{botulism :botulism :or {:botulism 6}}] botulism) |
[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-1172] Cross-linking between clojure.lang.Compiler and clojure.lang.RT Created: 28/Feb/13 Updated: 23/Mar/13 |
|
| Status: | Reopened |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Yegor Bugayenko | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
version 1.5.0-RC17 |
||
| Description |
|
This is my code (an example): import clojure.lang.Compiler;
import clojure.lang.RT;
import clojure.lang.Var;
Compiler.load("(+ 5 %)");
Var foo = RT.var("bar", "foo");
Object result = foo.invoke(10);
assert result.toString().equals("15");
This is what I'm getting: ava.lang.ExceptionInInitializerError at clojure.lang.Compiler.<clinit>(Compiler.java:47) at foo.main(Main.java:75) Caused by: java.lang.NullPointerException at clojure.lang.RT.baseLoader(RT.java:2043) at clojure.lang.RT.load(RT.java:417) at clojure.lang.RT.load(RT.java:411) at clojure.lang.RT.doInit(RT.java:447) at clojure.lang.RT.<clinit>(RT.java:329) ... 36 more The same code worked just fine with version 1.4. Looks like Compiler is using RT and RT is using Compiler, both statically. |
| Comments |
| Comment by Yegor Bugayenko [ 04/Mar/13 11:40 AM ] |
|
I cross-posted this question to SO: http://stackoverflow.com/questions/15207596 |
| Comment by Yegor Bugayenko [ 05/Mar/13 12:04 AM ] |
|
calling RT.init() before Compiler.load() solves the problem |
| Comment by Andy Fingerhut [ 05/Mar/13 4:17 AM ] |
|
Yegor, do you consider it OK to close this ticket as not being a problem, or at least one with a reasonable workaround? |
| Comment by Yegor Bugayenko [ 05/Mar/13 1:11 PM ] |
|
Yes, of course. Let's close it. |
| Comment by Andy Fingerhut [ 05/Mar/13 6:14 PM ] |
|
Ticket submitter agrees that this is not an issue, or that there is a reasonable workaround. |
| Comment by Andy Fingerhut [ 13/Mar/13 12:58 AM ] |
|
This issue came up again on the Clojure group. https://groups.google.com/forum/?hl=en_US&fromgroups=#!topic/clojure/2xdLNMb9yyQ I did some testing, and the issue did not exist in Clojure 1.5.0-RC3 and before, and it has existed since 1.5.0-RC4. There was only one commit between those two points: https://github.com/clojure/clojure/commit/9b80a552fdabeabdd93951a625b55ae49c2f8d83 Maybe this new behavior is an intended consequence of that change. I don't know. In any case, it seems like perhaps the "No need to call RT.init() anymore" message might be outdated? |
| Comment by Andy Fingerhut [ 13/Mar/13 12:59 AM ] |
|
Reopening since it came up again, and there is some more info known about the issue. I'll let someone who knows more about the issue decide whether to close it. |
| Comment by Edward [ 23/Mar/13 10:31 AM ] |
|
Doing this RT.load("clojure/core"); at the top works avoids the message from RT.init() |
[CLJ-1181] clojure.pprint/code-dispatch breaks on certain types of anonymous functions Created: 10/Mar/13 Updated: 18/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Devin Walters | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
(with-out-str
(with-pprint-dispatch code-dispatch
(pp/pprint (read-string "(fn* [x] x)"))))
breaks because the format string here: https://github.com/clojure/clojure/blob/master/src/clj/clojure/pprint/dispatch.clj#L378 expects a sequence. In the case of (fn* [x] x) it is passed a symbol. |
| Comments |
| Comment by Jean Niklas L'orange [ 18/Mar/13 5:40 PM ] |
|
I think the main "issue" here resides within the undocumented functionality of fn*. (fn* [x] x) is a semantically working function, but (fn [x] x) expands into (fn* ([x] x)). Anonymous function literals expand into (fn* [gensyms] (...)), and as such, it also accepts expressions like (fn* [x] x). Should pprint pretty print expressions which has used fn* directly, or should it "just" ignore it? |
[CLJ-250] debug builds Created: 27/Jan/10 Updated: 14/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stuart Halloway | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Incomplete |
| Waiting On: | Rich Hickey |
| Description |
|
This ticket includes two patches:
Things to consider before approving these patches:
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:05 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/250 |
| Comment by Stuart Halloway [ 07/Dec/10 8:23 PM ] |
|
Ignore the old patches. Considering the following implementation, please review and then move ticket to waiting on Stu:
|
| Comment by Rich Hickey [ 08/Dec/10 11:00 AM ] |
|
#3 - root bound only #6 - my biggest reservation is that this isn't yet informed by maven best practices |
| Comment by Stuart Sierra [ 08/Dec/10 2:09 PM ] |
|
System properties can be passed through Maven, so I do not anticipate this being a problem. However, I would prefer *assert* to remain true by default. |
| Comment by Chas Emerick [ 09/Dec/10 7:19 AM ] |
|
SS is correct about this approach not posing any issue for Maven. In addition, the build could easily be set up to always emit two jars, one "normal", one "debug". I'd suggest that, while clojure.debug might have broad effect, additional properties should be available to provide fine-grained control over each of the additional "debug"-related parameterizations that might become available in the future. I'd like to raise a couple of potentially tangential concerns (after now thinking about assertions for a bit in the above context), some or all of which may simply be a result of my lack of understanding in various areas. Looking at where assert is used in core.clj (only two places AFAICT: validating arguments to derive and checking pre- and post-conditions in fn), it would seem unwise to make it false by default. i.e. non-Named values would be able to get into hierarchies, and pre- and post-conditions would simply be ignored. It's my understanding that assertions (talking here of the JVM construct, from which Clojure reuses AssertionError) should not be used to validate arguments to public API functions, or used to validate any aspect of a function's normal operation (i.e. "where not to use assertions"). That would imply that derive should throw IllegalArugmentException when necessary, and fn pre- and post-conditions should perhaps throw IllegalStateException – or, in any case, something other than AssertionError via assert. This would match up far better with most functions in core using assert-args rather than assert, the former throwing IllegalArgumentException rather than AssertionError. That leads me to the question: is assert (and *assert*) intended to be a Clojure construct, or a quasi-interop form? If the former, then it can roughly have whatever semantics we want, but then it seems like it should not be throwing AssertionError. If the latter, then AssertionError is appropriate on the JVM, but then we need to take care that assertions can be enabled and disabled at runtime (without having to switch around different builds of Clojure), ideally using the host-defined switches (e.g. -ea and friends) and likely not anything like *assert*. I don't know if this is possible or practical at this point (I presume this would require nontrivial compiler changes). Hopefully the above is not water under the bridge at this point. Thank you in advance for your forbearance. |
| Comment by Rich Hickey [ 09/Dec/10 8:08 AM ] |
|
Thanks for the useful input Chas. Nothing is concluded yet. I think we should step back and look at the objective here, before moving forward with a solution. Being a dynamic language, there are many things we might want to validate about our programs, where the cost of checking is something we are unwilling to pay in production. Being a macro, assert has the nice property that, should *assert* not be true during compilation, it generates nil, no conditional test at all. Thus right now it is more like static conditional compilation. Java assert does have runtime toggle-ability, via -ea as you say. I haven't looked at the bytecode generated for Java asserts, but it might be possible for Clojure assert to do something similar, if the runtime overhead is negligible. It is quite likely that HotSpot has special code for eliding the assertion bytecode given a single check of some flag. I'm just not sure that flag is Class.desiredAssertionStatus. Whether this turns into changes in assert or pre/post conditions, best practices etc is orthogonal and derived. Currently we don't have a facility to run without the checks. We need to choose between making them disappear during compilation (debug build) or runtime (track -ea) or both. Then we can look at how that is reflected in assert/pre-post and re-examine existing use of both. The "where not to use assertions" doc deals with them categorically, but in not considering their cost, seems unrealistic IMO. I'd appreciate it if someone could look into how assert is generated and optimized by Java itself. |
| Comment by Chas Emerick [ 09/Dec/10 5:04 PM ] |
|
Bytecode issues continue to be above my pay grade, unfortunately… A few additional thoughts in response that you may or may not be juggling already: assert being a macro makes total sense for what it's doing. Trouble is, "compile-time" is a tricky concept in Clojure: there's code-loading-time, AOT-compile-time, and transitively-AOT-compile-time. Given that, it's entirely possible for an application deployed to a production environment that contains a patchwork of code or no code produced by assert usages in various libraries and namespaces depending upon when those libs and ns' were loaded, AOT-compiled, or their dependents AOT-compiled, and the value of *assert* at each of those times. Of course, this is the case for all such macros whose results are dependent upon context-dependent state (I think this was a big issue with clojure.contrib.logging, making it only usable with log4j for a while). What's really attractive about the JVM assertion mechanism is that it can be parameterized for a given runtime on a per-package basis, if desired. Reimplementing that concept so that assert can be *ns*-sensitive seems like it'd be straightforward, but the compile-time complexity already mentioned remains, and the idea of having two independently-controlled assertion facilities doesn't sound fun. I know nearly nothing about the CLR, but it would appear that it doesn't provide for anything like runtime-controllable assertions. |
| Comment by Stuart Halloway [ 29/Dec/10 3:17 PM ] |
|
The best (dated) evidence I could find says that the compiler sets a special class static final field $assertionsDisabled based on the return of desiredAssertionStatus. HotSpot doesn't do anything special with this, dead code elimination simply makes it go away. The code indeed compiles this way: 11: getstatic #6; //Field $assertionsDisabled:Z Even if we were 100% sure that assertion removal was total, I would still vote for a separate Clojure-level switch, for the following reasons:
Rich: awaiting your blessing to move forward on this. |
| Comment by Rich Hickey [ 07/Jan/11 9:42 AM ] |
|
The compiler sets $assertionsDisabled when, in static init code? Is there special support in the classloader for it? Is there a link to the best dated evidence you found? |
| Comment by Stuart Halloway [ 07/Jan/11 9:51 AM ] |
|
| Comment by Stuart Halloway [ 07/Jan/11 9:57 AM ] |
|
Link: Google "java assert shirazi". (Not posting link because I can't tell in 10 secs whether it includes my session information.) |
| Comment by Alexander Kiel [ 14/Mar/13 1:28 PM ] |
|
Is there anything new on this issue? I also look for a convenient way to disable assertions in production. |
[CLJ-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-15] GC Issue 11: incremental hashcode calculation for collections Created: 17/Jun/09 Updated: 08/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by richhickey, Dec 17, 2008
So hachCode can be final, more efficient to calc as you go.
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:44 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/15 |
| Comment by Christophe Grand [ 08/Mar/13 6:20 AM ] |
|
Wouldn't the naive approach incur realizing lazy sequences when adding them to a list or a vector or as values in a map? |
[CLJ-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-348] reify allows use of qualified name as method parameter Created: 13/May/10 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
This should complain about using a fully-qualified name as a parameter: (defmacro lookup [] Instead it simply ignores that parameter in the method body in favour of clojure.core/key. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 8:03 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/348 |
| Comment by Assembla Importer [ 24/Aug/10 8:03 AM ] |
|
technomancy said: [file:d2xUJIxTyr36fseJe5cbLA]: A test to expose the unwanted behaviour |
| Comment by Assembla Importer [ 24/Aug/10 8:03 AM ] |
|
richhickey said: I'm not sure the bug is what you say it is, or the resolution should be what you suggest. The true problem is the resolution of key when qualified. Another possibility is to ignore the qualifier there. |
| Comment by Assembla Importer [ 24/Aug/10 8:03 AM ] |
|
technomancy said: Interesting. So it's not appropriate to require auto-gensym here? Why are the rules different for reify methods vs proxy methods? > (defmacro lookup [] Can't use qualified name as parameter: clojure.core/key |
[CLJ-1162] Error Message when calling deref on a non-IDeref is unhelpful Created: 12/Feb/13 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: | Julian Birch | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Found this on ubuntu, lein 2, Clojure 1.5 snapshot, but it's obvious from inspection |
||
| Description |
|
If you just type "@1" is the repl, on previous versions you'll get an error that Long cannot be cast to IDeref. In 1.5, the error message is that it cannot be cast to java.util.concurrent.Future. This is because it assumes that anything that isn't an IDeref is automatically a Future. The deref method should generate a custom error stating that the type you've passed in is neither an IDeref nor a Future. |
[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-1167] repl value of *file* is "NO_SOURCE_PATH", of *source-path* is "NO_SOURCE_FILE" Created: 19/Feb/13 Updated: 19/Feb/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Brian Marick | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Comments |
| Comment by Brian Marick [ 19/Feb/13 4:22 PM ] |
|
Forgot to mention: I think it's intended to be the other way around, given the names. |
[CLJ-1138] data-reader returning nil causes exception Created: 22/Dec/12 Updated: 14/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: | Minor |
| Reporter: | Steve Miner | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | reader | ||
| Environment: |
clojure 1.5 beta2, Mac OS X 10.8.2, java version "1.6.0_37" |
||
| Description |
|
If a data-reader returns nil, the reader throws java.lang.RuntimeException: No dispatch macro... The error message implies that there is no dispatch macro for whatever the first character of the tag happens to be. Here's a simple example: (binding [*data-readers* {'f/ignore (constantly nil)}] (read-string "#f/ignore 42 10")) RuntimeException No dispatch macro for: f clojure.lang.Util.runtimeException (Util.java:219) |
| Comments |
| Comment by Steve Miner [ 22/Dec/12 9:43 AM ] |
|
clj-1138-allow-data-reader-to-return-nil-instead-of-throwing.patch allows a data-reader to return nil instead of throwing. Does sanity check that possible tag or record isJavaIdentifierStart(). Gives better error message for special characters that might actually be dispatch macros (rather than assuming it's a tagged literal). |
| Comment by Steve Miner [ 22/Dec/12 10:06 AM ] |
|
clj-1138-data-reader-return-nil-for-no-op.patch allows a data-reader returning nil to be treated as a no-op by the reader (like #_). nil is not normally a useful value (actually it causes an exception in Clojure 1.4 through 1.5 beta2) for a data-reader to return. With this patch, one could get something like a conditional feature reader using data-readers. |
| Comment by Steve Miner [ 22/Dec/12 10:26 AM ] |
|
clj-1138-allow-data-reader-to-return-nil-instead-of-throwing.patch is the first patch to consider. It merely allows nil as a value from a data-reader and returns nil as the final value. I think it does what was originally intended for dispatch macros, and gives a better error message in many cases (mostly typos). The second patch, clj-1138-data-reader-return-nil-for-no-op.patch, depends on the other being applied first. It takes an extra step to treat a nil value returned from a data-reader as a no-op for the reader (like #_). |
| Comment by Steve Miner [ 23/Dec/12 11:52 AM ] |
|
It turns out that you can work around the original problem by having your data-reader return '(quote nil) instead of plain nil. That expression conveniently evaluates to nil so you can get a nil if necessary. This also works after applying the patches so there's still a way to return nil if you really want it. (binding [*data-readers* {'x/nil (constantly '(quote nil))}] (read-string "#x/nil 42")) |
| Comment by Andy Fingerhut [ 07/Feb/13 9:20 AM ] |
|
Patch clj-1138-allow-data-reader-to-return-nil-instead-of-throwing.patch dated Dec 22 2012 still applies cleanly to latest master if you use the following command: % git am --keep-cr -s --ignore-whitespace < clj-1138-allow-data-reader-to-return-nil-instead-of-throwing.patch Without the --ignore-whitespace option, the patch fails only because some whitespace was changed in Clojure master recently. |
| Comment by Andy Fingerhut [ 13/Feb/13 11:24 AM ] |
|
OK, now with latest master (1.5.0-RC15 at this time), patch clj-1138-allow-data-reader-to-return-nil-instead-of-throwing.patch no longer applies cleanly, not even using --ignore-whitespace in the 'git am' command given above. Steve, if you could see what needs to be updated, that would be great. Using the patch command as suggested in the "Updating stale patches" section of http://dev.clojure.org/display/design/JIRA+workflow wasn't enough, so it should probably be carefully examined by hand to see what needs updating. |
| Comment by Steve Miner [ 14/Feb/13 12:21 PM ] |
|
I removed my patches. Things have changes recently with the LispReader and new EdnReader. |
[CLJ-1100] Reader literals cannot contain periods Created: 02/Nov/12 Updated: 14/Feb/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Kevin Lynagh | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | reader | ||
| Approval: | Vetted |
| Description |
|
The LispReader tries to read a record instead of a literal if the tag contains periods: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1171 Which effectively means that reader tags cannot contain periods.
(issue opened: https://github.com/edn-format/edn/issues/39) If periods are allowed, then the LispReader should first check to see if the tag is in *data-readers* and only then if not try to initialize a Java class. I'm happy to write the patch if this behavior is what is desired. |
| Comments |
| Comment by Steve Miner [ 06/Nov/12 9:41 AM ] |
|
The suggested patch (clj-1100-reader-literal-periods.patch) will break reading records when *default-data-reader-fn* is set. Try adding a test like this: (deftest tags-containing-periods-with-default ;; we need a predefined record for this test so we (mis)use clojure.reflect.Field for convenience (let [v "#clojure.reflect.Field{:name \"fake\" :type :fake :declaring-class \"Fake\" :flags nil}"] (binding [*default-data-reader-fn* nil] (is (= (read-string v) #clojure.reflect.Field{:name "fake" :type :fake :declaring-class "Fake" :flags nil}))) (binding [*default-data-reader-fn* (fn [tag val] (assoc val :meaning 42))] (is (= (read-string v) #clojure.reflect.Field{:name "fake" :type :fake :declaring-class "Fake" :flags nil}))))) |
| Comment by Rich Hickey [ 29/Nov/12 9:36 AM ] |
|
The problem assessment is ok, but the resolution approach may not be. What happens should be based not upon what is in data-readers but whether or not the name names a class. Is the intent here to allow readers to circumvent records? I'm not in favor of that. |
| Comment by Steve Miner [ 29/Nov/12 4:01 PM ] |
|
New patch following Rich's comments. The decision to read a record is now based on the symbol containing periods and not having a namespace. Otherwise, it is considered a data reader tag. User |
| Comment by Steve Miner [ 29/Nov/12 4:17 PM ] |
|
I deleted my old patch and some comments referring to it to avoid confusion. In Clojure 1.5 beta 1, # followed by a qualified symbol with a period in the name is considered a record and causes an exception for the missing record class. With the patch, only non-qualified symbols containing periods are considered records. That allows user-defined qualified symbols with periods in their names to be used as data reader tags. |
| Comment by Andy Fingerhut [ 07/Feb/13 9:05 AM ] |
|
clj-1100-periods-in-data-reader-tags-patch-v2.txt dated Feb 7 2013 is identical to CLJ-1100-periods-in-data-reader-tags.patch dated Nov 29 2012, except it applies cleanly to latest master. The only change appears to be in some white space in the context lines. |
| Comment by Andy Fingerhut [ 07/Feb/13 12:53 PM ] |
|
I've removed clj-1100-periods-in-data-reader-tags-patch-v2.txt mentioned in the previous comment, because I learned that CLJ-1100-periods-in-data-reader-tags.patch dated Nov 29 2012 applies cleanly to latest master and passes all tests if you use this command to apply it. % git am --keep-cr -s --ignore-whitespace < CLJ-1100-periods-in-data-reader-tags.patch I've already updated the JIRA workflow and screening patches wiki pages to mention this --ignore-whitespace option. |
| Comment by Andy Fingerhut [ 13/Feb/13 11:31 AM ] |
|
Both of the current patches, CLJ-1100-periods-in-data-reader-tags.patch dated Nov 29 2012, and clj-1100-reader-literal-periods.patch dated Nov 6 2012, fail to apply cleanly to latest master (1.5.0-RC15) as of today, although they did last week. Given all of the changes around read / read-string and edn recently, they should probably be evaluated by their authors to see how they should be updated. |
| Comment by Steve Miner [ 14/Feb/13 12:23 PM ] |
|
I deleted my patch: CLJ-1100-periods-in-data-reader-tags.patch. clj-1100-reader-literal-periods.patch is clearly wrong, but the original author or an administrator has to delete that. |
| Comment by Kevin Lynagh [ 14/Feb/13 1:28 PM ] |
|
I cannot figure out how to remove my attachment (clj-1100-reader-literal-periods.patch) in JIRA. |
| Comment by Steve Miner [ 14/Feb/13 1:43 PM ] |
|
Downarrow (popup) menu to the right of the "Attachments" section. Choose "manager attachments". |
| Comment by Kevin Lynagh [ 14/Feb/13 2:02 PM ] |
|
Great, thanks Steve. Are you going to take another pass at this issue, or should I give it a go? |
| Comment by Steve Miner [ 14/Feb/13 3:04 PM ] |
|
Kevin, I'm not planning to work on this right now as 1.5 is pretty much done. It might be worthwhile discussing the issue a bit on the dev mailing list before working on a patch, but that's up to you. I think my approach was correct, although now changes would have to be applied to both LispReader and EdnReader. |
[CLJ-771] Move unchecked-prim casts to clojure.unchecked Created: 07/Apr/11 Updated: 13/Feb/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Backlog |
| Fix Version/s: | Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Alexander Taggart | Assignee: | Alexander Taggart |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Incomplete |
| Waiting On: | Rich Hickey |
| Description |
|
Per Rich's comment in
|
| Comments |
| Comment by Alexander Taggart [ 29/Apr/11 3:41 PM ] |
|
Requires that patch on |
| Comment by Stuart Sierra [ 31/May/11 10:43 AM ] |
|
Applies on master as of commit 66a88de9408e93cf2b0d73382e662624a54c6c86 |
| Comment by Rich Hickey [ 09/Dec/11 8:40 AM ] |
|
still considering when to incorporate this |
| Comment by John Szakmeister [ 19/May/12 9:36 AM ] |
|
v2 of the patch applies to master as of commit eccde24c7fb63679f00c64b3c70c03956f0ce2c3 |
| Comment by Andy Fingerhut [ 07/Sep/12 12:40 AM ] |
|
Patch clj-771-move-unchecked-casts-patch-v3.txt dated Sep 6 2012 is the same as Alexander Taggart's patch move-unchecked-casts.patch except that it has been updated to apply cleanly to latest Clojure master. |
| Comment by Andy Fingerhut [ 20/Oct/12 12:18 PM ] |
|
Patch clj-771-move-unchecked-casts-patch-v4.txt dated Oct 20 2012 is the same as Alexander Taggart's patch move-unchecked-casts.patch except that it has been updated to apply cleanly to latest Clojure master. |
| Comment by Andy Fingerhut [ 01/Jan/13 11:37 AM ] |
|
The patch clj-771-move-unchecked-casts-patch-v4.txt applies cleanly to latest master and passes all tests. Rich marked this ticket as Incomplete on Dec 9 2011 with the comment "still considering when to incorporate this" above. Is it reasonable to change it back to Vetted or Screened so it can be considered again, perhaps after Release 1.5 is made? |
| Comment by Andy Fingerhut [ 13/Feb/13 12:50 AM ] |
|
Patch clj-771-move-unchecked-casts-patch-v5.txt dated Feb 12 2013 is the same as Alexander Taggart's patch move-unchecked-casts.patch except that it has been updated to apply cleanly to latest Clojure master. |
[CLJ-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 |