[CLJ-1001] Proxy cannot call proper super-class method Created: 23/May/12 Updated: 23/May/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2, Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Guanpeng Xu | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux herberteuler 3.2.0-2-amd64 #1 SMP Sat May 12 23:08:28 UTC 2012 x86_64 GNU/Linux |
||
| Attachments: |
|
| Description |
|
Attached is a program that reproduces this issue. We have a proxy, `p', which sub-classes java.io.InputStream. There are three methods named `read' in java.io.InputStream: abstract int read(); int read(byte[] b); and int read(byte[] b, int off, int len); see http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html. In the definition of proxy `p', we implement the abstract variant of method `read', making `p' a concrete instance of java.io.InputStream. The first invocation, (. p read), returns -1, which is expected. The second invocation, (. p (read b 0 n)), should call int read(byte[] b, int off, int len); in java.io.InputStream. But these are actual behavior: $ clojure1.2 ~/tmp/proxy-bug.clj $ clojure1.2 ~/tmp/proxy-bug.clj |
| Comments |
| Comment by Guanpeng Xu [ 23/May/12 10:24 PM ] |
|
The second behavior should be in Clojure 1.3: $ clojure1.3 ~/tmp/proxy-bug.clj Sorry for the inconvenience. |
[CLJ-740] Unnecessary boxing of primitives in case form Created: 17/Feb/11 Updated: 01/Mar/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Mikhail Kryshen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Found this while profiling some performance-critical code. Consider the following Clojure function: (defn test-case ^double [^long i ^double d1 ^double d2] (case (int i) 0 d1 d2)) Current Clojure 1.3 snapshot compiles it to: public final double invokePrim(long, double, double) throws java.lang.Exception; Code: 0: lload_1 1: invokestatic #67; //Method clojure/lang/RT.intCast:(J)I 4: istore 7 6: iload 7 8: i2l 9: invokestatic #73; //Method clojure/lang/Numbers.num:(J)Ljava/lang/Number; 12: invokestatic #79; //Method clojure/lang/Util.hash:(Ljava/lang/Object;)I 15: iconst_0 16: ishr 17: iconst_1 18: iand 19: tableswitch{ //0 to 0 0: 36; default: 58 } 36: iload 7 38: i2l 39: invokestatic #73; //Method clojure/lang/Numbers.num:(J)Ljava/lang/Number; 42: getstatic #45; //Field const__3:Ljava/lang/Object; 45: invokestatic #83; //Method clojure/lang/Util.equals:(Ljava/lang/Object;Ljava/lang/Object;)Z 48: ifeq 58 51: dload_3 52: invokestatic #88; //Method java/lang/Double.valueOf:(D)Ljava/lang/Double; 55: goto 63 58: dload 5 60: invokestatic #88; //Method java/lang/Double.valueOf:(D)Ljava/lang/Double; 63: checkcast #92; //class java/lang/Number 66: invokevirtual #96; //Method java/lang/Number.doubleValue:()D 69: dreturn } This bytecode contains boxing of primitives (calls to clojure/lang/Numbers.num and java/lang/Double.valueOf) and calls to clojure/lang/Util.hash and clojure/lang/Util.equals that does not seem necessary. At 60-66 primitive double is boxed into Double only to be converted back into primitive. The equivalent Java code compiles to much simpler and faster bytecode: public double testCase(long, double, double); Code: 0: lload_1 1: l2i 2: lookupswitch{ //1 0: 20; default: 22 } 20: dload_3 21: dreturn 22: dload 5 24: dreturn } |
| Comments |
| Comment by Alexander Taggart [ 28/Feb/11 2:16 PM ] |
|
Improved via patch on (defn test-case ^double [^long i ^double d1 ^double d2]
(case (int i)
0 d1
d2))
now emits as 0 lload_1 [i]
1 invokestatic clojure.lang.RT.intCast(long) : int [67]
4 istore 7 [G__7903] // let-bound expression
6 iload 7 [G__7903]
8 tableswitch default: 32
case 0: 28
28 dload_3 [d2]
29 goto 34
32 dload 5 [arg2]
34 dreturn
or if the int cast of the expression is omitted: 0 lload_1 [i]
1 lstore 7 [G__7903] // let-bound expression
3 lload 7 [G__7903]
5 l2i
6 tableswitch default: 35
case 0: 24
24 lconst_0 // match, verify long expr wasn't truncated
25 lload 7 [G__7903]
27 lcmp
28 ifne 35
31 dload_3 [d2]
32 goto 37
35 dload 5 [arg2]
37 dreturn
|
[CLJ-760] ClassNotFound when AOT compiling a self-referring deftype extended to a protocol Created: 18/Mar/11 Updated: 18/Mar/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Ryan Senior | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Clojure 1.2.0, 1.2.1, 1.3.0-alpha6, JDK 1.6.0_24, Ubuntu 10.10 |
||
| Attachments: |
|
| Description |
|
If I create a deftype that refers to itself in a protocol extension like below: (ns type-test)
(defprotocol Foo
(isa-foo [x]))
(deftype TypeTest []
Foo
(isa-foo [x]
(instance? TypeTest x)))
And use that code via another namespace: (ns test-type-user (:use [type-test :only (isa-foo)]) (:import [type-test TypeTest])) (isa-foo (TypeTest.)) When I try to AOT compile the test-type-user namespace with Clojure 1.2.0, I get java.lang.NoClassDefFoundError: compilestub/type-test/TypeTest (test_type_user.clj:5). Full stack trace attached. Running the same code on 1.2.1 and 1.3.0-alpha6 yielded the same exception with a slightly different error message (stacktrace for 1.2.1 is also in the attached file). This came up in a test at Revelytix. We worked around this issue by not using instance? and instead comparing based on class name. Another workaround is to define the deftype and the extension separately (using extend-type or something similar). This problem also doesn't occur if the usage of the deftype and the definition of it are in the same namespace (i.e. if type-test and test-type-user were in the same file). |
| Comments |
| Comment by Alex Miller [ 18/Mar/11 10:27 AM ] |
|
The first case where we saw this was actually in having a deftype implement a Java interface (not a protocol) and in that case you cannot extend the interface outside the deftype (although comparing based on class name of course works). |
[CLJ-864] defrecord positional arity factory fn should have an inline version that calls the record constructor Created: 26/Oct/11 Updated: 26/Oct/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Kevin Downey | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
defrecord positional arity factory fn should have an inline version that calls the record constructor |
[CLJ-1046] Drop-while as a reducer Created: 18/Aug/12 Updated: 18/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Implement drop-while as a reducer. Follows the same atom-based strategy as drop and take. Does not depend on any of my other reducer patches, but there will probably be some minor merge conflicts unless it is merged after CLJ-1045, and before CLJ-992 and CLJ-993. |
[CLJ-887] Error when calling primitive functions with destructuring in the arg vector Created: 29/Nov/11 Updated: 29/Nov/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Alexander Taggart | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
If one defines a primitive-taking function with destructuring, calling that function will result in a ClassCastException, IFF the primitive return-type hint is present. Clojure 1.4.0-master-SNAPSHOT user=> (defn foo [[a b] ^long x ^long y] 0) #'user/foo user=> (foo [1 2] 3 4) 0 user=> (defn foo ^long [[a b] ^long x ^long y] 0) #'user/foo user=> (foo [1 2] 3 4) ClassCastException user$foo cannot be cast to clojure.lang.IFn$OLLL user/eval9 (NO_SOURCE_FILE:4) user=> (pst) ClassCastException user$foo cannot be cast to clojure.lang.IFn$OLLL user/eval9 (NO_SOURCE_FILE:4) clojure.lang.Compiler.eval (Compiler.java:6493) clojure.lang.Compiler.eval (Compiler.java:6459) clojure.core/eval (core.clj:2796) clojure.main/repl/read-eval-print--5967 (main.clj:244) clojure.main/repl/fn--5972 (main.clj:265) clojure.main/repl (main.clj:265) clojure.main/repl-opt (main.clj:331) clojure.main/main (main.clj:427) clojure.lang.Var.invoke (Var.java:397) clojure.lang.Var.applyTo (Var.java:518) clojure.main.main (main.java:37) nil |
[CLJ-884] Reflector error messages can be improved when no matching method is found. Created: 27/Nov/11 Updated: 23/Mar/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Rahul Pilani | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
All |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
When accessing a java method with an arity mismatch or a mismatched parameter type, Reflector.java returns the following error on REPL: eventhough method xyz might exist on MyClass, but was being called with the wrong number of arguments. Attached is a patch that fixes that problem. |
| Comments |
| Comment by Andy Fingerhut [ 22/Mar/12 8:47 PM ] |
|
diff.patch of Nov 27, 2011 does not apply cleanly to latest master version of Clojure code (using "patch -p1 < diff.patch", at least). It is preferred by Clojure team that patches are in git format-patch format. Instructions for producing such a patch are given at http://clojure.org/patches Rahul, are you planning to sign a Clojure Contributor Agreement? Without that, this code cannot be included in Clojure, unless a contributor reimplements it on their own. |
| Comment by Andy Fingerhut [ 23/Mar/12 1:14 AM ] |
|
In private communication with the patch author today, he expressed an interest in submitting a signed CA so this patch can be considered for inclusion in Clojure. |
[CLJ-1016] Global scope overrides lexical scope for classes (Clojure assumes no classes in default package / Clojure cannot handle yFiles JARs in classpath) Created: 21/Jun/12 Updated: 27/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Edward Z. Yang | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
The most visible symptom of this bug is having a class named 'w' (default package) in your classpath (such classes are produced by Java obfuscation tools such as yFiles) and then attempting to load Clojure's core class. For example: java -cp hotspotapi.jar:clojure-1.4.0-slim.jar clojure.main (where hotspotapi.jar is a stereotypical example of an obfuscated JAR) results in: Exception in thread "main" java.lang.ExceptionInInitializerError To understand what is going on, consider this simple test: import java.io.StringReader; import clojure.lang.Compiler; public class Test { It should be clear that 'mumble' in the dot operator is referencing the locally defined mumble. However, if we define a class named 'mumble' in the default package, Clojure picks that one up instead. To forestall any objections: yes, we know that placing classes in the default package is extremely poor form. Point of the matter is, the Java ecosystem is extremely diverse and there are a lot of JARs people may not have control over. While one might argue, "Don't put classes in the default namespace", point of the matter is, Clojure is wrong here, and these situations arise in practice, through no fault of the implementer. |
| Comments |
| Comment by Edward Z. Yang [ 21/Jun/12 11:01 AM ] |
|
Here is a workaround patch which makes this error less likely to occur. |
| Comment by Andy Fingerhut [ 27/Aug/12 7:37 PM ] |
|
Edward, it is Rich Hickey's policy only to consider for inclusion in Clojure patches written by people who have signed a Contributor Agreement: http://clojure.org/contributing Were you interested in becoming a contributor? |
| Comment by Edward Z. Yang [ 27/Aug/12 9:24 PM ] |
|
Sure, although the patch attached is emphatically not the one you want to actually applying, since it only band-aids the problem. |
[CLJ-959] after call to clojure.java.shell/sh, jvm won't exit Created: 26/Mar/12 Updated: 08/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Jeff Chiu | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | shell | ||
| Environment: |
Reproduced on Ubuntu using Sun Java 1.6, OpenJDK 1.6, and Sun Java 1.7 |
||
| Description |
|
Create the following four-line file, shell_example.clj: ;; simple example of call to sh that causes jvm to hang after print Run: After the message is printed, the jvm doesn't quit. It just sits there. I have to hit Ctrl-C to force the jvm to quit. This happens on 1.3 and the most recent code in github as of 3/26/2012. I imagine the jvm is waiting for a thread that hasn't terminated, but the code in the sh function doesn't look like it's doing anything obviously wrong. I'm too much of a newcomer to Clojure to dig any deeper. My workaround right now is to do (System/exit 0) to force the jvm to quit. Thank you for your work on Clojure, it's simply an amazing language. |
| Comments |
| Comment by Andy Fingerhut [ 27/Mar/12 12:19 AM ] |
|
Jeff, this occurs in any Clojure program where certain threading mechanisms are invoked. In your case, clojure.java.shell/sh uses future, which causes threads to be created that then sit around for about 60 seconds after everything else quits, and the main Java process does not exit until that happens. Another way to get the program to exit quickly is to call (shutdown-agents), but that isn't any more convenient than (System/exit 0), nor is there any obvious way you can tell as a newcomer that you should be doing this. The ticket CLJ-124 is marked with status "Approved" at this time, which leads me to believe that perhaps soon there will be a change made to Clojure such that this situation will change. |
| Comment by Andy Fingerhut [ 08/Jun/12 12:47 PM ] |
|
This behavior is now documented on clojuredocs.org for future, and both pmap and clojure.java.shell/sh refer to future for details. |
[CLJ-1013] Clojure's classloader cannot handle out-of-order loading Created: 13/Jun/12 Updated: 13/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Edward Z. Yang | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Here is a minimal test-case: import java.io.IOException; import clojure.lang.PersistentTreeMap; public class TestClass { static Class y = RT.class; /**
} This results in the exception: Exception in thread "main" java.lang.ExceptionInInitializerError The crux of the issue appears Clojure's classloader doesn't understand how to handle out-of-order classloading. |
[CLJ-968] ns emitting gen-class before imports results in imported annotations being discarded. Created: 09/Apr/12 Updated: 09/Apr/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Charles Duffy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The following discards the imported annotations: (ns com.example.BaseXModuleTest (:import (org.basex.query QueryModule QueryModule$Deterministic)) (:gen-class :extends org.basex.query.QueryModule :methods [ [^{QueryModule$Deterministic {}} addOne [int] int]])) However, when moving the gen-class call out of the ns declaration, the annotation is correctly applied: (ns com.example.BaseXModuleTest (:import (org.basex.query QueryModule QueryModule$Deterministic))) (gen-class :extends org.basex.query.QueryModule :name com.example.BaseXModuleTest :methods [ [^{QueryModule$Deterministic {}} addOne [int] int]]) It appears that imported names are not yet in-scope when gen-class is run from a ns declaration. |
[CLJ-969] Symbol/keyword implements IFn for lookup but a non-collection argument produces non-intuitive results Created: 09/Apr/12 Updated: 09/Apr/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Sean Corfield | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
('+ 1 2) ;; return 2 because it is treated as (get 1 '+ 2) Whilst this is "consistent" once you know the lookup behavior, it's confusing for Clojure newbies and it seems to be a non-useful behavior. Proposal: modify Keyword.invoke() and Symbol.invoke() to restrict first Object argument to instanceof ILookup, Map or IPersistentSet (or null) so that the "not found" behavior doesn't produce non-intuitive behavior. |
[CLJ-971] Jar within a jar throws a runtime error Created: 10/Apr/12 Updated: 10/Apr/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2, Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Ron Romero | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug | ||
| Environment: |
Maven using the one-jar plugin |
||
| Description |
|
I've created two jar files in my multi-project Maven setup. The first jar is the "engine", and it includes the clojure jar in it. The other jar is the "application". It includes the engine and then packages itself into a one-jar jar file. This means we have a jar within a jar: The "onejar" contains the engine jar, which in turn contains that clojure jar. I then get an error in the runtime: Exception in thread "main" java.lang.reflect.InvocationTargetException See also my Stack Overflow question on this at http://stackoverflow.com/questions/7763480/making-an-executable-jar-that-evals-clojure-strings In researching it, I've found the problem lies in RT.lastModified, where it tries to determine last modified time by looking at the modified time on the jar file for Clojure. But there's not actually a jar file, since it's embedded in another. I've found that adding a null check solves the problem. My lastModified looks like this now: static public long lastModified(URL url, String libfile) throws Exception{ return url.openConnection().getLastModified(); This runs successfully. If you'd prefer, I can submit a patch, or commit directly. |
[CLJ-903] extend-protocol does not allow classnames as a String Created: 30/Dec/11 Updated: 30/Dec/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2, Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Meikel Brandmeyer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In various places Clojure accepts classnames as String, eg. in gen-class or type hints. However it does not in extend-protocol. This does not allow simple specification of array types. See also here: http://groups.google.com/group/clojure/browse_thread/thread/722a0c09d02bb0ac |
[CLJ-1022] gen-class destroys method annotations Created: 03/Jul/12 Updated: 03/Jul/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Maris Orbidans | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug | ||
| Description |
|
When extending a class gen-class doesn't preserve method annotations. If class com.bar.Foo has annotated methods then in MyClass all annotations are gone. (gen-class (defn demo-post-init [this] (defn demo-get [_] Class<?> aClass = Class.forName("com.my.MyClass"); for (Method m : methods) { |
[CLJ-911] 'proxy' prevents overriding Object.finalize (and doesn't document it) Created: 16/Jan/12 Updated: 16/Jan/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Norman Gray | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
OS X, Java 1.6.0? |
||
| Description |
|
It appears to be impossible to override Object.finalize() using proxy. If the method is defined using proxy, then it cannot be called straightforwardly (see below), and it is not called as a finalizer during normal program execution (not demonstrated below). See extensive discussion at: https://groups.google.com/group/clojure/browse_thread/thread/a1e2fca45af6c1af
There is at least one of two bugs here (thanks to Cedric Greevey for summarising this way):
|
[CLJ-1037] Allow doc strings for both interfaces and concrete implementations Created: 04/Aug/12 Updated: 04/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Warren Lynn | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In this post I mentioned the rationale (I think) why this is important and needed. Thank you for consideration. |
[CLJ-986] Adds an exit function to exit clojure process Created: 06/May/12 Updated: 06/May/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | dennis zhuang | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | exit, function, quit | ||
| Description |
|
There is no standard function to exit the clojure process. Why not add a standard function in clojure.core? (defn exit I think it's useful for us. |
[CLJ-919] cannot create anonymous primitive functions Created: 27/Jan/12 Updated: 27/Jan/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Ben Mabey | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Primitive functions only work (e.g. return primitive types) when defined with `defn`. An equivalent function created with `fn` does not behave the same way as when created with `defn`. For example: (definterface IPrimitiveTester (deftype PrimitiveTester [] (defmacro pt [x] (defn with-defn ^double [^double x] (pt (with-defn 1.0)) ; => :double (let [a (fn ^double [^double x] (+ x 0.5))] Please see the discussion on the mailing list for more details and thoughts on what is happening: |
[CLJ-979] map->R returns different class when invoked from AOT ccode Created: 03/May/12 Updated: 13/May/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Edmund Jackson | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Mac OS X 10.5, lein 1.7 and lein 2.0 |
||
| Description |
|
(defrecord Dontwork [a]) (= (type (Dontwork. nil)) Will return true if the namespace is not AOT compiled and false if it is. I have created a small example project with AOT and non-AOT namespaces to demonstrate |
| Comments |
| Comment by Scott Lowe [ 12/May/12 9:05 PM ] |
|
I can't reproduce this under Clojure 1.3 or 1.4, and Leiningen 1.7.1 on either Java 1.7.0-jdk7u4-b21 OpenJDK 64-Bit or Java 1.6.0_31 Java HotSpot 64-Bit. OS is Mac OS X 10.7. Edmund, how are you running this AOT code? I wrapped your code in a main function and built an uberjar from it. |
| Comment by Edmund Jackson [ 13/May/12 2:20 AM ] |
|
Hi Scott, Interesting. I have two use cases 2. My original use case, which I've minimised here, is an AOT ns, producing a genclass that is called instantiated from other Java (no main). This produces the same error. I will produce an example of this and post it too. |
| Comment by Edmund Jackson [ 13/May/12 4:23 AM ] |
|
Hi Scott, Here is an example of it failing in the interop case: https://github.com/ejackson/aotquestion2 git clone git@github.com:ejackson/aotquestion2.git and it dies with this: Exception in thread "main" java.lang.ClassCastException: cljside.core.Dontwork cannot be cast to cljside.core.Dontwork The error message is really confusing (to me, anyway), but I think its the same root problem as for the REPL case. What do you see when you run the above ? |
| Comment by Scott Lowe [ 13/May/12 8:41 AM ] |
|
Ah, yes, looks like my initial attempt to reproduce was too simplistic. I used your second git repo, and can now confirm that it's failing for me with the same error. |
| Comment by Scott Lowe [ 13/May/12 10:35 PM ] |
|
I looked into this a little further and the AOT generated code looks correct, in the sense that both code paths appear to be returning the same type. However, I wonder if this is really a ClassLoader issue, whereby two definitions of the same class are being loaded at different times, because that would cause the x.y.Class cannot be cast to x.y.Class exception that we're seeing here. |
[CLJ-792] Refactor method resolution code out of Compiler and into Reflector Created: 11/May/11 Updated: 20/Feb/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Alexander Taggart | Assignee: | Alexander Taggart |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Issues:
By consolidating the duplicated code, moving the reflection-related parts into Reflector, and providing a straightforward API, it should be easier to read and understand the method resolution process. Further, improvements to (e.g., CLJ-445) the mechanism for reflecting on class members can largely be isolated from the Compiler. And the few points of coordination (e.g., Compiler emitting same arg and return types as Reflector does when invoking) can be clearly identified and documented. |
| Comments |
| Comment by Stuart Sierra [ 17/Feb/12 2:28 PM ] |
|
Patch does not apply as of commit f5bcf64. |
| Comment by Alexander Taggart [ 17/Feb/12 3:14 PM ] |
|
Yeah, year-old patches tend to do that. |
| Comment by Andy Fingerhut [ 20/Feb/12 1:11 PM ] |
|
I don't know if this is helpful or not, but this updated version of Alexander's patch applies cleanly to latest Clojure head as of Feb 20, 2012. It compiles, but does not pass ant test. |
[CLJ-994] repeat reducer Created: 11/May/12 Updated: 14/Sep/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Jason Jackson | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
i'm working on clojure.core/repeat reducer. |
| Comments |
| Comment by Andy Fingerhut [ 17/May/12 6:18 PM ] |
|
Jason, have you tried to build this using JDK 1.6.0? I've tried on Mac OS X 10.6.8 + Oracle/Apple JDK 1.6.0 and Ubuntu 11.10 + IBM JDK 1.6.0, and on both it compiles, but during the tests fails with a ClassNotFoundException for class jsr166y.ForkJoinTask. It builds and tests cleanly on Ubuntu 11.10 + Oracle JDK 1.7.0 for me. |
| Comment by Jason Jackson [ 17/May/12 6:41 PM ] |
|
That's an issue that applies to all of core.reducers. Alan Malloy experienced it as well. I tried fixing it, but eventually just upgraded to JDK 1.7. I don't understand why it's happening. |
| Comment by Jason Jackson [ 19/May/12 2:55 PM ] |
|
This issue is isolated to mvn test afaik. When I include clojure inside a leiningen project, and add jsr166y.jar to lib directory, core.reducers works fine with java 1.6. |
| Comment by Andy Fingerhut [ 20/May/12 3:00 AM ] |
|
Jason, you say it applies to all of core.reducers in your May 17, 2012 comment. I don't understand. Without your patch applied, I can run "./antsetup.sh ; ant" in a freshly-pulled Clojure git repo on either of the JDK 1.6.0 versions mentioned in my earlier comment, and do not get any errors during the tests. Are you saying perhaps that core.reducers currently has no tests that exercise the problem now, but your patch adds such tests that fail, even with no other changes to the code? |
| Comment by Jason Jackson [ 20/May/12 11:55 AM ] |
|
Yah that's right. Now that you mention it, my patch is the first unit test to call r/fold (the existing tests do non-parallel reductions). |
| Comment by Andy Fingerhut [ 08/Jun/12 7:11 PM ] |
|
With Stuart Halloway's commit to Clojure master on June 8, 2012 titled "let reducers tests work under ant", patch 0001-repeat-for-clojure.core.reducers.patch dated May 11, 2012 now runs correctly even the new unit tests requiring class jsr166y.ForkJoinTask with Oracle/Apple JDK 1.6 and Linux IBM JDK 1.6. |
| Comment by Jason Jackson [ 14/Aug/12 1:17 AM ] |
|
I'm on the contributors list. Is this patch still needed? |
| Comment by Jason Jackson [ 14/Sep/12 2:37 PM ] |
|
This patch should wait until http://dev.clojure.org/jira/browse/CLJ-993 is committed. I think there's a some shared code. |
[CLJ-995] sorted-set doesn't support IEditableCollection Created: 13/May/12 Updated: 04/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Moritz Ulrich | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I think sorted-set (PersistentTreeSet) should implement the transient interface. It's a special-purpose set and should be usable just like every normal set. |
| Comments |
| Comment by Michel Alexandre Salim [ 04/Jun/12 2:32 AM ] |
|
Note that this would require PersistentTreeMap to implement IEditableCollection as well. |
[CLJ-1081] REPL binding not working that works with with-bindings Created: 30/Sep/12 Updated: 01/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Steven Devijver | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
This works as expected: java -jar clojure-1.4.0.jar -e "(do (require 'clojure.repl) (.setDynamic #'clojure.repl/print-doc) (with-bindings {#'clojure.repl/print-doc str} (eval '(clojure.repl/doc println))))"
Output: "{:ns #<Namespace clojure.core>, :name println, :arglists ([& more]), :added \"1.0\", :static true, :doc \"Same as print followed by (newline)\", :line 3325, :file \"clojure/core.clj\"}" But the same thing does not work in the REPL: java -jar clojure-1.4.0.jar -e "(do (require 'clojure.repl) (.setDynamic #'clojure.repl/print-doc) (clojure.main/repl :init (fn [] {#'clojure.repl/print-doc str}))))" Output for Output of {{(doc println)}}: user=> (doc println) |
| Comments |
| Comment by Steven Devijver [ 01/Oct/12 5:51 AM ] |
|
Found a work-around: java -jar clojure-1.4.0.jar -e "(do (require 'clojure.repl) (.setDynamic #'clojure.repl/print-doc) (with-bindings {#'clojure.repl/print-doc str} (clojure.main/repl)))))"
I'm still not sure whether the method above using :init should or should not work. |
[CLJ-1077] thread-bound? returns true (implying set! should succeed) even for non-binding thread Created: 26/Sep/12 Updated: 01/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Paul Stadig | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
thread-bound? returns true for a non-binding thread, this result (according to the docstring) implies that set! should succeed. However, thread-bound? does not check that any binding that might exist was created by the current thread, and calling set! fails with an exception when it is called from a non-binding thread, even though thread-bound? returns true. thread-bound? should return false if there is a binding, and that binding was not established by the current thread. |
| Comments |
| Comment by Paul Stadig [ 01/Oct/12 10:07 AM ] |
|
I have attached a patch that changes clojure.lang.Var and clojure.core/thread-bound? to only return true if a Var is set!-able. |
[CLJ-790] Primitive type hints on function names should print error message Created: 10/May/11 Updated: 10/May/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alan Dipert | Assignee: | Alan Dipert |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Functions returning primitives are hinted with metadata on the argument list, not on the function name. Using a primitive type hint on a function name should print an error message. Currently, misplaced primitive hints are read without error. |
[CLJ-992] `iterate` reducer Created: 10/May/12 Updated: 12/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
|
Added a reducer implementation mirroring clojure.core/iterate. |
| Comments |
| Comment by Alan Malloy [ 10/May/12 9:50 PM ] |
|
Should I have made this implement Seqable as well? It wasn't clear to me, because as far as I could see this was the only function in clojure.core.reducers that's generating a brand-new sequence rather than transforming an existing one. |
| Comment by Alan Malloy [ 10/May/12 10:24 PM ] |
|
Previous version neglected to include the seed value of the iteration in the reduce. |
| Comment by Jason Jackson [ 11/May/12 11:23 AM ] |
|
Currying iterate seems useless, albeit not harmful. While implementing repeat, I couldn't use currying. Because 1-arity is already reserved for infinite repeat ([n x] and [x], not [n x] and [n] if currying) How about we just support currying for functions where last param is reducible? |
| Comment by Alan Malloy [ 18/Aug/12 7:16 PM ] |
|
This new patch replaces the previous patch. As requested, I am splitting up the large issue CLJ-993 into smaller tickets. Does not depend on any of my other reducer patches, but there will probably be some minor merge conflicts unless it is merged after CLJ-1045 and CLJ-1046, and before CLJ-993. |
[CLJ-993] `range` reducer Created: 10/May/12 Updated: 18/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Rich mentioned in IRC today he'd welcome a reducer implementation of clojure.core/range. Now that I've figured out how to do iterate, I figure I'll knock out range as well by the end of the night. Just opening the issue early to announce my intentions to anyone else interested in doing it. |
| Comments |
| Comment by Alan Malloy [ 10/May/12 10:45 PM ] |
|
Implemented range. A separate commit is attached, making iterate and range also Seqable, since I'm not sure if that's desired. Apply it or not, as you prefer. |
| Comment by Jason Jackson [ 11/May/12 11:20 AM ] |
|
Range should be foldable |
| Comment by Alan Malloy [ 11/May/12 12:53 PM ] |
|
Yep, so it should. Time for me to dig into the folding implementations! |
| Comment by Alan Malloy [ 11/May/12 2:42 PM ] |
|
Should I fold (har har) all of these commits into one? I don't know what is preferred on JIRA, and I also don't know whether range/iterate should be seqable or if I should just drop the second commit. |
| Comment by Rich Hickey [ 11/May/12 3:21 PM ] |
|
Yes, please merge these together, it's hard to see otherwise (I can barely read diffs as is |
| Comment by Alan Malloy [ 11/May/12 3:30 PM ] |
|
So you want clojure.core/range to return some object (a Range), which implements Counted and Seqable (but isn't just a lazy-seq), and then inside of clojure.core.reducers I extend CollReduce and CollFold to that type? Okay, I can do that. I don't quite follow what you mean by an allocating protocol. I see your point that my fold-by-halves which takes a function in is analogous to a protocol with a single function, but it doesn't allocate anything more than foldvec already does - I just pulled that logic out so that the fork/join fiddly work doesn't need to be repeated in everything foldable. Do you have an alternative recommendation, or is it just something that makes you uneasy and you're still thinking about? |
| Comment by Rich Hickey [ 11/May/12 3:52 PM ] |
|
While vector-fold allocs subvecs, the halving-fn must return a new vector, for all implementations. It's ok, I don't think it's likely to dominate (since fj needs new closures anyway). Please proceed, but keep range and iterate in core. They are sources, not transformers, and only transformers (which must be different from their seq-based counterparts) must reside in reducers. Thanks! |
| Comment by Stuart Sierra [ 11/May/12 5:01 PM ] |
|
One big patch file is preferred, although that file may contain multiple commits if that makes the intent clearer. When adding a patch, update the description of the ticket to indicate which file is the most recent. Leave old patch files around for historical reference. |
| Comment by Alan Malloy [ 11/May/12 9:00 PM ] |
|
It's looking harder than I expected to move iterate and range into core.clj. My plan was to just have them implement Seqable, which is easy enough, but currently they are actually instances of ISeq, because they inherit from LazySeq. A bunch of code all over the place (eg, to print them in the repl) depends on them being ISeq, so I can't just ignore it. To implement all of these methods (around thirty) would take a large amount of code, which can't easily be shared between Iteration, Range, and any future reducible sources that are added to core.clj. I could write a macro like (defseq Range [start end step] Counted (count [this] ...) ...) which takes normal deftype args and also adds in implementations for ISeq, Collection, and so forth in terms of (.seq this), which will be a LazySeq. However, this seems like a somewhat awkward approach that I would be a little embarrassed to clutter up core.clj with. If anyone has a better alternative I will be pleased to hear it. In the mean time, I will go ahead with this macro implementation, in case it turns out to be the best choice. |
| Comment by Alan Malloy [ 11/May/12 11:52 PM ] |
|
– This patch subsumes all previous patches to this issue and to CLJ-992 – In order to create an object which is both a lazy sequence and a If we wanted, we could use this macro to implement lazy-seq in clojure instead of in java, but that's unrelated so I didn't do that in this patch. As noted in a previous comment, defseq may not be the right approach, but this works until something better is suggested. |
| Comment by Alan Malloy [ 11/May/12 11:58 PM ] |
|
I accidentally included an implementation of drop-while in this patch, which I was playing around with to make sure I understood how this all works. I guess I'll leave it in for the moment, since it works and is useful, but I can remove it, or move it to a new JIRA ticket, if it's not wanted at this time. |
| Comment by Rich Hickey [ 12/May/12 10:52 AM ] |
|
Ok, I think this patch is officially off the rails. There must be a better way. Let's start with: touching core/deftype and reimplementing lazy-seq as a macro are off the table. The return value of range doesn't have to be a LazySeq, it has to be a lazy seq, .e.g. implement ISeq (7 methods, not 30) which it can do by farming out to its existing impl. It can also implement some new interface for use by the reducer logic. There is also still clojure.lang.Range still there, which is another approach. Please take an extremely conservative approach in these things. |
| Comment by Alan Malloy [ 12/May/12 5:53 PM ] |
|
Okay, thanks for the feedback - I'm glad I went into that last patch knowing it was probably wrong It's still an unpleasant chunk of boilerplate for each new source, though; would you welcome a macro like defseq if I didn't put it in core_deftype? If so, it seems like it might as well implement the interop interfaces; if not, I can skip them and implement the 7 (isn't it more like 9?) methods in ISeq, IPersistentCollection, and Seqable for each new source type. Thanks for pointing out clojure.lang.Range to me - I didn't realize we had it there. Of course with implementation inheritance it would be easy to make Range, Iteration, etc inherit from LazySeq and just extend protocols from them. But that means moving functionality out of clojure and into java, which I didn't think we'd want to do. I'll put together a patch that just implements ISeq by hand for both of these new types, and attach it probably later today. |
| Comment by Alan Malloy [ 12/May/12 7:49 PM ] |
|
So I've written a patch that implements ISeq, but not the java Collections interfaces, and it mostly works but there are definitely assumptions in some parts of clojure.core and clojure.lang that assume seqs are Collections. The most obvious to me (ie, it shows up when running mvn test) is RT/toArray - it tests for Collection, but never for ISeq, implying that it's not willing to handle an ISeq that is not also a collection. Functions which rely on toArray (eg to-array and vec) now fail. This patch subsumes all previous patches on this issue, but is not suitable for application because it leaves some failing tests behind - it is intended only for intermediate feedback. |
| Comment by Rich Hickey [ 13/May/12 8:50 AM ] |
|
It would be a great help if, time permitting, you could please write up the issues, challenges and options you've discovered somewhere on the dev wiki (even a simple table would be fantastic). I realize this has been a challenging task, and at this point perhaps we should opt for the more modest reducers/range and reducers/iterate and leave the two worlds separate. I'd like at some point to unify range, as there are many extant ranges it would be nice to be able to fold, as we can extant vectors. |
| Comment by Jason Jackson [ 13/May/12 9:24 AM ] |
|
Should r/range return something Seqable and Counted? If so, I'll do the same for r/repeat. |
| Comment by Alan Malloy [ 13/May/12 1:59 PM ] |
|
I've sketched out a description of the issues and options. I'm not very familiar with the dev wiki and couldn't figure out where was the right place to put this. "release.next" seems to still be about 1.4 issues, and I don't know if it's "appropriate" to create a whole new category for this. It's available as a gist until a better home can be found for it. |
| Comment by Alan Malloy [ 23/May/12 7:54 PM ] |
|
Here's a single patch summing up the state Rich suggested "rolling back" to: separate r/range and r/iterate functions. I haven't heard any feedback since doing the writeup Rich asked for, so am not making any further progress at the moment; if something other than this patch is desired just let me know. |
| Comment by Rich Hickey [ 14/Aug/12 2:07 PM ] |
|
I prefer not to see the use of extend like this for new types. Perhaps this code is too DRY? Also, it does a lot in one patch which makes it hard to parse and accept. This adds Range, switches impl of vector folds etc. Can it be broken up into separate tickets that do each step that builds on the previous, e.g. one ticket could be: capture vector fold impl for reuse by similar things. |
| Comment by Alan Malloy [ 18/Aug/12 6:19 PM ] |
|
Okay, I should be able to split it up over the weekend. I'll also see about converting fold-by-halves into a function that is used by Range/Vector, rather than a function that gets extended onto them. |
| Comment by Alan Malloy [ 18/Aug/12 7:18 PM ] |
|
As requested, I have split up the large patch on this issue into four smaller tickets. The other three are: CLJ-1045, CLJ-1046, and CLJ-992. CLJ-1045 contains the implementation of fold-by-halves, and as such this patch cannot be applied until CLJ-1045 is accepted. This ticket does not depend on the other two, but there will be minor merge conflicts if this is merged before them. |
[CLJ-1059] PersistentQueue doesn't implement java.util.List, causing nontransitive equality Created: 03/Sep/12 Updated: 11/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Philip Potter | Assignee: | Philip Potter |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
|
PersistentQueue implements Sequential but doesn't implement java.util.List. Lists form an equality partition, as do Sequentials. This means that you can end up with nontransitive equality: (def q (conj clojure.lang.PersistentQueue/EMPTY 1 2 3)) This happens because PersistentQueue is a Sequential but not a List, ArrayList is a List but not a Sequential, and PersistentVector is both. |
| Comments |
| Comment by Philip Potter [ 15/Sep/12 3:41 AM ] |
|
Whoops, according to http://dev.clojure.org/display/design/JIRA+workflow I should have emailed clojure-dev before filing this ticket. Here is the discussion: https://groups.google.com/d/topic/clojure-dev/ME3-Ke-RbNk/discussion |
| Comment by Philip Potter [ 15/Sep/12 2:37 PM ] |
|
Attached 001-make-PersistentQueue-implement-List.diff, 15/Sep/12 Note that this patch has a minor conflict with the one I added to |
| Comment by Chouser [ 18/Sep/12 1:04 AM ] |
|
Philip, patch looks pretty good – thanks for doing this. A couple notes: This is only my opinion, but I prefer imports be listed without wildcards, even if it means an extra couple lines at the top of a .java file. I noticed the "List stuff" code is a copy of what's in ASeq and EmptyList. I suppose this is copied because EmptyList and PersistentQueue extend Obj and therefore can't extend ASeq. Is this the only reason? It seems a shame to duplicate these method definitions, but I don't know of a better solution, do you? It would also be nice if the test check a couple of the List methods you've implemented. |
| Comment by Chouser [ 18/Sep/12 1:08 AM ] |
|
oh, also "git am" refused to apply the patch, but I'm not sure why. "patch -p 1" worked perfectly. |
| Comment by Philip Potter [ 18/Sep/12 1:19 AM ] |
|
did you use the --keep-cr option to git am? I struggled to know whether I should be adding CRs or not to line endings, because the files I was editing weren't consistent in their usage. If you open them in emacs, half the lines have ^M at the end. |
| Comment by Philip Potter [ 18/Sep/12 1:21 AM ] |
|
Will submit another patch, with the import changed. I'll have a think about the list implementation and see what ideas I can come up with. |
| Comment by Philip Potter [ 18/Sep/12 3:17 PM ] |
|
Attached 002-make-PersistentQueue-implement-Asequential.diff This patch is an alternative to 001-make-PersistentQueue-implement-List.diff So I took on board what you said about ASeq, but it didn't feel right making PersistentQueue directly implement ISeq, somehow. So I split ASeq into two parts – ASequential, which implements j.u.{Collection,List} and manages List-equality and hashcodes; and ASeq, which... doesn't seem to be doing much anymore, to be honest. As a bonus, this patch fixes (It turns out that because ASeq was already implementing Obj, the fact that PersistentQueue was implementing Obj was no barrier to using it.) Would appreciate comments on this approach, and how it differs from the previous patch here and the patch on |
| Comment by Philip Potter [ 18/Sep/12 3:44 PM ] |
|
Looking at EmptyList's implementation of List, it is a duplicate of the others, but it shouldn't be. I think its implementation of indexOf is the biggest culprit - it should just be 'return -1;' but it has a great big for loop! But this is beyond the scope of this ticket, so I won't patch that here. |
| Comment by Andy Fingerhut [ 20/Oct/12 12:29 PM ] |
|
Philip, now that the patch for |
| Comment by Philip Potter [ 22/Oct/12 5:10 AM ] |
|
Andy, thanks so much for your efforts to make people aware of these things. I will indeed submit new patches, hopefully later this week. |
| Comment by Philip Potter [ 03/Nov/12 12:23 PM ] |
|
Replaced existing patches with new ones which apply cleanly to master. There are two patches: 001-clj-1059-make-persistentqueue-implement-list.diff This fixes equality by making PersistentQueue implement List directly. I also took the opportunity to remove the wildcard import and to add tests for the List methods, as compared with the previous version of the patch. 002-clj-1059-asequential.diff This fixes equality by creating a new abstract class ASequential, and making PersistentQueue extend this. My preferred solution is still the ASequential patch, but I'm leaving both here for comparison. |
| Comment by Timothy Baldridge [ 30/Nov/12 3:37 PM ] |
|
Vetting. |
| Comment by Andy Fingerhut [ 11/Dec/12 12:50 PM ] |
|
Philip, this time I think it was patches that were committed for |
| Comment by Philip Potter [ 11/Dec/12 1:57 PM ] |
|
Thanks Andy. Submitted a new patch, 002-clj-1059-asequential-rebased-to-cached-hasheq.diff, which supersedes 002-clj-1059-asequential.diff. The patch 001-clj-1059-make-persistentqueue-implement-list.diff still applies cleanly, and is still an alternative to 002-clj-1059-asequential-rebased-to-cached-hasheq.diff. |
[CLJ-939] Exceptions thrown in the top level ns form are reported without file or line number Created: 24/Feb/12 Updated: 15/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Hugo Duncan | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Incomplete |
| Waiting On: | Rich Hickey |
| Description |
|
If there is an error in the `ns` form, an exception is thrown, which is not caught in `load`. For example, with an invalid :only clause; (ns clj14.myns (:use [clojure.core :only seq])) This generates a Don't know how to create ISeq from: clojure.lang.Symbol exception, with source file or line number. |
| Comments |
| Comment by Hugo Duncan [ 25/Feb/12 8:26 AM ] |
|
Corrected patch |
| Comment by Andy Fingerhut [ 09/Mar/12 9:26 AM ] |
|
Patch 0001-report-load-exception-with-file-and-line.diff fails build. Patch 0002-report-load-exception-with-file-and-line.diff applies, builds, and tests cleanly as of March 9, 2012. Hugo has signed a CA. |
| Comment by Andy Fingerhut [ 05/Oct/12 8:13 AM ] |
|
clj-939-report-load-exceptions-with-file-and-line-patch-v2.txt dated Oct 5 2012 is intended to be an update to Hugo Duncan's patch 0002-report-load-exceptions-with-file-and-line.diff dated Feb 25 2012. Because of Brandon Bloom's recently commited patch adding column numbers in addition to line numbers, this is not simply updating some lines of context, but I think it is correct. It would be good if Hugo could take a look at it and confirm. |
| Comment by Stuart Sierra [ 09/Nov/12 9:38 AM ] |
|
Screened. The error messages are better than what we had before. The line/column numbers are not particularly informative, probably because ns is a macro. |
| Comment by Rich Hickey [ 13/Nov/12 3:37 PM ] |
|
This patch doesn't change the reporting on any other (e.g. nested) exceptions? It looks like it might. |
[CLJ-899] Accept and ignore colon between key and value in map literals Created: 18/Dec/11 Updated: 19/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Stuart Halloway | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 4 |
| Labels: | None | ||
| Description |
|
Original title was 'treat colons as whitespace' which isn't a problem description but a (flawed) implementation approach For JSON compatibility |
| Comments |
| Comment by Tassilo Horn [ 23/Dec/11 3:22 AM ] |
|
Discussed here: https://groups.google.com/d/msg/clojure/XvJUzaY1jec/l8xEwlFl8EUJ |
| Comment by Kevin Downey [ 11/Jan/12 2:23 PM ] |
|
please no |
| Comment by Tavis Rudd [ 16/Jan/12 12:17 PM ] |
|
Alan Malloy raises a good point in the google group discussion (https://groups.google.com/d/msg/clojure/XvJUzaY1jec/aVpWBicwGhsJ) about accidental confusion between trailing (or floating) and leading colons: This issue could be avoided by only treating a colon as whitespace when followed by a comma. As easy cut-paste of json seems the be the key motivation here, the commas are going to be there anyway: valid {"v":, 1234} vs syntax error {a-key: should-be-a-keyword}. |
| Comment by Alex Baranosky [ 16/Jan/12 5:23 PM ] |
|
This would be visually confusing imo. |
| Comment by Laurent Petit [ 17/Jan/12 5:01 PM ] |
|
Please, oh please, no. |
| Comment by Tavis Rudd [ 18/Jan/12 2:40 PM ] |
|
Er, brain fart. I was typing faster than I was thinking and put the comma in the wrong place. In my head I meant the form following the colon would have to have a comma after it. Thus, {"a-json-key": 1234, ...} would be valid while {"a-json-key": was-supposed-to-be-a-keyword "another-json-key" foo} would complain about the colon being an Invalid Token. I don't see the need for it, however. |
| Comment by Joseph Smith [ 27/Feb/12 10:55 AM ] |
|
Clojure already has reader syntax for a map. If we support JSON, do we also support ruby map literals? Seems like this addition would only add confusion, imo, given colons are used in keywords and keywords are frequently used in maps - e.g., when de-serializing from XML, or even JSON. |
| Comment by David Nolen [ 27/Feb/12 11:19 AM ] |
|
Clojure is no longer a language hosted only on the JVM. Clojure is also hosted on the CLR, and JavaScript. In particular ClojureScript can't currently easily deal with JSON literals - an extremely common (though problematic) data format. By allowing colon whitespace in map literals - Clojure data structures can effectively become an extensible JSON superset - giving the succinctness of JSON and the expressiveness of XML. +1 from me. |
| Comment by Tim McCormack [ 13/Nov/12 7:27 PM ] |
|
Clojure is only hosted on the JVM; ClojureScript is hosted on JS VMs. If this is useful for CLJS, it should just be a CLJS feature. |
| Comment by Mike Anderson [ 10/Dec/12 11:51 PM ] |
|
-1 for this whole idea: that way madness lies.... If we keep adding syntactical oddities like this then the language will become unmaintainably complex. It's the exact opposite of simple to have lots of special cases and ambiguities that you have to remember. If people want to use JSON that is fine, but then the best approach use a specific JSON parser/writer, not just paste it into Clojure source and expect it to work. |
| Comment by Laszlo Török [ 11/Dec/12 4:54 AM ] |
|
-1 for reasons mentioned by Allan Malloy and Mike Anderson |
[CLJ-1136] Type hinting for array classes does not work in binding forms Created: 20/Dec/12 Updated: 21/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Luke VanderHart | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | Compiler, bug | ||
| Environment: |
replicated on OpenJDK 7u9 on Ubuntu 12.04, and Hotspot 1.6.0_37 on OSX Lion |
||
| Description |
|
Type hints don't work as expected in binding forms. The following form results in a reflection warning: (let [^{:tag (Class/forName "[Ljava.lang.Object;")} a (make-array Object 2)] However, hinting does appear to work correctly on vars: (def ^{:tag (Class/forName "[Ljava.lang.Object;")} a (make-array Object 2)) |
| Comments |
| Comment by Ghadi Shayban [ 20/Dec/12 10:51 PM ] |
|
It's a little more insidious than type hinting: the compiler doesn't evaluate metadata in the binding vec. This doesn't throw the necessary exception... (let [^{:foo (Class/forName "not real")} bar 42] neither this... (let [^{gyorgy ligeti} a 42] Gyorgy Ligeti never resolves. These two equivalent examples don't reflect: (let [a ^objects (make-array Object 2)] |
| Comment by Ghadi Shayban [ 21/Dec/12 11:09 AM ] |
|
On only the left-hand side of a local binding, metadata on a symbol is not analyzed or evaluated. |
[CLJ-1108] Allow to specify an Executor instance to be used with future-call Created: 18/Nov/12 Updated: 27/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Max Penet | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
This adds an arity to future-call that expects a java.util.concurrent/ExecutorService instance to be used instead of clojure.lang.Agent/soloExecutor. |
| Comments |
| Comment by Andy Fingerhut [ 26/Dec/12 4:50 PM ] |
|
Rich Hickey committed a change on Dec 21, 2012 to the future-call function that made the patch bac37b91230d8e4ab3a1e6042a6e8c4b7e9cbf53.patch dated Nov 18 2012 no longer apply cleanly. clj-1108-enhance-future-call-patch-v2.txt dated Dec 26 2012 is identical to that earlier patch, except it has been updated to apply cleanly to the latest master. It would be best if Max Penet, author of the earlier patch, could verify I've merged his patch to the latest Clojure master correctly. |
| Comment by Max Penet [ 27/Dec/12 2:25 AM ] |
|
It's verified, it applies correctly to the latest master 00978c76edfe4796bd6ebff3a82182e235211ed0 . Thanks Andy. |
[CLJ-1142] Incorrect divide-by-zero error with floating point numbers Created: 08/Jan/13 Updated: 08/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Tim McCormack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The unary call for clojure.core// treats a dividend of 0.0 differently than the binary call, likely due to inlining. (/ 0.0) ;; java.lang.ArithmeticException: Divide by zero (/ 1 0.0) ;;= Infinity (/ 1 (identity 0.0)) ;; java.lang.ArithmeticException: Divide by zero |
| Comments |
| Comment by Tim McCormack [ 08/Jan/13 11:22 PM ] |
|
The relevant code seems to be this in clojure.lang.Numbers/divide: if(yops.isZero((Number)y)) throw new ArithmeticException("Divide by zero"); Making Numbers/divide be more restrictive than double arithmetic seems like a bug; explicitly throwing an ArithmeticException instead of letting the JVM figure it just seems like more work than necessary. |
[CLJ-840] Add a way to access the current test var in :each fixtures for clojure.test Created: 21/Sep/11 Updated: 18/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Hugo Duncan | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
When looking at (log) output from tests written with clojure.test, I would like to be able to identify the output associated with each test. A mechanism to expose the current test var within an :each fixture would enable this. One mechanism might be to bind a test-var var with the current test var before calling the each-fixture-fn in clojure.test/test-all-vars. |
| Comments |
| Comment by Stuart Sierra [ 07/Oct/11 4:33 PM ] |
|
Or just pass the Var directly into the fixture. Vars are invokable. |
| Comment by Hugo Duncan [ 07/Oct/11 4:45 PM ] |
|
I don't think that works, since the the function passed to the fixture is not the test var, but a function calling test-var on the test var. |
| Comment by Hugo Duncan [ 21/Oct/11 10:34 PM ] |
|
Patch to add test-var |
| Comment by Stuart Sierra [ 25/Oct/11 6:04 PM ] |
|
*testing-vars* already has this information, but it's not visible to the fixture functions because it gets bound inside test-var. Perhaps the :each fixture functions should be called in test-var rather than in test-all-vars. (The namespace of a Var is available in its metadata.) But then we have to call join-fixtures inside test-var every time. |
| Comment by Stuart Sierra [ 25/Oct/11 6:26 PM ] |
|
Try this patch: clj840-2.diff. This makes *testing-vars* visible to :each fixture functions, which seems intuitively more correct. BUT it slightly changes the behavior of test-var, which I'm less happy about. |
| Comment by Hugo Duncan [ 25/Oct/11 8:07 PM ] |
|
Might it make sense to provide a function on top of testing-vars to return the current test-var? |
| Comment by Stuart Sierra [ 28/Oct/11 9:14 AM ] |
|
No, that function is first |
| Comment by Hugo Duncan [ 28/Oct/11 11:31 AM ] |
|
I agree with having the dynamic vars as part of the extension interface, but would have thought that having a function for use when writing tests would have been cleaner. Just my 2c. |
[CLJ-825] Protocol implementation inconsistencies Created: 08/Aug/11 Updated: 08/Aug/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2, Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Carl Lerche | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Environment: |
All |
||
| Attachments: |
|
| Description |
|
There seems to be some inconsistencies when implementing protocols that have multi arity functions depending on how the protocol is implemented. I have attached a clj file illustrating this. The short version is that multi arity must be defined as such w/ defrecord: (defrecord Zomg [] And as such with extend-type (extend-type Object I have only tested defrecord & extend-type. I am unsure how it works with deftype and extend-protocol. |
[CLJ-1045] Generalize/refactor implementation of PersistentVector/coll-fold Created: 18/Aug/12 Updated: 25/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Vector currently contains a specialized implementation of the folding algorithm "split the collection in half until the pieces are small enough". The attached commit lifts out the general strategy so that it can be reused by other collection types amenable to splitting. CLJ-993 depends on this patch, as it uses the new fold-by-halves function. |
| Comments |
| Comment by Andy Fingerhut [ 25/Jan/13 2:29 PM ] |
|
clj-1045-fold-by-halves-patch-v2.txt dated Jan 25 2013 is identical to fold-by-halves.patch dated Aug 18 2012, except it updates one line of context changed by a recent commit to Clojure master. |
[CLJ-1096] Make destrucring emit direct keyword lookups Created: 29/Oct/12 Updated: 26/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Christophe Grand | Assignee: | Christophe Grand |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Currently associative destructuring emits calls to get. The attached patch modify desctruture to emit direct keyword lookups when possible. Approved here https://groups.google.com/d/msg/clojure-dev/MaYcHQck8VA/nauMus4mzPgJ |
[CLJ-978] bean unable to handle non-public classes Created: 30/Apr/12 Updated: 29/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Charles Duffy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Take the following Java as an example: public interface IFoo { String getBar(); } class FooImpl { String getBar() { return "bar"; } } As presently implemented, (bean my-foo) tries to invoke the following: (. #<Method public java.lang.String FooImpl.getBar> (invoke my-foo nil)) However, as FooImpl is not public, this fails: java.lang.IllegalAccessException: Class clojure.core$bean$fn__1827$fn__1828 can not access a member of class FooImpl with modifiers "public" at sun.reflect.Reflection.ensureMemberAccess (Reflection.java:65) java.lang.reflect.Method.invoke (Method.java:588) clojure.core$bean$fn__1827$fn__1828.invoke (core_proxy.clj:382) clojure.core$bean$v__1832.invoke (core_proxy.clj:388) clojure.core$bean$fn__1838$thisfn__1839$fn__1840.invoke (core_proxy.clj:406) clojure.lang.LazySeq.sval (LazySeq.java:42) clojure.lang.LazySeq.seq (LazySeq.java:60) clojure.lang.RT.seq (RT.java:473) However, the same thing succeeds if we call #<Method public java.lang.String Foo.getBar> rather than #<Method public java.lang.String FooImpl.getBar>. |
| Comments |
| Comment by Charles Duffy [ 30/Apr/12 10:40 PM ] |
|
Fix inaccurate documentation string |
| Comment by Charles Duffy [ 01/May/12 9:41 AM ] |
|
Apache Commons Beanutils has their own implementation of this, at http://www.docjar.com/html/api/org/apache/commons/beanutils/MethodUtils.java.html#771 – notably, it tries to reflect a method with the given signature and catches the exception on failure, rather than iterating through the whole list. This may be a better approach – I'm unfamiliar with how the cost of exception handling compares with that of reflecting on the full method list of a class. |
| Comment by Charles Duffy [ 01/May/12 10:11 AM ] |
|
Prior version of patch were missing new test suite files. Corrected. |
| Comment by Andy Fingerhut [ 04/May/12 2:48 AM ] |
|
Thanks for the patches, Charles. Could you please create a patch in the desired format and attach that, and then remove the obsolete patches? Instructions for creating a patch are under the heading "Development" at this page: http://dev.clojure.org/display/design/JIRA+workflow Instructions for removing patches are under the heading "Removing patches" on that same page. |
| Comment by Charles Duffy [ 06/May/12 2:59 PM ] |
|
Added a patch created per documented process. |
| Comment by Gary Trakhman [ 04/Oct/12 6:44 PM ] |
|
I found in my code that it's possible to get a NPE if there is no read-method, for instance on the http://docs.cascading.org/cascading/2.0/javadoc/cascading/flow/hadoop/HadoopFlow.html object which has a setCascade method but no getter. I fixed this in our code by inlining the is-zero-args check into the public-method definition and and-ing the whole thing with 'method' like the original 'bean' code, like so: public-method (and method (zero? (alength (. method (getParameterTypes)))) |
| Comment by Rich Hickey [ 29/Nov/12 10:01 AM ] |
|
Charles, I think we should follow Apache BeanUtils on this. Exceptions not thrown are cheap. Ordinarily, exception for control flow are bad, but this is forced by bad design of reflection API. |
[CLJ-1079] Don't squash explicit :line and :column metadata in the MetaReader Created: 29/Sep/12 Updated: 07/Feb/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
I have been experimenting with using cljx to produce Clojure and ClojureScript source from a single file. This has gone well so far, with the exception that, due to the way the source transformation works, all of the linebreaks and other formatting is gone from the output. There is an option to include the original :line metadata in the output though, like so: ;;This file autogenerated from
;;
;; src/cljx/com/foo/hosty.cljx
;;
^{:line 1} (ns com.foo.hosty)
^{:line 3} (defn ^{:clj true} system-hash [x] ^{:line 5} (System/identityHashCode x))
(Hopefully, such hackery won't be necessary in the future with sjacket or something like it...) Unfortunately, when read in using a LineNumberingPushbackReader, code like this has its :line metadata squashed by the line numbers coming from that. A REPL-friendly example would be: => (meta (read (clojure.lang.LineNumberingPushbackReader.
(java.io.StringReader. "^{:line 66} ()"))))
{:line 1}
=> (meta (read (java.io.PushbackReader.
(java.io.StringReader. "^{:line 66} ()"))))
{:line 66}
The latter seems more correct to me (and is equivalent to read-string). |
| Comments |
| Comment by Chas Emerick [ 29/Sep/12 7:07 PM ] |
|
{{CLJ-1097.diff}} contains a fix for this issue, as well as a separate commit that eliminates a series of casts in order to improve readability in the area. |
| Comment by Andy Fingerhut [ 05/Oct/12 8:23 AM ] |
|
Chas, your patch doesn't apply cleanly to latest Clojure master as of Oct 5 2012. I'm not sure, but I think some recent commits to Clojure on Oct 4 2012 caused that. I also take it as evidence of your awesomeness that you can write patches for tickets that haven't been filed yet |
| Comment by Chas Emerick [ 05/Oct/12 9:24 AM ] |
|
"patches for tickets that haven't been filed yet?" Anyway, tweaking up this patch is a small price to pay for having column meta. New {{CLJ-1097.diff}} patch attached, applies clean on master as of now. Otherwise same contents as in the original patch, except:
|
| Comment by Nicola Mometto [ 05/Oct/12 9:39 AM ] |
|
"patches for tickets that haven't been filed yet?" He was referring to the fact that you uploaded "CLJ-1097.diff" while the ticket is #1079 |
| Comment by Chas Emerick [ 05/Oct/12 9:42 AM ] |
|
Oh, hah! Twice now, even! One more data point recommending my having slight dyslexia or somesuch. :-P I've replaced the attached patch with one that is named properly to avoid any later confusion. |
| Comment by Chas Emerick [ 07/Oct/12 3:57 PM ] |
|
Refreshed patch to apply cleanly to master after the recent off by one patch for :column metadata. |
| Comment by Stuart Halloway [ 19/Oct/12 3:12 PM ] |
|
This feels backwards to me. If a special purpose tool wants to convey information via metadata, why does it use names that collide with those used by LispReader? |
| Comment by Chas Emerick [ 19/Oct/12 7:36 PM ] |
|
The information being conveyed is the same :line and :column metadata conveyed by LispReader — in fact, that's where it comes from in the first place. Kibit (and cljx) is essentially an out-of-band source transformation tool. Given an input like this: (ns com.foo.hosty)
(defn ^:clj system-hash
[x]
(System/identityHashCode x))
(defn ^:cljs system-hash
[x]
(goog/getUid x))
…it produces two files, a .clj for Clojure, and a .cljs for ClojureScript. (The first code listing in the ticket description is the former.) However, because there's no way to transform Clojure code/data without losing formatting, anything that depends on line/column numbers (stack traces, stepping debuggers) is significantly degraded. If LispReader were to defer to :line and :column metadata already available on the loaded forms (there when the two generated files are spit out with *print-meta* on), this would not be the case. |
| Comment by Andy Fingerhut [ 07/Feb/13 8:47 AM ] |
|
clj-1079-patch-v2.txt dated Feb 7 2013 is identical to Chas's CLJ-1079.diff dated Oct 7 2012, except it applies cleanly to latest master. I believe the only difference is that some white space in the context lines is updated. |
| Comment by Andy Fingerhut [ 07/Feb/13 12:35 PM ] |
|
Sorry for the noise. I've removed clj-1079-patch-v2.txt mentioned in the previous comment, because I learned that CLJ-1079.diff dated Oct 7 2012 applies cleanly to latest master and passes all tests if you use this command to apply it. % git am --keep-cr -s --ignore-whitespace < CLJ-1079.diff I will update the JIRA workflow page instructions for applying patches to mention this, too, because there are multiple patches that fail without --ignore-whitespace, but apply cleanly with that option. That will eliminate the need to update patches merely for whitespace changes. |
[CLJ-859] Built in dynamic vars don't have :dynamic metadata Created: 19/Oct/11 Updated: 24/Feb/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Anthony Simpson | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I'm sure 'built in' is probably not the right term here, but I'm not sure what these are called. I ran into this issue earlier today while fixing a bug in clojail. Built in vars, particularly ones listed here without a source link: http://clojure.github.com/clojure/clojure.core-api.html, do not have :dynamic metadata despite being dynamic. This includes *in*, *out*, and *err* among others. Here are some examples: user=> (meta #'*err*)
{:ns #<Namespace clojure.core>, :name *err*, :added "1.0", :doc "A java.io.Writer object representing standard error for print operations.\n\n Defaults to System/err, wrapped in a PrintWriter"}
user=> (meta #'*in*)
{:ns #<Namespace clojure.core>, :name *in*, :added "1.0", :doc "A java.io.Reader object representing standard input for read operations.\n\n Defaults to System/in, wrapped in a LineNumberingPushbackReader"}
user=> (meta #'*out*)
{:ns #<Namespace clojure.core>, :name *out*, :added "1.0", :doc "A java.io.Writer object representing standard output for print operations.\n\n Defaults to System/out, wrapped in an OutputStreamWriter", :tag java.io.Writer}
user=> (meta #'*ns*)
{:ns #<Namespace clojure.core>, :name *ns*, :added "1.0", :doc "A clojure.lang.Namespace object representing the current namespace.", :tag clojure.lang.Namespace}
|
| Comments |
| Comment by Ben Smith-Mannschott [ 19/Oct/11 12:03 PM ] |
|
This recent discussion on the users list seems relevant: Should intern obey :dynamic?. It seems to boil down to this the information that a Var is dynamic (or not) is duplicated. Once as metadata with the key :dynamic, and once as a boolean field on the Var class which implements Clojure's variables. This boolean can be obtained by calling the method isDynamic() on the Var. The confusion arises because apparently :dynamic and .isDynamic can get out of sync with each other. .isDynamic is the source of truth in this case. |
| Comment by Ben Smith-Mannschott [ 19/Oct/11 12:18 PM ] |
|
Compiler$Parser.parse(...) finds the :dynamic entry left in the metadata of the symbol by LispReader and passes this on when creating a new DefExpr, which in turn, generates the code that will call setDynamic(...) on the var when it is created at runtime. As far as I can tell, the :dynamic entry is irrelevant once that has occurred. It seems to be implemented only as a way to communicate (by way of the reader) with the compiler. Once the compiler's gotten the message, it isn't needed anymore. Keeping it around seems to just cause confusion. Dynamic vars created by the Java layer of Clojure core don't use the :dynamic mechanism, they just setDynamic() directly. That's why they don't have :dynamic in their meta-data map.
Or, perhaps one might consider, for 1.4, replacing :dynamic altogether and just enforcing the established naming convention: *earmuffs* are dynamic, everything-else isn't. (The compile warns about violations of this convention in 1.3.) |
| Comment by Andy Fingerhut [ 24/Feb/12 11:39 AM ] |
|
I recently noticed several lines like this one in core.clj. Depending upon how many symbols are like this, perhaps this method could be used to add :dynamic metadata to symbols in core, along with a unit test to verify that all symbols in core have :dynamic if and only if .isDynamic returns true? |
| Comment by Andy Fingerhut [ 24/Feb/12 12:41 PM ] |
|
Ugh. In my previous comment, by "several lines like this one" I meant to paste the following as an example: (alter-meta! #'agent assoc :added "1.0") |
[CLJ-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-705] Make sorted maps and sets implement j.u.SortedMap and SortedSet interfaces Created: 05/Jan/11 Updated: 02/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Rich Hickey | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Comments |
| Comment by Andy Fingerhut [ 02/Jun/12 2:29 PM ] |
|
This might be a duplicate of CLJ-248. See that one before working on this one, at least. |
[CLJ-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-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-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-865] Macroexpansion discards &form metadata Created: 26/Oct/11 Updated: 06/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 7 |
| Labels: | Compiler | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
As discussed in http://groups.google.com/group/clojure/browse_thread/thread/2690cb6ca0e8beb8 there is a "surprise factor" when type-hinting an expression that represents a macro, such as with (.length ^String (doto (identity "x") prn)). Here the doto macro discards the metadata on &form, causing a reflective lookup. This has the effect that while expressions representing function calls can be type-hinted, expressions representing macros in general cannot. The doto macro could be rewritten to respect its &form metadata, but doing this for every macro in existence would be tedious and error-prone. Instead, I propose a change to the compiler, to cause macroexpansion to hang onto the metadata automatically. The first patch attached adds a test for the behavior I propose: this test fails. After applying the second patch, the test passes. There are a couple points that merit further consideration before accepting my patch:
|
| Comments |
| Comment by Alan Malloy [ 28/Oct/11 1:12 AM ] |
|
So I went ahead and did the work of making this change in clojure.core/defmacro instead of clojure.lang.Compiler/macroexpand1. It was even worse than I expected: I didn't realize we don't yet have syntax-quote or apply at this stage in bootstrapping, so writing a non-trivial macroexpansion requires a huge amount of (list `foo (list `bar 'local-name)) and so forth. I'm sure the version I wrote is not optimal, but it seemed simpler to piggyback on defn, and then use alter-var-root to shim the metadata management in, than it would have been to expand to the correct thing in the first place. Anyway, attached patch #3 could be applied instead of #2 to resolve the issue in clojure.core instead of clojure.lang. The tests added in patch #1 pass either way. |
| Comment by Alan Malloy [ 13/Nov/11 8:29 PM ] |
|
I realized I can do this with a named private function instead of an anonymous function, reducing the amount of mess defmacro itself has to generate. Patch 4 is, I think, strictly better than Patch 3, if a Clojure implementation is preferred to one in Java. |
| Comment by Chouser [ 20/Nov/11 10:43 PM ] |
|
I prefer patch 0002 in Java over either 0003 or 0004. Patch 0002 keeps the knowledge of how to invoke macro fns (specifically the extra &form and &env args) in one place, macroexpand1 rather than duplicating that knowledge in core.clj as well. Note patch 0001 is just tests. The proposed default macroexpansion behavior is more useful than what we currently have, but there are two details I'd like to think about a bit more: 1) In exchange for a more useful default, macro writers lose the ability to consume their &form metadata and have control over the resulting form metadata without the &form metadata overridding it. That is, macros are no longer in complete control of their output form. 2) Rule (1) above has hardcoded exceptions for :line and :file, where &form metadata is unable to override the results returned by the macro. |
| Comment by Alan Malloy [ 01/Jun/12 2:04 PM ] |
|
This patch incorporates all previous patches to this issue. On the clj-dev mailing list, Andy Fingerhut suggested a new metadata key for allowing the macro author to specify "I've looked at their &form metadata, and this form is exactly what I want to expand to, please don't change the metadata any further." I've implemented this, and I think it addresses Chouser's concern about needing a way to "break out" of the improved-default behavior. One open question is, is :explicit-meta the right key to use? I spent some time tracking down a bug caused by my forgetting the keyword and using :explicit-metadata in my test; perhaps something more difficult to get confused by is available. |
[CLJ-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-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-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-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-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-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-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-1208] Namespace is not loaded on defrecord class init Created: 03/May/13 Updated: 03/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Tim McCormack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
As a user of Clojure interop from Java, I want defrecords (and deftypes?) to load their namespaces upon class initialization so that I can simply construct and use AOT'd record classes without manually requiring their namespaces first. Calling the defrecord's constructor may or may not result in "Attempting to call unbound fn" exceptions, depending on what code has already been run. This issue has been raised several times over the years, but I could not find an existing ticket for it:
|
[CLJ-1207] Importing a class that does not exist fails to report the name of the class that did not exist Created: 29/Apr/13 Updated: 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-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-1002] chunk-* functions not documented Created: 27/May/12 Updated: 27/May/12 |
|
| 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: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
None of the chunk related functions defined in core.clj have documentation. While their implementations are straightforward, it means the functions do not show up in http://clojure.org/api. Are these not considered part of the API? If so, should they be private? Otherwise, I think they should have public documentation. For searchability, the function are: chunk-append, chunk, chunk-first, chunk-rest, chunk-next, chunk-cons, chunked-seq? |
[CLJ-941] NullPointerException possible with seq-zip Created: 26/Feb/12 Updated: 26/Feb/12 |
|
| 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: | 0 |
| Labels: | None | ||
| Description |
|
For example: Clojure 1.3.0 Possibly the make-node function for seq-zip should be: (fn [node children] (with-meta (or children ()) (meta node))) |
| Comments |
| Comment by Greg Chapman [ 26/Feb/12 5:54 PM ] |
|
Also the docstring for zipper should probably be updated to indicate that the children parameter can be nil. |
[CLJ-750] clojure.lang.MapEntry violates .equals and .hashCode contracts of HashMap.Entry; leads to non-reflexive .equals, etc. Created: 02/Mar/11 Updated: 29/Jul/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2, Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Jason Wolfe | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
user> (let [h (HashMap.)] 3 994 false false true false clojure.lang.MapEntry does not follow the contracts of hashCode or equals for java.util.Map$Entry. This, among other things, leads to the above non-reflexive behavior of .equals. I realize this isn't a simple bug; it's a fundamental issue, in that it's impossible to consistently implement both java.util.List and java.util.Map$Entry, which clojure.lang.MapEntry claims to do. On balance I do find it very useful that Clojure map entries are equivalent to vectors, and probably wouldn't want to give that up. But, I think that at minimum this wart should be documented somewhere, since it could lead to some very strange and hard to catch bugs. |
| Comments |
| Comment by Jason Wolfe [ 02/Mar/11 10:13 PM ] |
|
This might be fixable by changing seq to promise a sequence of pairs rather than MapEntries. I don't know enough about Clojure internals to know if this would entail too large a performance hit, but perhaps it's worth considering. |
| Comment by Stuart Halloway [ 04/Mar/11 9:11 PM ] |
|
Rich: is there a doc patch you would want for this? |
| Comment by Rich Hickey [ 29/Jul/11 7:45 AM ] |
|
doc patch ok |
[CLJ-878] DispatchReader always calls CtorReader when no dispatch macro found Created: 15/Nov/11 Updated: 15/Nov/11 |
|
| 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: | 0 |
| Labels: | None | ||
| Environment: |
Windows 7, Java 1.7 |
||
| Description |
|
At the REPL, I accidentally typed: user=> # "\w+" You can see the confusing result (the REPL is also left in an unclosed string). After looking at LispReader.java, it seems to me DispatchReader ought to at least check for whitespace before calling CtorReader (perhaps better would be to check for a valid symbol character). Another example: user=> (defrecord X [x]) I'm assuming the fact that the above successfully creates an X is accidental. |
[CLJ-880] syntax-quote should be a macro instead of implemented inside the reader Created: 17/Nov/11 Updated: 17/Nov/11 |
|
| 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: | None | ||
| Description |
|
syntax-quote is currently a somewhat gnarly bit of java code in LispReader.java, would be great to replace it with a (hopefully less gnarly) clojure macro. LispReader.java would be required to do something similar to 'x => (quote x). `x => (syntax-quote x) , ~x => (unquote x), ~@x => (unquote-splicing x) |
[CLJ-946] eval reader fail to recognize function object Created: 06/Mar/12 Updated: 07/Mar/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Naitong Xiao | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
(defmacro stubbing [stub-forms & body] This macro is from Clojure In Action , whith the commented line rewrited (I know that original is better) (def ^:dynamic $ (fn [x] (* x 10)) (stubbing [$ 1] ;;macro can expanded I thought there is something wrong with eval reader, but i can't figure it out btw the above code can run on clojure-clr |
| Comments |
| Comment by Michael Klishin [ 06/Mar/12 11:24 PM ] |
|
As far as I know, Clojure in Action examples are written for Clojure 1.2. What version are you using? |
| Comment by Naitong Xiao [ 07/Mar/12 1:24 AM ] |
|
I use clojure 1.3 The example in Clojure In Action is Ok on clojure 1.3 |
[CLJ-1008] Make sorted maps and sets implement j.u.NavigableMap and NavigableSet interfaces Created: 02/Jun/12 Updated: 02/Jun/12 |
|
| 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: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Since Clojure 1.5 will probably no longer target JVM 5, add support for the (Concurrent)?Navigable(Map|Set) interfaces. This should involve adding functions to PersistentTreeMap that descend the red-black tree to select the closest items. |
[CLJ-938] Output of clojure.reflect is not suitable for type hints Created: 23/Feb/12 Updated: 24/Feb/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I'm trying to write a macro which generate reify forms using some reflection. clojure.reflect produces type symbols similar to 'java.util.Iterator<> Unfortunately, the compiler doesn't accept the <> syntax in type hints: (reify Iterable (^{:tag java.util.Iterator} iterator [this] nil)) ; works (reify Iterable (^{:tag java.util.Iterator<>} iterator [this] nil)) ;; fails It seems like the compiler should understand the <> just enough to strip it, rather than reject it. This would make it much easier to write correct macros involving type hinting and reflection. The workaround I have been using is: (defn hint |
| Comments |
| Comment by Brandon Bloom [ 24/Feb/12 1:37 AM ] |
|
I'm sorry, I got this wrong earlier. The problem is real, but it's arrays, not generics. My workaround is useless... :-/ |
[CLJ-1047] Simplify the process of requiring fj in clojure.core.reducers Created: 21/Aug/12 Updated: 21/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Nicola Mometto | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
this patch removes compile-if in favor of import-if, removing code duplication |
[CLJ-955] java object reader constructor doesn't work Created: 18/Mar/12 Updated: 19/Mar/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Brent Millare | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Here is a transcript: ;user=> clojure-version Another transcript from google groups https://groups.google.com/forum/?fromgroups&hl=en#!topic/clojure/vlsFgVaKcSQ user=> (def x #java.net.URL["file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"]) user=> (.getProtocol #java.net.URL["file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"]) user=> (.getProtocol #java.net.URL["file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"]) user=> (def x #java.net.URL["file:///home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"]) user=> (defmethod print-dup java.net.URL [o, ^java.io.Writer w] (.write w (str o))) |
| Comments |
| Comment by Andy Fingerhut [ 19/Mar/12 2:58 AM ] |
|
I've confirmed this behavior with 1.4.0 beta5. I've only tracked it down as far as finding the "Can't embed object in code" message, which is easy to find in Compiler.java in method emitValue. That exception is thrown because printString in RT.java throws an exception. It isn't clear to me what should be done instead, though. |
| Comment by Fogus [ 19/Mar/12 9:03 AM ] |
|
What would it mean to construct an arbitrary Java object for the purpose of embedding it in code in a generic way? You could say that it's just a matter of calling its constructor with the right args but very often in Java that is not enough to make an object considered "initialize". Sometimes there are init methods or putters or whatever that are required for object construction. So right there I hope it's clear that even though #some.Klass["foo"] provides a way to call an arbitrary constructor, it's in no way a guarantee that an instance is properly constructed. The reason that (for example) defrecords are embeddable anywhere is because we know for certain that the constructor creates a fully initialized instance. If you need to embed specific instances in your own code then you have two options:
Quick point of note: Your code (defmethod print-dup java.net.URL [o, ^java.io.Writer w] (.write w (str o))) Doesn't do what you think it does. It spits out exactly file:///home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs that Clojure reads in as a symbol. Something like the following might be more appropriate: (defmethod print-dup java.net.URL [o, ^java.io.Writer w] (.write w "#java.net.URL") (.write w (str [ (str o) ]))) (let [x #java.net.URL["file:///home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"]] (printf "(class x)=%s x='%s'\n" (class x) x) x) ; (class x)=class java.net.URL x='file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs' ;=> #<URL file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs> (.getProtocol *1) ;=> "file" |
| Comment by Brent Millare [ 19/Mar/12 10:09 AM ] |
|
Fogus, can you please elaborate on using clojure 1.4's tagged literal features. While I understand that you can define data-reader functions, for example (binding [*data-readers* {'user/f (fn [x] (java.io.File. (first x)))}] (read-string "#user/f [\"hello\"]")) ;=> #<File hello>
however, I feel this is only half a fix, compared with the first mentioned solution (involving print-dup), since clojure's tagged literals only are important for reading, not for printing. Does using tagged literals, so that (read-string (pr-str (read-string ...) works, imply that you must also define print methods per class? If this is true, it seems problematic since if different code wants to define different print methods, this will conflict since defining print-dup methods is global. Is there a good solution for printing objects depending on the context? As an alternative solution, I propose making the default print-method of all objects that didn't already have a printed representation to be a tagged literal, this way, users can customize what it means to read it. (See https://groups.google.com/forum/?fromgroups&hl=en#!topic/clojure/GdT5cO6JoSQ ) |
| Comment by Fogus [ 19/Mar/12 10:18 AM ] |
|
"Fogus, can you please elaborate on using clojure 1.4's tagged literal features." I can, but it falls outside of the scope of this particular ticket. It might be better to take the broader conversation to the design page at http://dev.clojure.org/display/design/Tagged+Literals and the clojure-dev list. Has the original motivation for this ticket been addressed? |
| Comment by Brent Millare [ 19/Mar/12 10:26 AM ] |
|
I think you've explained the underlying problem, so yes. One possible caveat might be that it may be a concern that the current error message is not telling that the underlying problem lies in an improperly initialized object. (or maybe it is, and that's the error message I should expect). |
[CLJ-1015] Standalone Clojure library for Java users Created: 14/Jun/12 Updated: 14/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Edward Z. Yang | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Many of Clojure's data structures (e.g. PersistentHashMap) may be of interest to the wider Java community, and would benefit from being packaged in a way that makes them easy to include in projects. While they are public (and thus can be accessed by way of clojure.lang), Clojure's classloader is implemented in a way such that Clojure files such as core.clj end up being loaded, even when an end-user is not interested in the Clojure environment itself. The Java classes could also use some documentation! I'd be happy to work on a patch but this change may require some restructuring of the build process, so it'd be good to get community sign-off first. |
| Comments |
| Comment by Andy Fingerhut [ 14/Jun/12 5:39 PM ] |
|
I am assuming this ticket is a request that the original Clojure distribution be modified to easily build such a library of data structures, and be maintained as a separate build target, going forward. Reference to related info: Below is a copy of most of a message from someone with userid Krukow posted to the Clojure Google group on June 3, 2012: https://groups.google.com/forum/?fromgroups#!topic/clojure/UyjmafY_ZE8 I created a project containing only the persistent data structures for use with Java et al. https://github.com/krukow/clj-ds It is the data structures only so no bootstrap penalty. There are also Java'ish "improvements" like basic Generics and improved performance on the iterator pattern. It's still on Clojure 1.3 (As far as I recall), but I am planning on taking another iteration. TODO:
|
[CLJ-900] Document defonce-like behavior of defmulti Created: 19/Dec/11 Updated: 19/Dec/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2, Release 1.3 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Minor |
| Reporter: | Rasmus Svensson | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | documentation | ||
| Description |
|
Since Clojure 1.2 defmulti behaves similarly to defonce. This fact, and how one deals with it when doing interactive development, does not seem to be documented anywhere. This issue pops up fairly regularly in the #clojure channel. Commit that introduced the change: https://github.com/clojure/clojure/commit/1b8d5001ba094053b24c55829994785be422cfbf I can volunteer to update the docstrings and (if I get access to it) the clojure.org page. |
[CLJ-1029] ns defmacro allows arbitrary execution of clojure.core fns Created: 23/Jul/12 Updated: 05/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2, Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Craig Brozefsky | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
all |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
The form: (ns foo (:print "I AM A ROBOT")) will print "I AM A ROBOT" This is because the defmacro takes the name of the first element of the reference, looks it up in the clojure.core namespace and invokes it on the rest of the args. This is minor, but it does mean that an otherwise declarative form is not executing code. |
| Comments |
| Comment by Alan Malloy [ 25/Jul/12 4:37 PM ] |
|
One apparent problem with this patch is that you throw an exception for :refer. You should add that, and make sure there aren't any others missing. Also, #{x y z} is better than (set [x y z]), and you should probably use pr-str rather than str, although I can't think of a case where it matters for the objects in question. |
| Comment by Andy Fingerhut [ 26/Jul/12 6:31 PM ] |
|
A more minor detail of patch formatting – please attach your patch in git format. See the instructions under the section heading "Development" on this web page: http://dev.clojure.org/display/design/JIRA+workflow |
| Comment by Craig Brozefsky [ 05/Aug/12 9:53 AM ] |
|
git format-patch version of the diff, with the edits suggested by other maintainers. |
| Comment by Craig Brozefsky [ 05/Aug/12 10:00 AM ] |
|
Alan: please note that :refer was not mentioned in the docstring for ns, or used in any of the unit tests for clojure. Are you sure that it is an expected argument, or just an arrangement that happens to work under the current ns macro? The docstring for 'refer itself says to use :use in ns macros instead of calling refer. I added "refer" to the set of accepted references all the same. |
[CLJ-776] seque broken for some BlockingQueues Created: 21/Apr/11 Updated: 22/Apr/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Pepijn de Vos | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
clojure.core/seque takes an optional argument that can be the initial capacity for a LinkedBlockingQueue or an instance of the BlockingQueue interface. PriorityBlockingQueue is such a class, but fails to work because seque makes a few assumptions about BlockingQueues that are not true for all BlockingQueues. user=> (def s (seque (java.util.concurrent.PriorityBlockingQueue. 100) (shuffle (range 100)))) user=> (seque (java.util.concurrent.SynchronousQueue.) (shuffle (range 100))) user=> (seque (java.util.concurrent.ArrayBlockingQueue. 10) (shuffle (range 100))) |
| Comments |
| Comment by Pepijn de Vos [ 21/Apr/11 11:32 AM ] |
|
A working implementation with some tests. |
| Comment by Pepijn de Vos [ 22/Apr/11 9:27 AM ] |
|
Attachement removed, I'm working on it here: https://gist.github.com/934781 |
[CLJ-809] fn's created using defn should not lexical shadow the var that holds them Created: 11/Jun/11 Updated: 29/Jul/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Kevin Downey | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
currently (defn foo [x] (foo x)) expands to something like (def foo because of this lexical shadowing self calls to fns defined with defn the lexical shadowing also breaks memoization if you create the 1.3 has changes to eliminate some of the cost of going through the var. since going through the var is much cheaper now it would be nice to http://groups.google.com/group/clojure-dev/browse_thread/thread/33b52b24616967f?hl=en |
| Comments |
| Comment by Kevin Downey [ 11/Jun/11 2:40 PM ] |
|
tests indicate that accessing the fn through the var vs. accessing through the lexical binding have very similar access times https://gist.github.com/1013008 results in $ java -jar clojure.jar ~/src/lexicaltest.clj |
| Comment by Jason Wolfe [ 13/Jun/11 5:05 PM ] |
|
Here's another test that makes sure no JIT funny business (e.g. dead code elimination) is going on, and also looks at primitive hinted versions. https://gist.github.com/1023816 var-obj result, time: 14930352 ,"Elapsed time: 965.577 msecs" I'm not sure how to properly hint the var in the var-prim version to get truly comparable results. In any case, this use case should definitely be kept in mind. |
| Comment by Kevin Downey [ 13/Jun/11 5:35 PM ] |
|
I think the point is we want to make sure the jvm can optimize both just as well, so making the code purposefully unoptimizable is kind of silly, yes? |
| Comment by Jason Wolfe [ 21/Jun/11 4:41 PM ] |
|
@Kevin In your gist, the return value of foo is not used, and foo has no side effects. A sufficiently smart compiler could optimize the calls out entirely, which would not tell us much about the runtime of foo. |
| Comment by Aaron Bedra [ 28/Jun/11 6:49 PM ] |
|
Rich: Given the performance testing (in the email thread) what is the next step here?
Are there things that this might break that we need to consider? |
| Comment by Rich Hickey [ 29/Jul/11 7:39 AM ] |
|
Someone needs to make a patch, and then test perf with and without the patch. These simulated tests aren't necessarily indicative. Naive fib is an ok test once you have a patch. And yes, more things might break - needs careful assessment. |
[CLJ-983] proxy-super does not restore original binding if call throws exception Created: 05/May/12 Updated: 05/May/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.1, Release 1.2, Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Valentin Mahrwald | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug | ||
| Attachments: |
|
| Description |
|
The code for proxy-call-with-super internally used by proxy-super does not handle exceptions from the call method: (defn proxy-call-with-super [call this meth] As a result the following sequence behaves unexpectedly: A try-finally block around the invocation would solve this particular issue. |
| Comments |
| Comment by Valentin Mahrwald [ 05/May/12 9:04 AM ] |
|
Test & fix patch on latest Clojure github branch. |
[CLJ-888] defprotocol should throw error when signatures include variable number of parameters Created: 29/Nov/11 Updated: 29/Nov/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Greg Chapman | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I tried to use & in the signature for a method in defprotocol. Apparently (see below), this is compiled so that & becomes a simple parameter name, and there is no special handling for variable number of parameters. I think the use of & in a protocol signature ought to be detected and immediately cause an exception (I also think this restriction on the signatures ought to be documented; I couldn't find it specified in the current documentation, though of course it is implied (as I later realized) by the fact that defprotocol creates a Java interface). user=> (defprotocol Applier (app [this f & args])) |
[CLJ-1039] Using 'def with metadata {:type :anything} throws ClassCastException Created: 09/Aug/12 Updated: 10/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Gunnar Völkel | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu, lein 1.7.1 - lein repl |
||
| Approval: | Vetted |
| Description |
|
In lein 1.7.1 (and CCW) the form (def ^{:type :anything} mydef 1) throws "ClassCastException clojure.lang.Var cannot be cast to clojure.lang.IObj clojure.core/with-meta (core.clj:211)". If it is intended to forbid setting the :type metadata, then there should be an appropriate error message instead of the ClassCastException In lein2 repl which is using "REPL-y 0.1.0-beta8" the exception does not occur. Full stacktrace: |
| Comments |
| Comment by Stuart Halloway [ 10/Aug/12 1:40 PM ] |
|
This is caused by the printer dispatch function (defmulti print-method (fn [x writer]
(let [t (get (meta x) :type)]
(if (keyword? t) t (class x)))))
which ends up calling the default dispatch, which tries to vary-meta. |
[CLJ-929] Accessing Java property starting with _ has issues in 1.4 Created: 07/Feb/12 Updated: 09/Feb/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When attempting to use interop syntax with symbols which aren't legal Java names (such as deleted?), the names are mangled a bit. That's necessary, of course, and the method of munging can be internal to the compiler. However, the behavior when munging changed a little between 1.3 and 1.4 beta1. Obviously the specifics of munging are something I should avoid relying on, but the way it changed looks like an accident or a bug even so. The use-case I ran into is that defrecords contain a field named __meta for tracking their metadata. In both 1.3 and 1.4 you can get at that field with (. record __meta), which avoids munging. But on 1.3 (. record --meta) also accesses it (translating each - to a _), while on 1.4 (. record -meta) works and (. record --meta) doesn't. Actually, looking at line 883 of Compiler.java, it looks like this may be related to the (. foo -property) syntax ported from CLJS, and indeed (. record ---meta) works, I guess by reducing to an "old style" (. record --meta). So that clears up why --meta fails: it's looking for __meta. I'm still not clear on why (. record -meta) works, though. So it looks like the - prefix for properties is not 100% backwards-compatible like it seemed to be. Is this an issue we need to fix, or is the recommendation simply to never have fields that start with - or _? |
| Comments |
| Comment by Fogus [ 09/Feb/12 2:33 PM ] |
|
Is this a general problem with fields starting with _ or just fields named __meta as in (defrecord [__meta] ...) |
| Comment by Alan Malloy [ 09/Feb/12 3:01 PM ] |
|
It's a general issue. (defrecord [__meta]) actually breaks immediately, because the record mechanism itself generates a field named __meta, but any field named with a - or _ prefix has this issue. user=> (defrecord Foo [-blah]) |
[CLJ-958] Make APersistentVector.iterator slightly more efficient Created: 23/Mar/12 Updated: 14/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Chris Gray | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Not Approved |
| Description |
|
The attached patch uses a sequence to create an iterator for persistent vectors. It should be slightly more efficient for PersistentVector objects than repeatedly calling nth (for reasons that I outline in the commit message). |
[CLJ-957] Typehints for variadic methods in deftype fail to compile Created: 22/Mar/12 Updated: 19/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Chris Gray | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Not Approved |
| Description |
|
When a method defined by a protocol has multiple typehinted signatures, it is impossible to implement them using deftype because deftype throws away the typehints. The compiler then looks for the proper signatures (i.e. with typehints) and throws an exception when it can't find them. |
| Comments |
| Comment by Chris Gray [ 22/Mar/12 5:41 PM ] |
|
Clojure-dev discussion started here: http://groups.google.com/group/clojure-dev/browse_thread/thread/1f106a21ec1ce3de |
| Comment by Andy Fingerhut [ 19/Aug/12 4:31 AM ] |
|
Patch clj-957-allow-typehinting-of-method-signatures-in-deftype-patch2.txt dated Aug 19 2012 is identical to Chris Gray's patch 0001-Allow-for-typehinting-of-method-signatures-in-deftyp.patch dated Mar 22, 2012, except it has some updated context lines so that it applies cleanly to latest master. |
[CLJ-668] Improve slurp performance by using native Java StringWriter and jio/copy Created: 01/Nov/10 Updated: 01/Nov/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Jürgen Hötzel | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Instead of copying each character from InputReader to StringBuffer. Performance improvement: From: user> (time (count (slurp "/home/juergen/test.dat"))) "Elapsed time: 4269.980863 msecs" 104857600 To: user> (time (count (slurp "/home/juergen/test.dat"))) "Elapsed time: 1140.854023 msecs" 104857600 Patch: http://github.com/juergenhoetzel/clojure/commit/af1a5713cd485ba5f1db25c37906ebaf7d474b47 |
[CLJ-997] max-key and min-key to return the first entry in case of several candidates Created: 18/May/12 Updated: 18/May/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Oleksandr Shyshko | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Consider the following code: (def values [[1 2] [3 4] [5] [6 7] [8]]) Which returns the last max entry [6 7]. Why its not the first max entry [1 2]? Consider the following example in Scala: println(List(List(0, 1, 2), List(2, 3, 4), List(1), List(1, 2, 3)).maxBy(_.length)) The very same function in Scala returns the first max entry (by default). The code from relase 1.4 file "clojure/core.clj#4419-4426" looks is: I am unsure what is the motivation in returning the last candidate, but I suggest two following things: 1. Make "max-key" and "min-key" return the first max/min entry if there are several candidates. This behavior seems more natural/convenient (to me), because in most cases you want to get first "winner". Line #4424 should have ">=" instead of ">". 2. Make "max-key" and "min-key" make warranty on order, which max/min entry will be returned (either first or last). Line #4420 should say "Returns the x for which (k x), a number, is greatest. In case of several matches, the first max entry will be returned" or the same doc, but saying "the last max entry will returned". |
| Comments |
| Comment by Steve Miner [ 18/May/12 4:03 PM ] |
|
The current behavior matches the documentation so I wouldn't consider it a "defect". There doesn't seem to be a compelling reason to impose a tie-breaker rule on the implementation. |
[CLJ-373] update-in with empty key paths Created: 04/Jun/10 Updated: 08/Sep/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Incomplete |
| Waiting On: | Chouser |
| Description |
|
To the topic of get-in and update-in. While I realize this is not a bug it is odd and in my eyes unexpected and unwanted behavior. get-in called with an empty path returns the hashmap it was given to walk through - this is as I expect and makes a lot of sense when dynamically (with generated pathes ) walking a hash map. update-in behaves differently and while from the implementation side, it's behavior too makes sense, it does not work as expected (at least not for me) update-in with an empty map creates a new key 'nil' so: (update-in {...} [] f) ist he same as (update-in {...} [nil] f) while (get-in {...} []) is not the same as (get-in {...} [nil]) and of cause differs from what update-in does. For automatically walking trees the behavior of get-in makes a lot more sense since the current behavior of update-in forces you to check for empty paths and if they are empty fall back to plain assoc and get (or get-in since this works): (if-let [r (butlast @path)] (do (alter m update-in r dissoc (last @path)) (alter m update-in r assoc {:name @sr} c)) (do (alter m dissoc (last @path)) (alter m assoc {:name @sr} c))) Next argument is that update-in with an empty map working on nil isn't easy to gasp, one needs to know the implementation details to realize that it works, I think 90% of the people reading update-in with [] will not instinctively know that it works on the key nil, so changing this would most likely not break any current code, and if it would the code would be bad anyway Chouser has, a very nice solution on the mailing list that would fix the problem I'm not sure if I'm entitled to post it here since I did not wrote it but it can be found in this thread: http://groups.google.com/group/clojure/browse_thread/thread/de5b20b8c3fe498b?hl=en Regards, |
| Comments |
| Comment by Assembla Importer [ 08/Oct/10 10:33 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/373 |
| Comment by Chouser [ 13/Nov/10 6:37 PM ] |
|
I've attached my code from the g.group thread in the form of a patch, in case it's sufficient. (Thanks to abedra for the gentle kick in the pants.) |
| Comment by Stuart Halloway [ 29/Nov/10 8:20 AM ] |
|
Looks to me like the patch is misusing if-let, e.g. (when-let [[k & mk] []] "Doh!")
=> Doh!
Please correct, and add tests for nil and [] keys (at least). |
| Comment by Scott Lowe [ 08/May/12 12:20 PM ] |
|
I will write some tests and correct this. |
| Comment by Scott Lowe [ 09/May/12 8:39 PM ] |
|
I'm sorry to report that my good intentions of wanting to help clear some of the project backlog has created more work by way of further questions. I'd also like to clarify the desired new behaviours for the test cases. Heinz proposed that an empty key sequence will not create a new nil key in the returned map.
(update-in {1 2} [] (constantly {2 3}))
{nil {2 3}, 1 2}
(update-in* {1 2} [] (constantly {2 3}))
{2 3}
(update-in {1 2} [] assoc 1 3)
{nil {1 3}, 1 2}
(update-in* {1 2} [] assoc 1 3)
{1 3}
Chouser also added that nil keys should be honoured, as before:
(update-in* {nil 2} [nil] (constantly 3))
{nil 3}
I've added a variety of tests to cover the existing behaviour and would like to confirm that the above is all that's required for new behaviour. The patch from November 2010 didn't work, but I tweaked it with a when-let as Stuart suggested and placed a check for an empty sequence of keys before the when-let block; because essentially, the primary behaviour change boils down to simply handling an empty sequence of keys, in addition to the existing behaviours. I'm not entirely convinced that these changes are a good thing, but at least there's now something concrete for discussion. Please have a look at what is there. The good news is that at least there are some tests covering update-in now. |
| Comment by Andy Fingerhut [ 24/May/12 10:35 PM ] |
|
clj-373-alter-behavior-of-update-in-with-empty-key-patch2.txt dated May 24, 2012 supersedes patch 0001-CLJ-373 |
| Comment by Fogus [ 15/Aug/12 11:21 AM ] |
|
This patch creates a new error mode highlighted by the following: (update-in {:a 1} [] inc)
; ClassCastException clojure.lang.PersistentArrayMap cannot be cast to java.lang.Number
The reason is that the code that executes in the event that the keys are empty (or nil) blindly assumes that the function given can be applied to the map itself. This is no problem in the case of assoc and the like, but clearly not for inc and many other useful functions. The old behavior was to throw an NPE and if any code relies on that fact is now broken. Maybe this is not a problem, but I'm kicking it back to get a little more discussion and to request that whatever the ultimate fix happens to be, its behavioral changes and error modes are noted in the docstring for update-in. |
| Comment by Gunnar Völkel [ 08/Sep/12 6:11 AM ] |
|
I vote for changing `update-in` to support empty key vectors. Because I think "(apply f m args)" in case of an empty vector is the natural continuation of the usual behavior of update-in:
Otherwise, you will always have to wrap update-in in something like the following when the keys vector is computed:
To Fogus' last post: (update-in {:a {:b 1}} [:a] inc) fails similar and is not handled with a special exception. |
[CLJ-1021] (let [i 5] (defmacro m [v] v) m) interprets m as a function, not a macro Created: 02/Jul/12 Updated: 13/Sep/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Zii Prime | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
(let [i 5] (defmacro m [& args] args) (def x (m (inc 5) (inc 6) (inc 7))) x m (meta #'m)) It appears to be interpreting m as a function despite the metadata. This behavior only shows up inside the (let ...). |
| Comments |
| Comment by Nicola Mometto [ 18/Aug/12 11:43 AM ] |
|
The problem is the same as the one for http://dev.clojure.org/jira/browse/CLJ-918 The patch linked there was mine but i had no CA signed at that time, and no account on jira. Here is the same patch in the correct format. Bug #918 should be closed as this is a duplicate |
[CLJ-1003] :100 is a valid Clojure keyword. Is that intentional? Created: 27/May/12 Updated: 13/Sep/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Brian Taylor | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In the latest clojure (eccde24c7), These parse as keywords: :100 This is an error: :a/100 Is this behavior intentional? In LispReader.java, the pattern for a symbol (and keyword) is "[:]?([\\D&&[^/]].*/)?([ http://clojure.org/reader says that none of my examples should parse. Clojurescript does not accept any of my examples, see |
| Comments |
| Comment by Andy Fingerhut [ 13/Sep/12 6:34 PM ] |
|
The reason that :100 parses as a keyword is that [ Whether this is intentional or not, my guess is probably not. Given that the docs at http://clojure.org/reader also say "A symbol can contain one or more non-repeating ':'s", writing a regexp that matches only what is documented there looks fairly complex. Clojure has a history of allowing things, without throwing exceptions or giving any other errors, even if they are documented as not legal. This may be one of those cases. Do not consider this last paragraph as any kind of authoritative answer. It is only my observation. |
[CLJ-1063] Missing dissoc-in Created: 07/Sep/12 Updated: 17/Sep/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Gunnar Völkel | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Not Approved |
| Description |
|
There is no clojure.core/dissoc-in although there is an assoc-in. |
| Comments |
| Comment by Andy Fingerhut [ 13/Sep/12 2:17 PM ] |
|
Patch clj-1063-add-dissoc-in-patch-v2.txt dated Sep 13 2012 supersedes 001-dissoc-in.diff dated Sep 7 2012. It fixes a typo (missing final " in doc string), and adds a test case for the new function. |
| Comment by Nicola Mometto [ 13/Sep/12 2:27 PM ] |
|
Thanks for the fix Andy |
| Comment by Andy Fingerhut [ 14/Sep/12 8:24 PM ] |
|
This proposed dissoc-in should be compared with the one in clojure.core.incubator which I just happened across. I see they look different, but haven't examined to see if there are any behavior differences. https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/incubator.clj |
| Comment by Nicola Mometto [ 15/Sep/12 6:43 AM ] |
|
dissoc-in in clojure.core.incubator recursively removes empty maps user=> (clojure.core.incubator/dissoc-in {:a {:b {:c 1}}} [:a :b :c]) while the one in this patch doesn't (as I would expect) user=> (dissoc-in {:a {:b {:c 1}}} [:a :b :c]) |
| Comment by Stuart Halloway [ 17/Sep/12 7:04 AM ] |
|
Please do this work in the incubator. |
[CLJ-1043] Unordered literals does not preserve left-to-right evaluation of arguments Created: 16/Aug/12 Updated: 23/Sep/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Given: (defn f [x] (println x) x) #{(f 2) (f 1)} Prints: 1 But expected would be: 2 This issue is related to CLJS-288 |
| Comments |
| Comment by Andy Fingerhut [ 23/Sep/12 6:01 PM ] |
|
I have the same question as David Nolen for CLJS-288: Is this a bug, or just behavior you didn't expect? It seems that vectors preserve the order of evaluation, so if you really want to control evaluation order you could use something like (set [(f 2) (f 1)]) or (set (map f [2 1])). |
| Comment by Brandon Bloom [ 23/Sep/12 7:38 PM ] |
|
I'd consider the expected default behavior of any syntax or macro to evaluate each sub-form once each, from left to right. Conditional, repeated, or out-of-order evaluation should be documented as deviations from that norm. If you buy that, then this is either a code or a documentation bug. My vote is for code bug. |
[CLJ-703] Improve writeClassFile performance Created: 04/Jan/11 Updated: 05/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Jürgen Hötzel | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
This Discussion about timing issues when writing class files led to the the current implementation of synchronous writes to disk. This leads to bad performance/system-load when compiling Clojure code. This Discussion questioned the current implentation. Synchronous writes are not necessary and also do not ensure (crash while calling write) valid classfiles. These Patches (0001 is just a code cleanup for creating the directory structure) ensures atomic creation of classfiles by using File.renameTo() |
| Comments |
| Comment by David Powell [ 17/Jan/11 2:16 PM ] |
|
Removing sync makes clojure build much faster. I wonder why it was added in the first place? I guess only Rich knows? I assume that it is not necessary. If we are removing sync though, I wouldn't bother with the atomic rename stuff. Doing that sort of thing can cause problems on some platforms, eg with search indexers and virus checkers momentarily locking files after they are created. The patch seems to be assuming that sync is there for some reason, but my initial assumption would be that sync isn't necessary - perhaps it was working around some issue that no longer exists? |
| Comment by Jürgen Hötzel [ 19/Jan/11 2:05 PM ] |
|
Although its unlikely: there is a possible race condition "loading a paritally written classfile"?: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L393 |
| Comment by John Szakmeister [ 25/May/12 4:22 AM ] |
|
The new improve-writeclassfile-perf version of the patch combines the two previous patches into a single patch file and brings them up-to-date with master. I can split the two changes back out into separate patch files if desired, but I figured out current tooling is more geared towards a single patch being applied. |
| Comment by John Szakmeister [ 25/May/12 4:36 AM ] |
|
FWIW, both fixes look sane. The first one is a nice cleanup. The second one is a little more interesting in that uses a rename operation to put the final file into place. It removes the sync call, which does make things faster. In general, if we're concerned about on-disk consistency, we should really have a combination of the two: write the full contents to a tmp file, sync it, and atomically rename to the destination file name. Neither the current master, nor the current patch will guarantee on-disk consistency across a machine wide crash. The current master could crash before the sync() occurs, leaving the file in an inconsistent state. With the patch, the OS may not get the file from file cache to disk before an OS level crash occurs, and leave the file in an inconsistent state as well. The benefit of the patch version is that the whole file does atomically come into view at once. It does have a nasty side effect of leaving around a temp file if the compiler crashes just before the rename though. Perhaps a little more work to catch an exception and clean up is in order? In general, I like the patched version better. |
| Comment by Ivan Kozik [ 05/Oct/12 7:07 PM ] |
|
File.renameTo returns false on (most?) errors, but the patch doesn't check for failure. Docs say "The return value should always be checked to make sure that the rename operation was successful." Failure might be especially likely on Windows, where files are opened by others without FILE_SHARE_DELETE. |
[CLJ-1087] clojure.data/diff uses set union on key seqs Created: 15/Oct/12 Updated: 15/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Tom Jack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug, performance | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
clojure.data/diff, on line 118, defines: java.util.Map (diff-similar [a b] (diff-associative a b (set/union (keys a) (keys b)))) Since keys returns a key seq, this seems like an error. clojure.set/union has strange and inconsistent behavior with regard to non-sets, and in this case the two key seqs are concatenated. Based on a cursory benchmark, it seems that this bug The patch is easy (just call set on each key seq). |
| Comments |
| Comment by Andy Fingerhut [ 15/Oct/12 2:52 PM ] |
|
clj-1087-diff-perf-enhance-patch-v1.txt dated Oct 15 2012 implements Tom's suggested performance enhancement, although not exactly in the way he suggested. It does calculate the union of the two key sequences. |
[CLJ-1097] node-seq for clojure.zip Created: 29/Oct/12 Updated: 29/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Timothy Baldridge | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | clojure.zip | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Many times it's easier to get to a zipper node via (first (filter pred ...)) instead of manually walking the tree via next/up/down. Other times it's easier to process certain nodes via filter & map instead of again, walking the tree. This patch provides a single function called node-seq that uses zip/next to generate a lazy-seq of nodes. Tests provide two examples. |
[CLJ-1107] 'get' should throw exception on non-Associative argument Created: 13/Nov/12 Updated: 13/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stuart Sierra | Assignee: | Stuart Sierra |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
The implementation of clojure.core/get returns null if its argument is not a valid associative collection. However, calling 'get' on something which is neither nil nor an Associative collection is almost certainly a bug, and should be indicated by an exception. This behavior can obscure common programmer errors such as: (def a (atom {:a 1 :b 2})
(:foo a) ; forgot to deref a
;;=> nil
Attached patch 0001 throws an IllegalArgumentException as the fall-through case of RT.getFrom. |
[CLJ-842] clojure.pprint uses the old-style metadata. Created: 26/Sep/11 Updated: 14/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Baishampayan Ghose | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
I was looking through the implementation of clojure.pprint.* and found that it still uses the old-style metadata to mark vars as private - ^{:private true} instead of ^:private. I have migrated the metadata to the new style in the attached trivial patch, which can be used in case this is deemed to be an issue. FWIW, there are some other namespaces which use the old-style metadata as well; I am willing to fix those as well. |
| Comments |
| Comment by Andy Fingerhut [ 14/Nov/12 1:19 PM ] |
|
clj-842-update-clojure.pprint-metadata-v2.txt dated Nov 14 2012 is identical to Baishampayan Ghose's 0001-Migrate-the-metadata-in-clojure.pprint.-to-the-new-s.patch dated Sep 26, 2011, except it applies cleanly to latest master. |
[CLJ-849] Add a pseudo-variable containing the current line number Created: 07/Oct/11 Updated: 14/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | G. Ralph Kuntz, MD | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Any |
||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Add a pseudo-variable (similar to *file*), containing the current line number. This should be available during AOT compilation. The name "*line-number*" might be good. It will be useful for diagnostic log messages. Using exception stack traces has poor runtime performance and the line number should be available to the compiler at minimal cost. |
| Comments |
| Comment by Peter Siewert [ 14/Nov/12 3:41 PM ] |
|
Adding initial patch. A symbol's position is now stored in its metadata, just like a seq when it is read with the LispReader. The Compiler.LINE and Compiler.COLUMN values are now updated as each symbol is analyzed. This provides more exact line and column numbers for Compiler errors which will resolve ticket CLJ-420. The Compiler.LINE variable has been interned as clojure.core/line-number Adding extra metadata to symbols resulted in some tests failing due to the extra values. The failing tests have been updated to ignore the new metadata keys. |
[CLJ-1113] `reductions` reducer Created: 23/Nov/12 Updated: 23/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Marshall T. Vandegrift | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
It would be nice to have a reducers implementation of the core `reductions` function. Initial implementation attempt included. This version requires an initial reduction value parameter (vs using (f)) and includes that initial value in the final reduction. I'm not certain either of these decisions is optimal, but results in a function which most closely mimics `clojure.core/reductions`. |
[CLJ-1049] Make reducer/folder support reduce-kv Created: 22/Aug/12 Updated: 23/Sep/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Tom Jack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Currently, although rfn makes an effort to support reduce-kv, it is wasted effort since the return values of reducer and folder don't satisfy IKVReduce. I have a working patch for this, it's quite small. I have printed a CA but not sent it, so I won't reveal the patch yet... This also applies to ClojureScript. |
| Comments |
| Comment by Tom Jack [ 15/Sep/12 12:47 AM ] |
|
Hmm.. it's not quite as simple as I thought. My first patch simply had reducer/folder implement IKVReduce with `(clojure.core.protocols/kv-reduce coll (xf f1) init)`, but for map and mapcat, this results in strange behavior (reduce-kv reducefs being called with only 2 args). Patch 0001 includes modifications to map and mapcat so that the reduce-kv reducef will always be called with 3 args. The previous implementation of mapcat also had the converse problem: during non-kv reduce, if the mapcat fn returned a map, the reducef would be called with 3 args since maps reduce with reduce-kv. The patch gives behavior like: user> (->> {1 {2 3 4 5} 6 {7 8 9 10}}
(r/mapcat #(r/map + %2))
(reduce-kv #(conj %1 [%2 %3]) []))
[[2 5] [4 9] [7 15] [9 19]]
user> (->> [{2 3 4 5} {7 8 9 10}]
(r/mapcat identity)
(r/reduce conj []))
[[2 3] [4 5] [7 8] [9 10]]
|
| Comment by Tom Jack [ 23/Sep/12 8:34 PM ] |
|
Would like to discuss these changes (and auto-kv for maps) on clojure-dev, but my membership is still pending. My CA has been received. Anyone know who to contact to get my membership approved? |
[CLJ-1056] defprotocol: invalid method overload syntax getting accepted Created: 01/Sep/12 Updated: 29/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | VÃctor M. Valenzuela | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
The compiler accepts both of these erroneous forms which while silly, are not imposible to come up with. (defprotocol Foo (f ([this]) ([this arg]))) |
| Comments |
| Comment by Timothy Baldridge [ 29/Nov/12 4:02 PM ] |
|
Can not reproduce the fist error: user=> (defprotocol Foo (f ([this]) ([this arg]))) But the 2nd one I can reproduce: user=> (defprotocol Bar (m [this]) (m [this arg])) Notice that :arglists only has one entry Vetting |
[CLJ-1090] Indirect function calls through Var instances fail to clear locals Created: 22/Oct/12 Updated: 30/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Spencer Tipping | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | performance | ||
| Environment: |
Probably all, but observed on Ubuntu 12.04, OpenJDK 6 |
||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
If you make a function call indirectly by invoking a Var object (which derefs itself and invokes the result), the invocation parameters remain in the thread's local stack for the duration of the function call, even though they are needed only long enough to be passed into the deref'd function. As a result, passing a lazy seq into a function invoked in its Var form may run out of memory if the seq is forced inside that function. For example: (defn total [xs] (reduce + 0 xs)) I can provide a patch if it would be useful. The fix should be trivial, something along the lines of wrapping each argN in clojure/lang/Var.java inside a Util.ret1(argN, argN = null) as is done in RestFn.java. |
| Comments |
| Comment by Spencer Tipping [ 23/Oct/12 1:37 PM ] |
|
Sorry, I typo'd the example. (defn total ...) should be (defn sum ...). |
| Comment by Timothy Baldridge [ 27/Nov/12 11:45 AM ] |
|
fixed typeo in example |
| Comment by Timothy Baldridge [ 27/Nov/12 11:47 AM ] |
|
Couldn't reproduce the exception, but the 2nd example did chew through about 4x the amount of memory. Vetting. |
| Comment by Timothy Baldridge [ 29/Nov/12 2:57 PM ] |
|
adding a patch. Since most of Clojure ends up running this code in one way or another, I'd assert that tests are included as part of the normal Clojure test process. Patch simply calls Util.ret1(argx, argx=null) on all invoke calls. |
| Comment by Timothy Baldridge [ 29/Nov/12 3:17 PM ] |
|
And as a note, both examples in the original report now have extremely similar memory usages. |
| Comment by Spencer Tipping [ 30/Nov/12 2:22 PM ] |
|
Sounds great, and the patch looks good too. Let me know if I need to do anything else. |
[CLJ-1102] Better handling of exceptions with empty stack traces Created: 04/Nov/12 Updated: 30/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
I don't know what I did to cause some exceptions to be thrown while running Clojure tests that return a length 0 array from (.getStackTrace throwable), but according to the Java docs this is legal. I searched all places in the Clojure code that call .getStackTrace and found two that don't handle this correctly, one of which causes an ArrayOutOfBoundsException (that is the one I found during my testing). |
| Comments |
| Comment by Andy Fingerhut [ 04/Nov/12 5:07 PM ] |
|
clj-1102-improve-empty-stack-trace-handling-v1.txt dated Nov 4 2012 improves the handling of .getStackTrace returning a length 0 array in two places. I checked all other places .getStackTrace was called and they seem to already handle this case gracefully. |
| Comment by Timothy Baldridge [ 30/Nov/12 2:57 PM ] |
|
Vetting. |
[CLJ-1103] Make conj assoc dissoc and transient versions handle args similarly Created: 04/Nov/12 Updated: 09/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
A discussion came up in the Clojure Google group about conj giving an error when taking only a coll as an argument, as opposed to disj which works for this case: https://groups.google.com/forum/?fromgroups=#!topic/clojure/Z9mFxsTYTqQ I looked through the rest of the code for similar cases, and found that conj! assoc assoc! and disj! also had the same property, and there were some other differences between them in how different numbers of arguments were handled, such as: conj handles an arbitrary number of arguments, but conj! does not. |
| Comments |
| Comment by Andy Fingerhut [ 04/Nov/12 6:04 PM ] |
|
clj-1103-make-conj-assoc-dissoc-handle-args-similarly-v1.txt dated Nov 4 2012 makes conj conj! assoc assoc! dissoc dissoc! handle args similarly to each other. |
| Comment by Brandon Bloom [ 09/Dec/12 5:30 PM ] |
|
I too ran into this and started an additional discussion here: https://groups.google.com/d/topic/clojure-dev/wL5hllfhw4M/discussion In particular, I don't buy the argument that (into coll xs) is sufficient, since into implies conj and there isn't an terse and idiomatic way to write (into map (parition 2 keyvals)) So +1 from me |
[CLJ-1124] for-as Created: 10/Dec/12 Updated: 10/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Yongqian Li | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
A common pattern in programming is building up some data structure step by step: In Python: [code] In an imperative for loop this is easy since we have easy access to the "current" data structure being built up. I propose the addition of a function for-as similar to as-> except the value of the last loop iteration is bound to the name. So we can write the above as: [code] An (un-optimized) implementation might be something like: [code] Note: reduce-for does not return a seq, instead it returns the result of the last loop body iteration. |
| Comments |
| Comment by Yongqian Li [ 10/Dec/12 11:31 PM ] |
|
(Fixed formatting) x = {0: 1}
for item in stuff:
x[item] = item * x.get(item - 1, 0)
(last (for-as [x {0 1}]
[item stuff]
(assoc x item (* item (get x (- item 1) 0)))))
(defmacro reduce-for [[res init] for-seq-exprs body-expr] `(reduce #(%2 %1) ~init (for ~for-seq-exprs (fn [~res] ~body-expr)))) (Someone please fix the formatting in above and delete this comment.) |
[CLJ-1128] Improve merge-with Created: 13/Dec/12 Updated: 13/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Edward Tsech | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Set a first map as an initial value for reduce to |
| Comments |
| Comment by Edward Tsech [ 13/Dec/12 1:36 PM ] |
|
Tests pass. |
| Comment by Andy Fingerhut [ 13/Dec/12 2:32 PM ] |
|
Edward, your patch replaces the expression (or m1 {}) with m1. It was changed from m1 to (or m1 {}) in a commit on Oct 16, 2008 with descriptive text "improved nil handling in merge, merge-with", so I am pretty sure it would be best to leave it as (or m1 {}). I believe the intent is to allow all but one of the map arguments to merge-with be nil, and everything will still work. The rest of the patch for avoiding one merge call seems sound to me. Your change would be even better at preserving any metadata on the first non-nil map in the list, if instead of calling with the first map, it called it with the first non-nil item of the list, and then the rest of the list after that. |
| Comment by Edward Tsech [ 13/Dec/12 5:41 PM ] |
|
I figured out that `reduce1` did pass a head of the list for me. I'm not sure about `(or m1 {})`. I don't see any problems which can happen. Probably behaviour of functions which are used internally was changed since 2008. (contains? nil :a) ;=> false I could write some tests for that. |
[CLJ-1119] inconsistent behavior of lazy-seq w/ macro & closure on excptions Created: 03/Dec/12 Updated: 16/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Hank | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
lazy-seq seems to evaluate inconsistently when body includes a macro and throws and exception. 1st evalutation throws the exceptions, subsequent ones return empty sequence. demo code: (defn gen-lazy [] (def lazy (gen-lazy)) (try (try It should throw an exception both times but only does on 1st. Generally speaking an expression shouldn't evaluate to different things depending on whether it's been evaluated before. When removing the closure ... (defn gen-lazy [] ... or removing the when-let macro ... (defn gen-lazy [] It works i.e. consistently throws the exception, so seems to be some interaction between the closure and the macro at work here. This particular combination is used in the 'map' function. See also: https://groups.google.com/forum/?fromgroups=#!topic/clojure/Z3EiBUQ7Inc |
| Comments |
| Comment by Hank [ 03/Dec/12 4:26 AM ] |
|
N.B. The primary use case I have for this, in case it matters, is interrupting the evaluation of a 'map' expression in which the mapped fn is slow to evaluate (throwing an InterruptedException), because I am not interested in its result any more. Then later I re-evaluate it because I am interested in the result after all, however with above bug the lazy sequence terminates instead of recommencing where it left off. (UPDATE: This use case is similar to the kind of ersatz continuations that Jetty does (RetryRequest runtime exception) or even Clojure itself when barging STM transactions with the RetryEx exception.) |
| Comment by Hank [ 03/Dec/12 8:45 AM ] |
|
Related to CLJ-457 according to Christophe. His patch fixes this,too. |
| Comment by Hank [ 04/Dec/12 5:02 AM ] |
|
Sorry Christophe's patch doesn't work for me here. It avoids evaluating the LazySeq a second time by prematurely throwing an exception. However a LazySeq might evaluate properly the second time around b/c the situation causing the exception was transient. As per comment above an evaluation might get interrupted, throwing InterruptedException the first time around but not the second time. Also the observation with the closure and macro need explanation IMHO. |
| Comment by Hank [ 08/Dec/12 3:51 AM ] |
|
further insight: 'delay' exhibits the same behavior and is a more simple case to examine. the macro suspicion is a red herring: as demoed below it is actually the closed over variable magically turns to nil, the when-let macro simply turned that into a nil for the whole expression. (def delayed (let [a true] (delay (print "a=" a) (throw (Exception.))))) (try (print "delayed 1:") (force delayed) (catch Exception ex (println ex))) (try (print "delayed 2:") (force delayed) (catch Exception ex (println ex))) prints: delayed 1:a= true#<Exception java.lang.Exception> |
| Comment by Hank [ 09/Dec/12 1:31 AM ] |
|
The above leads to dodgy outcomes such as: The following expression leads to an Exception on 1st evaluation and to "w00t!" on subsequent ones. (def delayed (let [a true] (delay (if a (throw (Exception.)) "w00t!")))) Try it like this: (try (print "delayed 1:" ) (println (force delayed)) (catch Exception ex (println ex))) (try (print "delayed 2:") (println (force delayed)) (catch Exception ex (println ex))) Results in: This code shows that the problem is tied to the :once flag as suspected. (def test-once (let [a true] (^{:once true} fn* foo [] (println "a=" a) (throw (Exception.))))) Invoking the fn twice will show 'a' turning from 'true' to 'nil', try it like this: (try (print "test-once 1:") (test-once) (catch Exception ex (println ex))) (try (print "test-once 2:") (test-once) (catch Exception ex (println ex))) Results in: That doesn't happen when the ^{:once true} is removed. Now one could argue that above fn is invoked twice, which is exactly what one is not supposed to do when decorated with the :once flag, but I argue that an unsuccessful call doesn't count as invocation towards the :once flag. The delay and lazy-seq macros agree with me there as the resulting objects are not considered realized (as per realized? function) if the evaluation of the body throws an exception, and realization/evaluation of the body is therefore repeated on re-evaluation of the delay/lazy-seq. Try this using (realized? delayed) The :once flag affects this part of the compiler only. Some field is set to nil there in the course of a function invocation, for the good reason of letting the garbage compiler collect objects, however this should to be done after the function successfully completes only. Can this be changed? |
| Comment by Hank [ 16/Dec/12 4:02 AM ] |
|
A workaround for the case of the 'map' function as described in the 1st comment, works as this: The original map function, if you take out the cases for several colls, the performance enhancements for chunked seqs and forcing the coll argument to a seq, looks like this: (defn map [f s]
(lazy-seq
(cons (f (first s)) (map f (rest s)))))
In my workaround I evaluate f twice: (defn map [f s]
(lazy-seq
(f (first s))
(cons (f (first s)) (map f (rest s)))))
Because the downstream functions that are slow to evaluate are all of the deref kind that cache their result (more lazy-seqs, delays, futures, promises), the InterruptedException can only happen during the 1st evaluation, while the tail call optimization that sets closed-over variables to nil (it pays to read this here: http://clojure.org/lazy) only happens on the second call. The first still creates an fn that captures the head of the sequence 's', however this is not being held onto as it is not returned. I use this special version of map (and other, similarly rewritten functions based on lazy-seq such as iterate) when I want interruptible, restartable seq evaluations. |
[CLJ-1132] For record type Rec, (instance? Rec (map->Rec {...})) need not return true, though (instance? Rec (Rec. ...)) does. Created: 18/Dec/12 Updated: 18/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Christopher Genovese | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | constructor, defrecord | ||
| Environment: |
Apache Tomcat/6.0.24 JVM/1.6.0_26-b03 Linux 2.6.32-279.el6.x86_64 Clojure 1.4.0, Ring 1.1.6, Compojure 1.1.3, Lein-Ring Plugin 0.7.5 (for lein ring uberwar) |
||
| Attachments: |
|
| Description |
|
(defrecord Rec ...) (instance? Rec (Rec. ...)) ;=> true (.getClassLoader Rec) ;=> WebappClassLoader (delegate: false, repositories: /WEB-INF/classes/, parent: org.apache.catalina.loader.StandardClassLoader@790bc49d) The map->Rec delegates to the create method, which seems to be where the problem lies. The record namespace is AOT compiled, properly I think/hope, and the requisite classes I have attached a minimal web app that reproduces the problem and shows Again, I've only been able to reproduce the problem under Tomcat, |
[CLJ-1133] Certain actions on mutable fields in deftype lead to very strange error messages Created: 18/Dec/12 Updated: 19/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Vladimir Matveev | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Archlinux x86_64, Windows 7 x86_64 |
||
| Description |
|
Consider the following code: (definterface Test (deftype TestImpl Its compilation fails with the following message: The following code works: (definterface Test (deftype TestImpl The only change here is that I have wrapped (dec x) form into (int) call. I understand that in fact the former code should not work anyway (or at least should not work as I have expected) because (dec) is defined as a call to clojure.lang.Numbers.dec(), which is overloaded for double, long and Object only (in fact, changing :tag int to :tag long in the first example allows the program to compile). However, the error message is completely uninformative and misleading; it also looks like that it is a consequence of compiler error. It is also not a problem of this concrete example; I found this error in more complex interface method implementation where (set!) call was right in the middle of its body. I'm using Clojure 1.4.0 and have experienced this problem on Archlinux x86_64 and Windows 7 x86_64. Full stack trace of the error, in case it would be helpful: java.lang.VerifyError: (class: test/TestImpl, method: fail signature: ()V) Expecting to find integer on stack, compiling |
| Comments |
| Comment by Vladimir Matveev [ 18/Dec/12 1:51 PM ] |
|
Shouldn't have set major priority; but I cannot edit issue again |
| Comment by Andy Fingerhut [ 19/Dec/12 1:20 AM ] |
|
Reduced priority to minor, since ticket creator could not do so themselves. |
[CLJ-835] defmulti doc string doesn't mention needing to be passed a var for the value of :hierarchy Created: 02/Sep/11 Updated: 19/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Hugo Duncan | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
1.2, 1.3 beta3 |
||
| Attachments: |
|
| Patch: | Code |
| Approval: | Incomplete |
| Description |
|
The :hierarchy option for defmulti should be passed a var, but this is not mentioned in the doc string. The error message from passing the hierarchy directly is rather cryptic: Evaluation aborted on java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.IRef (SOURCE_FORM_44:19). |
| Comments |
| Comment by Meikel Brandmeyer [ 14/Sep/11 3:11 PM ] |
|
Modified doctoring to clarify the usage of :hierarchy. |
| Comment by Scott Lowe [ 10/May/12 5:16 PM ] |
|
New patch: '0001-CLJ-835-Refine-doc-string-for-defmulti-hierarchy-opt.patch' 10/May/12. I've attached a new doc string patch in response to Andy Fingerhut's request posted here: https://groups.google.com/forum/?fromgroups#!topic/clojure-dev/i7H82fJYL-U Andy's request stated "Attached patch seems to have spelling mistakes, and perhaps could be worded more clearly." I hope my new patch is an improvement upon what was there. This patch supersedes '0001-Clarify-docstring-for-defmulti.patch' from 14/Sep/11. |
| Comment by Fogus [ 16/Aug/12 2:49 PM ] |
|
This is a million times better than what was there before, but (who knew!?) it could be better. A couple points of contention:
|
| Comment by Rich Hickey [ 19/Dec/12 7:58 AM ] |
|
Please leave examples out of docs strings. Use precise language. |
[CLJ-1137] Metadata on a def gets evaluated twice Created: 21/Dec/12 Updated: 21/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Ghadi Shayban | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Metadata on the symbol of a def special form is evaluated twice. (def ^{:foo (println "HA")} a []) prints out HA HA. Offending line is in Compiler$DefExpr, fixed. |
[CLJ-1120] Introduce ex-message and ex-cause to abstract away the platform in dealing with ExceptionInfo Created: 06/Dec/12 Updated: 21/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Michał Marczyk | Assignee: | Michał Marczyk |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
As described in the title. See |
| Comments |
| Comment by Michał Marczyk [ 06/Dec/12 6:23 AM ] |
|
The attached patch implements ex-message and ex-cause to work on arbitrary Throwables. |
[CLJ-1134] star-directive in clojure.pprint/cl-format with an at-prefix ("~n@*") do not obey its specifications Created: 18/Dec/12 Updated: 26/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Jean Niklas L'orange | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug, pprint | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
The star-directive in clojure.pprint/cl-format with an at-prefix (~n@*) does not obey its specifications according to Common Lisp the Language, 2nd Edition. There are two bugs within ~n@* as of right now:
What (small set of) steps will reproduce the problem?Inside a clean Clojure repl, perform these steps: user=> (require '[clojure.pprint :refer [cl-format]]) nil user=> (cl-format nil "~D ~3@*~D" 0 1 2 3) "0 0" ;; Expected: "0 3" user=> (cl-format nil "~D~D~D~D ~@*~D" 0 1 2 3) "0123 1" ;; Expected: "0123 0" What is the expected output? What do you see instead?The expected output is "0 3" and "0123 0", but is "0 0" and "0123 1" as shown above. What version are you using?Tested on both 1.4.0 and 1.5.0-beta2, both have the defect described. Please provide any additional information below.The format strings which reproduces the problem has been compared with the format function from the Common Lisp implementations SBCL, CLisp and Clozure. All of them print the expected output. |
| Comments |
| Comment by Jean Niklas L'orange [ 18/Dec/12 9:28 PM ] |
|
Patch attached. It may be easier to read the changes the patch does from within JIRA instead from the commit message, so I've added it here: This solves two issues as specified by #CLJ-1134. Issue #1 is solved by doing a Issue #2 is handled by changing the default n-parameter to * depending on In addition, new tests have been appended to test_cl_format.clj to ensure the |
[CLJ-1010] A left-to-right-variant of `comp` Created: 11/Jun/12 Updated: 14/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Tassilo Horn | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | enhancement, patch | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
The function composition function `comp` is quite inefficient in cases like `(apply comp large-seq-of-fns)`, because its arity-greater-than-3 version reverses the seq. I would be great if there was an alternative `comp*` (or whatever) function which is just like `comp` but composes left-to-right. |
| Comments |
| Comment by Tassilo Horn [ 11/Jun/12 5:16 AM ] |
|
Here's an implementation. |
| Comment by Tassilo Horn [ 11/Jun/12 12:41 PM ] |
|
There's something strange with my patch. The creation of a composition of a huge seq of functions is much faster with `comp*` than with `comp`, which is expected, because the seq doesn't need to be reversed. The strange thing however is that the compositions created with `comp` evaluate about 10-20% faster than those created with `comp*` although the arbitrary-arity version of `comp` is defined in terms of `comp*`: `(apply comp* (reverse (list* f1 f2 f3 fs)))`. For some benchmarking details, see: https://groups.google.com/d/msg/clojure/MizwTxHwLE4/hGLrMfetlP8J |
| Comment by Tassilo Horn [ 14/Jun/12 2:32 AM ] |
|
Here's some benchmark: user> (use 'criterium.core)
nil
user> (let [coll (doall (take 1000000 (repeat inc)))
f1 (apply comp* coll)
f2 (apply comp coll)]
(bench (f1 0) :verbose)
(println "---------------------------------------")
(bench (f2 0) :verbose))
amd64 Linux 3.4.2-gentoo 2 cpu(s)
OpenJDK 64-Bit Server VM 22.0-b10
Runtime arguments: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n -XX:+TieredCompilation -Xmx1G -Dclojure.compile.path=/home/horn/Repos/clj/testi/target/classes -Dtesti.version=0.1.0-SNAPSHOT -Dclojure.debug=false
Evaluation count : 600
Execution time mean : 112.324465 ms 95.0% CI: (112.247218 ms, 112.380682 ms)
Execution time std-deviation : 6.513809 ms 95.0% CI: (6.477450 ms, 6.553029 ms)
Execution time lower ci : 105.609401 ms 95.0% CI: (105.609401 ms, 105.622918 ms)
Execution time upper ci : 122.353763 ms 95.0% CI: (122.353763 ms, 122.405315 ms)
---------------------------------------
amd64 Linux 3.4.2-gentoo 2 cpu(s)
OpenJDK 64-Bit Server VM 22.0-b10
Runtime arguments: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n -XX:+TieredCompilation -Xmx1G -Dclojure.compile.path=/home/horn/Repos/clj/testi/target/classes -Dtesti.version=0.1.0-SNAPSHOT -Dclojure.debug=false
Evaluation count : 1440
Execution time mean : 43.519663 ms 95.0% CI: (43.516732 ms, 43.524062 ms)
Execution time std-deviation : 492.299089 us 95.0% CI: (490.829889 us, 494.198137 us)
Execution time lower ci : 42.781398 ms 95.0% CI: (42.781398 ms, 42.781398 ms)
Execution time upper ci : 44.157311 ms 95.0% CI: (44.157311 ms, 44.158513 ms)
nil
|
| Comment by Tassilo Horn [ 14/Jun/12 3:40 AM ] |
|
Ok, I've tracked down the performance difference. This comes from the fact that `reverse` creates a clojure.lang.PersistentList which can be iterated much faster than a (fully realized) LazySeq. If you provide your fncoll in `(apply comp* fncoll)` as vector or list, the application of the created composition is as fast as for `comp`. So for me, the patch is good and makes sense. |
[CLJ-1094] Zero-arity versions of every-pred and some-fn Created: 25/Oct/12 Updated: 25/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Tassilo Horn | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | patch, test | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
This patch adds zero-arity versions of every-pred and some-fn with these semantics. (every-pred) === (constantly true) (some-fn) === (constantly nil) These variants are useful in situations like the following: ;; compute-preds-for may return zero or many predicate fns (let [preds (compute-preds-for something)] (filter (apply every-pred preds) some-coll)) |
| Comments |
| Comment by Tassilo Horn [ 25/Oct/12 7:12 AM ] |
|
This is the thread where Max Penet suggested to have 0-arity versions of the two fns: https://groups.google.com/forum/?fromgroups=#!topic/clojure/IRlN-4LH_U0 |
[CLJ-1112] Var *loading-verbosely* should initialize from a JVM system property Created: 21/Nov/12 Updated: 22/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Howard Lewis Ship | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | patch | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
I often find myself adding :verbose to a (require) or (use) clause of my (ns) in order to debug problems (especially macros, or bad namespace declarations). It would be very nice if I could define a JVM system property (say -Dclojure.load-verbosely=true) to default loading-verbosely to true for a REPL session, or as part of a build. Sometimes I just like to see that namespaces load as a measure of progress, when starting an application, or when running a set of tests. |
| Comments |
| Comment by Tassilo Horn [ 22/Nov/12 2:12 AM ] |
|
This patch implements the suggested feature. The new system property is called clojure.core.loading-verbosely in analogy to the existing clojure.compile.warn-on-reflection. |
[CLJ-1130] Invoking a static method with the wrong number of arguments results in a NoSuchFieldException, rather than a proper message that the arguments could not be matched to the method Created: 17/Dec/12 Updated: 06/Jan/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 |
|
My code inadventently invoked a method that expected a single parameter, but passed no parameters. The exception: Exception in thread "main" java.lang.NoSuchFieldException: getService, compiling:(com/annadaletech/nexus/services/registry.clj:168) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6462) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6443) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.access$100(Compiler.java:37) at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:5883) .... Caused by: java.lang.NoSuchFieldException: getService at java.lang.Class.getField(Class.java:1520) at clojure.lang.Compiler$StaticFieldExpr.<init>(Compiler.java:1180) at clojure.lang.Compiler$HostExpr$Parser.parse(Compiler.java:923) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6455) ... 78 more That threw me for a bit; really, it looks like the compiler is attempting to access a field and invoke it as an IFn. However, a proper message would be "getService() requires 1 parameter, not 0" (or something to that effect). Even "invalid number of parameters for SmashRuntime/getService()" would be better. |
| Comments |
| Comment by Michael Drogalis [ 06/Jan/13 6:44 PM ] |
|
It looks like it's first trying to resolve a field by name, since field access with / is legal. For example: user=> (Integer/parseInt) user=> (Integer/MAX_VALUE) Would trying to resolve a method before a field fix this? |
[CLJ-1030] Misleading ClassCastException when coercing a String to int Created: 25/Jul/12 Updated: 06/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Philipp Meier | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Observed behaviour (int "0") => Expected behaviour |
| Comments |
| Comment by Andy Fingerhut [ 24/Sep/12 11:20 AM ] |
|
If someone wants to improve the behavior of int in this case, they should also consider similar improvements to the error messages for unchecked-int, char, and unchecked-char. |
| Comment by Michael Drogalis [ 06/Jan/13 8:45 PM ] |
|
Patch improved-int-char-casting-error-messages.diff on January 6, 2013. |
[CLJ-1086] Support arity-1 for ->> Created: 12/Oct/12 Updated: 12/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.1, Release 1.2, Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Shantanu Kumar | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
Clojure and ClojureScript |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Currently (as of Clojure 1.4) ->> doesn't support arity-1, though -> does. Arity-1 for ->> would be useful to let somebody comment out forms as follows: (->> foo #_(bar baz) #_quux) Discussion: https://groups.google.com/forum/?fromgroups=#!topic/clojure/_IVl0Tb7Au4 My name on contributor list page http://clojure.org/contributing is: Shantanu Kumar |
| Comments |
| Comment by Andy Fingerhut [ 08/Nov/12 1:37 PM ] |
|
Shantanu, you give your name on the contributing page, but I don't see it there. Is your CA in transit, perhaps? |
| Comment by Shantanu Kumar [ 08/Nov/12 1:43 PM ] |
|
@Andy I can see my name on the contributors page when I search for the text "Shantanu". My CA was submitted more than a year ago. |
| Comment by Andy Fingerhut [ 08/Nov/12 1:53 PM ] |
|
Right you are. I somehow accidentally got my browser to enable case matching, and was expecting it to search case insensitively. Sorry for the noise. |
| Comment by VÃctor M. Valenzuela [ 12/Jan/13 6:48 PM ] |
|
Just for the record, the patch provided at http://dev.clojure.org/jira/browse/CLJ-1121 addresses this issue. |
[CLJ-1033] pr-str and read-string don't handle @ symbols inside keywords properly Created: 26/Jul/12 Updated: 13/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Steven Ruppert | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | reader | ||
| Environment: |
Ubuntu 12.04 LTS; Java 1.7.0_05 Java HotSpot(TM) Client VM |
||
| Approval: | Vetted |
| Description |
user=> (read-string (pr-str {(keyword "key@other") :stuff}))
RuntimeException Map literal must contain an even number of forms clojure.lang.Util.runtimeException (Util.java:170)
pr-str emits "{:key@other :stuff}", which read-string fails to interpret correctly. Either pr-str needs to escape the @ symbol, or read-string needs to handle the symbol inside a keyword. Background: I'm passing a map with email addresses as keys through Storm bolts, which require a thrift-serializable form. Using the pr-str/read-string combo fails on these keys, so I've fallen back to JSON serialization. |
| Comments |
| Comment by Stuart Halloway [ 10/Aug/12 12:51 PM ] |
|
The '@' character is not a legal character for keywords or symbols (see http://clojure.org/reader). Recategorized as enhancement request. |
| Comment by Steven Ruppert [ 10/Aug/12 1:04 PM ] |
|
Then why doesn't (keyword "keywith@") throw an exception? It seems inconsistent with your statement. |
| Comment by Andy Fingerhut [ 13/Sep/12 2:23 PM ] |
|
It is a long standing property of Clojure that it does not throw exceptions for everything that is illegal. |
| Comment by Steven Ruppert [ 17/Sep/12 2:16 PM ] |
|
Yeah, but read-string clearly does. Is there a good reason that the "keyword" function can't throw an exception? With the other special rules on namespaces within symbol names, the "keyword" function really should be doing validation. Another solution would be to allow a ruby-like :"symbol with disallowed characters" literal, but that would also be confusing with how the namespace is handled. https://groups.google.com/forum/?fromgroups=#!topic/clojure/Ct5v9w0yNAE has some older discussion on this topic. |
| Comment by Andy Fingerhut [ 17/Sep/12 7:43 PM ] |
|
Disclaimer: I'm not a Clojure/core member, just an interested contributor who doesn't know all the design decisions that were made here. Steven, I think perhaps a couple of concerns are: (1) doing such checks would be slower than not doing them, and (2) implementing such checks means having to update them if/when the rules for legal symbols, keywords, namespace names, etc. change. Would you be interested in writing strict versions of functions like symbol and keyword for addition to a contrib library? And test suites that try to hit a significant number of corner cases in the rules for what is legal and what is not? I mean those as serious questions, not rhetorical ones. This would permit people that want to use the strict versions of these functions to do so, and at the same time make it easy to measure performance differences between the strict and loose versions. |
| Comment by Steven Ruppert [ 13/Jan/13 10:58 PM ] |
|
Looking back at this, the root cause of the problem is that the {pr} function, although it by default "print[s] in a way that objects can be read by the reader" [0], doesn't always do so. Thus, the easiest "fix" is to change its docstring to warn that not all keywords can be read back. The deeper problem is that symbol don't have a reader form that can represent all actually possible keywords (in this case, those with "@" in them). Restricting the actually-possible keywords to match the reader form, i.e. writing a strict "keyword" function actually seems like a worse solution overall to me. The better solution would be to somehow extend the keyword reader form to allow it to express all possible keywords, possibly ruby's :"keyword" syntax. Plus, that solution would avoid having to keep hypothetical strict keyword/symbol functions in sync with reader operation, and write test cases for that, and so on. Thus, the resolution of this bug comes down to how far we're willing to go. Changing the docstring would be the easiest, but extending the keyword form would be the "best" resolution, IMO. |
[CLJ-1149] Unhelpful error message from :use (and use function) when arguments are malformed Created: 17/Jan/13 Updated: 17/Jan/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: | Sean Corfield | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
the following exception happens when you have something like this(bad): (ns runtime.util-test as opposed to any of these(correct): (ns runtime.util-test (ns runtime.util-test and the exception is: Note that this is similar to the equally unhelpful message shown in http://dev.clojure.org/jira/browse/CLJ-1140 although that is a different root cause. Probably best to enhance the `use` function to validate its arguments before trying to apply hash-map? |
[CLJ-764] (partition 0 seq) and (parition-all 0 seq) are infinite sequences of empty sequences Created: 21/Mar/11 Updated: 21/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.1, Release 1.2 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Paul Stadig | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
(partition n seq) and (partition-all n seq) are implemented by taking n and dropping n from seq. When n=0 this becomes an infinite sequence of empty sequences. While conceptionally this makes sense, I think practically it may surprise people, and perhaps it should return an empty sequence or a sequence of a single empty sequence. |
| Comments |
| Comment by Paul Stadig [ 21/Mar/11 9:22 AM ] |
|
Ugh! I didn't mean for this to be major priority, and I can't seem to edit it after the fact. |
| Comment by Mike Anderson [ 21/Jan/13 5:40 AM ] |
|
I think the current behaviour is logically more correct than returning a empty sequence or a single empty sequence. In particular, I would expect (partition n infinite-seq) to return an infinite sequence of sequences of length n, for any value of n >= 0. Anything else would be very surprising. The only other sensible option would be throwing an exception, on the philosophical grounds that it isn't possible to partition a non-empty sequence into sub-sequences of length 0. But I think that changing behaviour in this way would break backwards compatibility for no obvious gain. I suggest closing this issue. |
[CLJ-1148] adds docstring support to defonce, and stops it from stomping existing metadata Created: 17/Jan/13 Updated: 17/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Joe Gallo | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Two issues here: 1) defonce doesn't support docstrings, although def does, so it would be nice to bring the two in line with each other 2) defonce can stomp metadata, like this: (defonce ^:private foo 5) |
[CLJ-1082] Subvecs of primitive vectors cannot be reduced Created: 05/Oct/12 Updated: 26/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Ghadi Shayban | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
1.7.0-08, OS X 10.8 |
||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
|
I could reproduce on current 10/05 git. Reduce doesn't work on subvecs of primitive vectors. If reduce on a subvec doesn't work then neither will nice ops like fold. How to cause: (let [prim-vec (into (vector-of :long) (range 10000))] ->> ClassCastException clojure.core.Vec cannot be cast to clojure.lang.PersistentVector clojure.lang.APersistentVector$SubVector.iterator (APersistentVector.java:523) |
| Comments |
| Comment by Timothy Baldridge [ 27/Nov/12 11:52 AM ] |
|
Confirmed to be broken on master. Vetting. Not sure what it's going to take to fix this, however. If this is of intrest for you, you might want to help push it along by providing a patch. |
| Comment by Andy Fingerhut [ 27/Nov/12 12:09 PM ] |
|
There is no code or ticket for this yet, but I wanted to mention that I've begun working on an implementation of RRB-Tree (Relaxed Radix Balanced Tree) vectors for Clojure (see discussion at https://groups.google.com/forum/?fromgroups=#!topic/clojure-dev/xnbtzTVEK9A). Assuming it is no big deal to get reducers to work on such vectors, subvec could be implemented in O(log n) time in such a way that the result was the same concrete type of vector as you started with, and thus reducers would work on them, too. It would mean O(log n) time for subvec instead of today's O(1), but this would likely fix other limitations that exist today with subvec's, e.g. CLJ-761. |
| Comment by Mike Anderson [ 20/Jan/13 5:14 AM ] |
|
I have a fix for this and a regression test in the tree below: https://github.com/mikera/clojure/tree/winfix Not sure how best to make this into a patch though - I also have the pprint fix in here (CLJ-1076) |
| Comment by Mike Anderson [ 20/Jan/13 6:41 PM ] |
|
Attached a patch that I created with: git format-patch winfix --stdout HEAD~3..HEAD > clj-1082.patch Does this do the trick? I had to use the HEAD~3..HEAD to just get the most recent 3 commits and exclude the pprint changes that I needed in order to build on Windows. |
| Comment by Mike Anderson [ 20/Jan/13 6:42 PM ] |
|
Patch for CLJ-1082, containing 3 commits |
| Comment by Andy Fingerhut [ 21/Jan/13 1:11 AM ] |
|
Mike, your patch clj-1082.patch applies cleanly to latest master for me, so looks like you found one way to do it. Another would be as follows, and closer to the directions on the JIRA workflow page: http://dev.clojure.org/display/design/JIRA+workflow (but not identical). Note that these commands would work on Mac OS X or Linux. I'm not sure what the correct corresponding command would be on Windows for the "git am" step below, unless that just happens to work because Windows and/or git implement the input redirection with "<" somehow.
From there on down it is the same as the instructions on the JIRA workflow page. The "git format-patch master --stdout > file.patch" will create a patch for the changes you have made in the current branch fix-clj-1082 starting from the master branch, which has the CLJ-1076 fix because of the 'git am' command above. |
[CLJ-1080] Eliminate many uses of reflection in Clojure code Created: 30/Sep/12 Updated: 07/Feb/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
There are dozens of uses of reflection in Clojure code that can be eliminated by adding suitable type hints. This patch adds the necessary type hints for most of those. |
| Comments |
| Comment by Andy Fingerhut [ 30/Sep/12 11:39 AM ] |
|
Patch clj-1080-eliminate-many-reflection-warnings-patch-v1.txt dated Sep 30 2012 adds type hints to eliminate many uses of reflection in Clojure core code. |
| Comment by Andy Fingerhut [ 14/Nov/12 1:26 PM ] |
|
clj-1080-eliminate-many-reflection-warnings-patch-v2.txt dated Nov 14 2012 is identical to the previous patch (to be removed soon), except it applies cleanly to latest master. |
| Comment by Andy Fingerhut [ 07/Feb/13 8:54 AM ] |
|
clj-1080-eliminate-many-reflection-warnings-patch-v3.txt dated Feb 7 2013 is identical to the previous patch (to be removed soon), except it applies cleanly to latest master. One type hint in the patch was added due to a different change, and was no longer needed in the patch. |
[CLJ-1159] clojure.java.io/delete-file doesn't return the status of the deletion(true/false) Created: 10/Feb/13 Updated: 10/Feb/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | AtKaaZ | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | delete-file, evil, or | ||
| Environment: |
any |
||
| Description |
|
initially reported it here(somehow): Basically clojure.java.io/delete-file doesn't ever return false (even when silently is true, it returns the value of silently), it's due to how it's implemented - but it's obvious from the code, so I'll stop here. Thanks. PS: this is what I'm using as my current workaround: I'm sure you guys can find a better way, but as a clojure newbie(really!) that's what I have. |
| Comments |
| Comment by AtKaaZ [ 10/Feb/13 2:01 PM ] |
|
I kinda just realized it affects all versions since and including 1.2, because it appears that its implementation was the same since then. If it's not meant to return the result of the delete, maybe it should specifically return nil and/or the doc say something? |
| Comment by Sean Corfield [ 10/Feb/13 2:21 PM ] |
|
As noted in a thread on the Clojure ML, you can pass a known value in the second argument position to detect a delete that failed: (clojure.java.io/delete-file some-file :not-deleted) This returns true on success and :not-deleted on failure. However the docstring could be better worded to make that intention clear. Perhaps: Delete file f. Return true if it succeeds. If silently is nil or false, raise an exception if it fails, else return the value of silently. |
[CLJ-706] make use of deprecated namespaces/vars easier to spot Created: 05/Jan/11 Updated: 13/Feb/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stuart Halloway | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
From the mailing list http://groups.google.com/group/clojure/msg/c41d909bd58e4534. It is easy to use deprecated namespaces without knowing you are doing so. The documentation warnings are small, and there is no compiler warning. Some possibilities include:
I don't love the idea of stderr warnings on all the time. Rich: is there an approach to this that you would like to see a patch for? |
| Comments |
| Comment by Rich Hickey [ 07/Jan/11 9:38 AM ] |
|
I don't mind warning to stderr |
| Comment by Luke VanderHart [ 26/Oct/12 1:37 PM ] |
|
706-deprecated-var-warning.diff adds warnings when using deprecated vars. The other three patches clean up deprecation warnings. |
| Comment by Andy Fingerhut [ 26/Oct/12 2:23 PM ] |
|
Great stuff. I looked through the first patch, and didn't see anything in there that lets someone disable deprecation warnings from the command line, the way that warn-on-reflection can today be set to true with a command line option. Is that something important to have for deprecation warnings? |
| Comment by Andy Fingerhut [ 28/Oct/12 4:57 PM ] |
|
I was hoping it would be quick and easy to add source file, line, and column info to the deprecation warning messages. It isn't as easy as adding them to the format() call, because the method analyzeSymbol doesn't receive these values as args. Is this deprecation check being done in a place where it is not easy to relate it to the source file, line, and column? Could it be done in a place where that info is easily available? |
| Comment by Ghadi Shayban [ 29/Oct/12 1:02 AM ] |
|
Another patch - this time to warn on loading deprecated namespaces, instead of vars. This patch requires the first one. Re: line/column, I'll figure out how to thread the compile context through if it's desired. Re: Compile flag. I have a patch for this also, but I'm still verifying how to invoke. How is warn-on-reflection set by command line? |
| Comment by Andy Fingerhut [ 29/Oct/12 1:43 AM ] |
|
Re: Compile flag. Don't hold off on implementing a flag if you want to, but it might be worth hearing from others whether such a command line option is even desired. I was asking in hopes of eliciting such a response. For the way that it is handled in the Clojure compiler, search for REFLECTION_WARNING_PROP and related code in Compile.java. If you invoke the Clojure compiler directly via a Java command line, use -Dclojure.compile.warn-on-reflection=true (default is false). See the recent email thread sent to Clojure Dev Google group if you want to know how to do it via ant or Maven. Link: https://mail.google.com/mail/?shva=1#label/clojure-dev/13aa0e34530196c3 There is also a separate command-line flag called compiler-options (see Compile.java) that is implemented as a map inside the compiler. It was added more recently than warn-on-reflection, and might be the preferred method to add more such options, to avoid having to continue to add more arguments to the pushThreadBindings calls done in several places. |
| Comment by Ghadi Shayban [ 29/Oct/12 10:36 AM ] |
|
Thanks, Andy. Alternately for the last ns patch, it is equivalent to call (print-method msg err), rather than binding out to err, may be more readable. I'll be glad to send that in if it's preferable. |
| Comment by Andy Fingerhut [ 13/Feb/13 12:38 AM ] |
|
706-deprecated-var-warning-patch-v2.txt dated Feb 12 2013 is identical to 706-deprecated-var-warning.diff dated Oct 26 2012, except it applies cleanly to latest master. |
[CLJ-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 |