[CLJ-21] GC Issue 17: arity checking during compilation Created: 17/Jun/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by richhickey, Dec 17, 2008 Use available metadata to check calls when possible |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 2:44 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/21 |
[CLJ-47] GC Issue 43: Dead code in generated bytecode Created: 17/Jun/09 Updated: 08/Oct/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
Reported by Levente.Santha, Jan 11, 2009 The bug was described in detail in this thread: http://groups.google.com/ group/clojure/browse_thread/thread/81ba15d7e9130441 For clojure.core$last__2954.invoke the correct bytecode would be (notice the removed "goto 65" after "41: goto 0"): public java.lang.Object invoke(java.lang.Object) throws java.lang.Exception; Code: 0: getstatic #22; //Field const__0:Lclojure/lang/Var; 3: invokevirtual #37; //Method clojure/lang/Var.get:()Ljava/lang/ Object; 6: checkcast #39; //class clojure/lang/IFn 9: aload_1 10: invokeinterface #41, 2; //InterfaceMethod clojure/lang/IFn.invoke: (Ljava/lang/Object;)Ljava/lang/Object; 15: dup 16: ifnull 44 19: getstatic #47; //Field java/lang/Boolean.FALSE:Ljava/lang/ Boolean; 22: if_acmpeq 45 25: getstatic #22; //Field const__0:Lclojure/lang/Var; 28: invokevirtual #37; //Method clojure/lang/Var.get:()Ljava/lang/ Object; 31: checkcast #39; //class clojure/lang/IFn 34: aload_1 35: invokeinterface #41, 2; //InterfaceMethod clojure/lang/IFn.invoke: (Ljava/lang/Object;)Ljava/lang/Object; 40: astore_1 41: goto 0 44: pop 45: getstatic #26; //Field const__1:Lclojure/lang/Var; 48: invokevirtual #37; //Method clojure/lang/Var.get:()Ljava/lang/ Object; 51: checkcast #39; //class clojure/lang/IFn 54: aload_1 55: aconst_null 56: astore_1 57: invokeinterface #41, 2; //InterfaceMethod clojure/lang/IFn.invoke: (Ljava/lang/Object;)Ljava/lang/Object; 62: areturn Our JIT reported incorrect stack size along the basic block introduced by the unneeded goto. The bug was present in SVN rev 1205. |
| Comments |
| Comment by Assembla Importer [ 08/Oct/10 10:21 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/47 |
| Comment by Assembla Importer [ 08/Oct/10 10:21 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Assembla Importer [ 08/Oct/10 10:21 AM ] |
|
aredington said: This appears to still be a problem with the generated bytecode in 1.3.0. Examining the bytecode for last, the problem has moved to invokeStatic: <pre> Line number 22 is an unreachable goto given the prior goto on line 19. |
[CLJ-64] GC Issue 61: Make Clojure datatype Java Serializable Created: 17/Jun/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by straszheimjeffrey, Jan 30, 2009 I mentioned this on Google Groups. Currently the core Clojure datatypes are not Java Serializable. This means that they cannot easily be streamed as binary objects. Also, it will be difficult to use them with certain Java features like RMI. Comment 1 by rob.nikander, Mar 11, 2009 I voted for this because I'm experimenting with using Clojure for web apps. Tomcat barfs trying to serialize objects in the session, like clojure.lang.Cons. Comment 2 by cjkent, Mar 25, 2009 I'm experimenting with Clojure and Wicket. Any Wicket page classes containing maps that use Keywords as keys can't be saved to the session because Keyword isn't serializable. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 2:44 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/64 |
| Comment by Assembla Importer [ 24/Aug/10 2:44 PM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Assembla Importer [ 24/Aug/10 2:44 PM ] |
|
cemerick said: A patch has been submitted (via ticket #174) to add Serializable support to c.l.Keyword. |
[CLJ-77] GC Issue 74: Clojure compiler emits too-large classfiles (results in ClassFormatError) Created: 17/Jun/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by cemer...@snowtide.com, Feb 10, 2009 The jvm has certain implementation limits around the maximum size of classfiles, literal strings, method length, etc; however, in certain circumstances, the Clojure compiler can currently emit classfiles that violate some of those limitations, causing an error later when the classfile is loaded. While test coverage would necessarily detect this sort of problem on a project-by-project basis when one's tests attempted to load a project's classfiles, it seems like Clojure should do the following to ensure failure as quickly as possible: - throw an exception immediately if, while compiling a lib, it is detected that the resulting classfile(s) would violate any classfile implementation limits. Ideally, the exception's message would detail what file and on which line number the offending form is (e.g. if a method's bytecode would be too long). I can imagine that doing this may not be straightforward; a reasonable stop-gap would be for the compiler to immediately attempt to load the generated classfile in order to ensure up-front failure. - emit a warning if any clojure form is read that would, upon being compiled, require violating any of the classfile implementation limits; I suspect that *most* people looking to generate classfiles would be doing so in a "build" environment (rather than loading some code, tinkering, and then using clojure.core/compile), but for those that aren't, I can imagine there being a good deal of frustration around seeing that loading and using some code successfully would eventually produce unusable classfiles. I've appended a sample stack trace emitted by java when it attempted to load a too-long method implementation (which was produced by embedding a large list literal in a compiled lib). Exception in thread "main" java.lang.ClassFormatError: Invalid method Code length 105496 in class file com/foo/MyClass__init at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:675) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:316) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java: 288) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java: 374) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at clojure.lang.RT.loadClassForName(RT.java:1512) at clojure.lang.RT.load(RT.java:394) at clojure.lang.RT.load(RT.java:374) at clojure.core$load__4911$fn__4913.invoke(core.clj:3623) at clojure.core$load__4911.doInvoke(core.clj:3622) at clojure.lang.RestFn.invoke(RestFn.java:413) at clojure.core$load_one__4863.invoke(core.clj:3467) at clojure.core$compile__4918$fn__4920.invoke(core.clj:3633) at clojure.core$compile__4918.invoke(core.clj:3632) at clojure.lang.Var.invoke(Var.java:336) at clojure.lang.Compile.main(Compile.java:56) |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/77 |
| Comment by Assembla Importer [ 24/Aug/10 6:45 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
[CLJ-115] GC Issue 111: Enable naming an array parameter for areduce Created: 17/Jun/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by bo...@boriska.com, Apr 28, 2009 Currently there is no way to access anonymous array parameter of areduce. Consider: (areduce (.. System getProperties values toArray) i r 0 (some_expression)) some_expression has no way to access the array. Per Rich: -------------------- Yes, areduce would be nicer if it looked like a binding set: (areduce [aname anarray, ret init] expr) (areduce [aname anarray, ret init, start-idx start-n] expr) (areduce [aname anarray, ret init, start-idx start-n, end-idx end-n] expr) -------------------- This was discussed here: http://groups.google.com/group/clojure/tree/browse_frm/thread/40597a8ac322bc37/8cf6b17328ea7e8b?rnum=1&_done=%2Fgroup%2Fclojure%2Fbrowse_frm%2Fthread%2F40597a8ac322bc37%2F8cf6b17328ea7e8b%3Ftvc%3D1%26pli%3D1%26#doc_9ea7e3c5d500ed3c |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 5:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/115 |
| Comment by Assembla Importer [ 24/Aug/10 5:45 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
[CLJ-126] abstract superclass with non-public accessibility Created: 17/Jun/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The following code works in Java 6 but not in Java 5: (def Clojure 1.1.0-alpha-SNAPSHOT This was discussed on the Clojure mailing list and Stephen C. Gillardi came up with the following conclusion: _StringBuilder extends AbstractStringBuilder (though the JavaDoc docs lie and say it extends Object). AbstractStringBuilder has default accessibility (not public, protected, or private) which makes the class inaccessible to code outside the java.lang package. In both Java SE 5 and Java SE 6, StringBuilder does not contain a .setCharAt method definition. It relies on the inherited public method in AbstractStringBuilder. (I downloaded the source code for both versions from Sun to check.) In Java SE 5, when Clojure checks whether or not .setCharAt on StringBuilder is public, it finds that it's a public method of a non-public base class and throws the exception you saw. (It looks like you're using a version of Clojure older than 18 May 2009 (Clojure svn r1371). Versions later than that print the more detailed message I saw.) In Java SE 6, Clojure's checks for accessibility of this method succeed and the method call works. I'm not sure whether or not Clojure could be modified to make this method call work in Java 5. Google searches turn up discussion that this pattern of using an undocumented abstract superclass with non-public accessibility is not common in the JDK._ This ticket is being filed in the event that Clojure can handle these types of situations somehow. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 4:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/126 |
| Comment by Assembla Importer [ 24/Aug/10 4:45 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Assembla Importer [ 24/Aug/10 4:45 AM ] |
|
hiredman said: Related association with ticket #259 was added |
[CLJ-127] DynamicClassLoader's call to ClassLoader.getSystemClassLoader is prohibited in some environments Created: 18/Jun/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Currently, clojure.lang.DynamicClassLoader's constructor has the super(EMPTY_URLS, (Thread.currentThread().getContextClassLoader() == null || Thread.currentThread().getContextClassLoader() == ClassLoader.getSystemClassLoader()) ? Compiler.class.getClassLoader() : Thread.currentThread().getContextClassLoader()); That call to ClassLoader.getSystemClassLoader() is forbidden by Google |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/127 |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
jmcconnell said: I'd be happy to take this up with the GAE folks if it winds up looking like this is something they should probably allow or if we need any further information from them on their policies. |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
richhickey said: Updating tickets (#127, #128, #129, #130) |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
mikehinchey said: GAE made some changes a few weeks ago, maybe changed this because I'm able to load from .clj files now (not the servlet, of course, which must be gen-class). |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
richhickey said: Updating tickets (#8, #42, #113, #2, #20, #94, #96, #104, #119, #124, #127, #149, #162) |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
mattrevelle said: J. McConnell, was this issue resolved by a change in GAE policy? |
[CLJ-150] Doc for array-map should mention its characteristics/caveats Created: 10/Jul/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
Doc for array-map should mention its characteristics: preserves order of keys, linear O |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 4:54 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/150 |
[CLJ-153] Suggest adding set-precision! API to accompany with-precision Created: 12/Jul/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
Ticket #137 makes math-context</code> settable at the REPL. However, <code>math-context is not a public name in Clojure. The related public function is with-precision</code> which works by pushing a new binding for <code>math-context</code>. This ticket suggests adding <code>set-precision!</code> to Clojure's public API. Its effect would be the same as <code>with-precision</code>, but accomplished by using <code>set!</code> on the current <code>math-context binding rather than by pushing a new binding. Chouser suggests that we also add a doc string for math-context</code> noting that it is private and pointing the user to <code>with-precision</code> and <code>set-precision!. I agree. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 12:55 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/153 |
[CLJ-140] Single :tag for type hints conflates value's type with type of return value from an invoke Created: 01/Jul/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
The value of a Var can be operated on directly, or, if it is a fn, it can be invoked and the resulting value operated on. :tag metadata on a Var is used to provide a type hint to the compiler to avoid reflection. Having a single metadata key for this two distinct uses makes it possible (even easy, if unlikely) to create a situation where type-hinting the value causes a ClassCastException on an operation on the invocation return value, or the reverse. The only obvious solution is two use different keys for the two uses. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:51 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/140 |
[CLJ-213] Invariants and the STM Created: 01/Dec/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
(ticket requested here http://groups.google.com/group/clojure/browse_thread/thread/119311e89fa46806/4903ce25ff6deaa6#4903ce25ff6deaa6) The general idea is to declare invariants inside a transaction and, when at commit time an invariant doesn't hold anymore, the transaction retries. See the attached file for quick prototype. User code would looks like: (invariant (@world :key)) (commute world update-in [:key] val-transform-fn) This means the commute will occur only if (@world :key) returns the same value in-transaction and at commit point. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 7:23 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/213 |
[CLJ-233] better error reporting of nonexistent var Created: 31/Dec/09 Updated: 29/Sep/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
simple improvement to error message when referencing a var that doesn't exist. |
| Comments |
| Comment by Assembla Importer [ 29/Sep/10 5:29 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/233 |
| Comment by Assembla Importer [ 29/Sep/10 5:29 AM ] |
|
chouser@n01se.net said: Stuart, I don't see a patch attached. |
[CLJ-252] Support typed non-primitive fields in deftype Created: 29/Jan/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Right now hints are accepted but not used as field type. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:07 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/252 |
[CLJ-277] Making clojure.xml/emit a little friendler to xml consumers Created: 03/Mar/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Currently, clojure.xml/emit breaks the eBay api, because emit adds whitespace before and after :contents. This trivial patch fixes it for me: (Dunno whether there's a good reason emit works that way, or if I'm missing something obvious.) I realize that emit's behavior conforms to the XML spec and it's probably eBay at fault here. But I can nevertheless see this whitespace causing problems. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 9:41 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/277 |
| Comment by Assembla Importer [ 24/Aug/10 9:41 AM ] |
|
bpsm said: I've attached a patch to #410, which also fixes this issue. (In fact, it turns out that it's the same patch tlj previously attached here.) |
| Comment by Assembla Importer [ 24/Aug/10 9:41 AM ] |
|
stu said: Duplicated association with ticket #410 was added |
[CLJ-319] TransactionalHashMap bug Created: 26/Apr/10 Updated: 01/Oct/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
TransactionalHashMap computation of the bin is buggy. The implementation doesn't unset the sign bit before using it in accessing the bin array which in some cases cause an ArrayOutOfBoundException to be thrown. As Rich Hickey has pointed out, this is an unsupported experimental Class and won't be fixed unless I provided a patch, so attached is the patch file. |
| Comments |
| Comment by Assembla Importer [ 01/Oct/10 4:06 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/319 |
| Comment by Assembla Importer [ 01/Oct/10 4:06 PM ] |
|
megabyte2021 said: [file:cuuZnsuuWr36H0eJe5dVir]: The patch file |
| Comment by Assembla Importer [ 01/Oct/10 4:06 PM ] |
|
stu said: Please add a test case. |
[CLJ-434] Additional copy methods for URLs in clojure.java.io Created: 10/Sep/10 Updated: 10/Sep/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The copy method in clojure.java.io doesn't handle java.net.URL as input. |
| Comments |
| Comment by Assembla Importer [ 10/Sep/10 7:32 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/434 |
[CLJ-459] RFE: modify description of "assoc" Created: 14/Oct/10 Updated: 14/Oct/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The documentation for "assoc" in clojure.core should probably (assoc vector index val) </code></pre> and <pre><code>(assoc vector index val & ivs) in the usage line. |
| Comments |
| Comment by Assembla Importer [ 14/Oct/10 4:55 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/459 |
[CLJ-148] Poor reporting of symbol conflicts when using (ns) Created: 10/Jul/09 Updated: 28/Jun/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
I have a module that includes pprint and my own utils. When com.howard.lewisship.cascade.dom/write was changed from private to public I get the following error: java.lang.IllegalStateException: write already refers to: #'clojure.contrib.pprint/write in namespace: com.howardlewisship.cascade.test-views (test_views.clj:0) (ns com.howardlewisship.cascade.test-views ; line 15 That line number is wrong but better yet, identifying the true conflict (com.howard.lewisship.cascade.dom/write) would be even more important. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:54 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/148 |
| Comment by Assembla Importer [ 24/Aug/10 3:54 AM ] |
|
scgilardi said: It's saying that the symbol com.howardlewisship.cascade.test-views/write already resolves to #���clojure.contrib.pprint/write, so you can't def a new write in com.howardlewisship.cascade.test-views. What do you propose for an alternate wording of the error message here? |
| Comment by Jeff Rose [ 12/May/11 9:49 AM ] |
|
I think the issue is that only one side of the conflict is reported in the error, so if you get this kind of error in the middle of a large project it can be hard to figure out which namespace is conflicting. Take a toy example: user=> (ns foo) In this case it would be best if the error said something like: "Conflict referring to #'bar/foobar in #<Namespace problem> because foobar already refers to: #'foo/foobar." This way the error message clearly identifies the location of the conflict, and the locations of the two conflicting vars. Hopefully this helps clarify. I think I see where to fix it in warnOrFailOnReplace on line 88 of src/jvm/clojure/lang/Namespace.java, and this reminds me I need to send in a CA so I can pitch in next time... |
| Comment by Aaron Bedra [ 28/Jun/11 6:42 PM ] |
|
It looks like the true conflict is in test-views, not in dom. A small example of the line number breakage showing the problem on master (1.3) would be very helpful. |
[CLJ-272] load/ns/require/use overhaul Created: 18/Feb/10 Updated: 28/Feb/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Description |
|
Creating this ticket to describe various things people have wanted to change about how ns works: Minimal needs
Other possibilities to discuss.
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 9:27 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/272 |
| Comment by Assembla Importer [ 24/Aug/10 9:27 AM ] |
|
stu said: Suggestions from Volkan Yazici: Hi, I saw your "load/ns/require/use overhaul" ticket[1] and would like to tr/edu/bilkent/cs/retop.clj In retop.clj, I have below ns definition. (ns tr.edu.bilkent.cs.retop And in every .clj file in retop/ directory I have below in-ns in the (in-ns 'tr.edu.bilkent.cs.retop) The problems with the ns decleration are: 1) Most of the :import's in retop.clj only belong to a single .clj file. (tr.edu.bilkent.cs.patoh imports are only used by graph.clj. Yep, I can add an (import ...) 2) See (:load ...) clause in (ns ...) form. There are lots of (:load Also, being able to use wildcards would be awesome. 3) There are inconsistencies between macros and functions. For instance, (ns foo.bar.baz (:use mov)) I'd like to get rid of quotations in both cases. I'm not sure if I'm using the right tools and doing the right approach |
| Comment by Assembla Importer [ 24/Aug/10 9:27 AM ] |
|
stuart.sierra said: My requests: 1. If writing macros that do not evaluate their arguments, provide function versions that do evaluate their arguments. 2. Do not support prefix lists for loading Clojure namespaces. It's hard to parse with external tools. 3. Do not conflate importing Java classes with loading Clojure namespaces. They are fundamentally different operations with different semantics. I have implemented some ideas in a macro called "need" at http://github.com/stuartsierra/need |
| Comment by Stuart Sierra [ 12/Dec/10 4:08 PM ] |
|
Further requests: Permit tools to read the "ns" declaration and statically determine the dependencies of a namespace, without evaluating any code. |
| Comment by Paudi Moriarty [ 28/Feb/12 3:56 AM ] |
This would be great for building OSGi bundles where Bnd is currently not much help. |
[CLJ-400] A faster flatten Created: 13/Jul/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
As discussed in this thread, I am submitting a more performant version of flatten for review. It has the same semantics as the current core/flatten. I have also updated the doc string to say that "(flatten nil) returns the empty list", because that's what the current version of core/flatten does as well. I haven't mailed in a CA yet, but I will tomorrow morning. Edit: Of course I'd mess my first ticket up |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 12:19 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/400 |
[CLJ-190] enhance with-open to be extensible with a new close multimethod Created: 13/Sep/09 Updated: 23/Dec/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
Discussion: http://groups.google.com/group/clojure/browse_thread/thread/8e4e56f6fc65cc8e/618a893a5b2a5410 Currently, with-open calls .close when it's finished. I'd like it to have a (defmulti close type) so it's behavior is extensible. A standard method could be defined for java.io.Closeable and a :default method with no type hint. I've come across a few cases where some external library defines what is essentially a close method but names it shutdown or disable, etc., and adding my own "defmethod close" would be much easier than rewriting with-open. This would also allow people to eliminate reflection for classes like sql Connection that were created before Closeable. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 4:30 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/190 |
| Comment by Assembla Importer [ 24/Aug/10 4:30 AM ] |
|
mikehinchey said: [file:ca27R6Ojur3PQ0eJe5afGb]: fix adds close method and tests |
| Comment by Assembla Importer [ 24/Aug/10 4:30 AM ] |
|
mikehinchey said: Note, I only defined methods for :default (reflection of .close) and Closeable, not sql or the numerous other classes in java that should be Closeable but are not. Maybe clojure.contrib.sql and other such libraries should define related close methods. |
| Comment by Assembla Importer [ 24/Aug/10 4:30 AM ] |
|
richhickey said: I want to hold off on this until scopes are in |
| Comment by Tassilo Horn [ 23/Dec/11 6:50 AM ] |
|
Probably better implemented using a protocol. See http://dev.clojure.org/jira/browse/CLJ-308 |
[CLJ-450] Add default predicate argument to filter, every?, take-while Created: 01/Oct/10 Updated: 27/Apr/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Some seq processing functions that take predicates could be improved by the addition of a default value of identity for the predicate argument. This has been discussed on the mailing list, and people seem favorable: I can put together a patch. |
| Comments |
| Comment by Assembla Importer [ 01/Oct/10 4:39 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/450 |
| Comment by Jason Orendorff [ 13/Mar/12 2:51 PM ] |
|
I independently wanted this. Here's a patch for: some, not-any?, every?, not-every?. If this is roughly what's wanted I'll be happy to add filter, remove, take-while, drop-while. |
| Comment by Jason Orendorff [ 13/Mar/12 4:57 PM ] |
|
Note that there are a few cases of (every? identity ...) and (some identity ...) in core.clj itself; the patch removes "identity" from those. |
| Comment by Andy Fingerhut [ 26/Apr/12 7:51 PM ] |
|
clj-450-add-default-pred-arg-to-core-fns-patch.txt dated Apr 26 2012 is identical to Jason Orendorff's, except it is in git format. Jason is not on the list of Clojure contributors as of today. I have sent him an email asking if he has done so, or is planning to. |
| Comment by Jason Orendorff [ 27/Apr/12 10:35 AM ] |
|
Of course I'd be happy to send in a contributor agreement. ...Is there actually any interest in taking this patch or something like it? |
| Comment by Andy Fingerhut [ 27/Apr/12 11:38 AM ] |
|
I don't know if there is any interest in taking this patch. Perhaps a Clojure screener will take a look at it and comment, but I am not a screener and can't promise anything. |
[CLJ-451] fn literals lack name/arglists/namespace metadata Created: 05/Oct/10 Updated: 05/Oct/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
I would expect (meta (fn not-so-anonymous [a b c])) to include {:name not-so-anonymous :arglists ([a b c])} alongside line number information and possibly namespace/file as well, but currently it only includes :line. |
| Comments |
| Comment by Assembla Importer [ 05/Oct/10 12:29 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/451 |
[CLJ-396] Better support for multiple inheritance in hierarchies and multimethods Created: 07/Jul/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
While the hierarchies produced with 'derive' allow multiple parents per child, there is no way to indicate precedence between those parents, other than by laboriously specifying 'prefer-method' for every type X every multimethod. When 2 multimethods are both applicable to the supplied arguments, Clojure produces a nonspecific IllegalArgumentException containing only an error string. All this means that while Clojure does have an "inheritance" mechanism in the form of the ad hoc hierarchies, it is currently not really possible to implement multiple inheritance using the ad hoc hierarchy mechanism. 'Prefer-method' will not scale up to use in large applications with complex type hierarchies and heavy use of multimethods. Some potential ways to solve this are:
Paul |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 11:06 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/396 |
[CLJ-405] better error messages for bad defrecord calls Created: 20/Jul/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
defrecord could tell you if, e.g., you didn't specify an interface before leaping into method bodies. See http://groups.google.com/group/clojure/browse_thread/thread/f52f90954edd8b09 |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 12:28 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/405 |
| Comment by Assembla Importer [ 24/Aug/10 12:28 AM ] |
|
stu said: This could be fixed with an assert-valid-defrecord call in core_deftype, similar to assert-valid-fdecl in core.clj. Such a function would also be a place to hang other defrecord error messages. |
[CLJ-379] problem with classloader when run as windows service Created: 13/Jun/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I found following error when I run clojure application as MS Windows service (via procrun from Apache Daemon project). When I tried to do 'require' during run-time, I got NullPointerException. This happened as baseLoader function from RT class returned null in such environment (the value of Thread.currentThread().getContextClassLoader()). (Although my app works fine when I run my application as standalone program, not as service). (.setContextClassLoader (Thread/currentThread) (java.lang.ClassLoader/getSystemClassLoader)) before any call to 'require'.... May be you need to modify 'baseLoader' function, so it will check is value of Thread.currentThread().getContextClassLoader() is null or not, and if null, then return value of java.lang.ClassLoader.getSystemClassLoader() ? |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 10:40 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/379 |
| Comment by Assembla Importer [ 24/Aug/10 10:40 AM ] |
|
alexott said: possible fix is attached |
| Comment by Assembla Importer [ 24/Aug/10 10:40 AM ] |
|
alexott said: [file:c5XWHcD4yr34HveJe5ccaP] |
[CLJ-130] Namespace metadata lost in AOT compile Created: 19/Jun/09 Updated: 03/Dec/10 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
For example, the namespace @clojure.contrib.def@ has metadata for doc and author. We see this when we load the file directly from source: But if we load the file from the jar where it's been compiled, the metadata is lost: Even if we use @load@, we don't see metadata on the item: The jar isn't the problem, for if we use the slim jar (without the AOT This seems to be true usually, but not always. For example the |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/130 |
| Comment by Assembla Importer [ 24/Aug/10 6:45 AM ] |
|
richhickey said: Updating tickets (#127, #128, #129, #130) |
| Comment by Assembla Importer [ 24/Aug/10 6:45 AM ] |
|
juergenhoetzel said: This is still a issue on Clojure 1.2.0-master-SNAPSHOT Any progress, hints? I prefer interactive documentiation via slime/repl |
[CLJ-401] Promote "seqable?" from contrib? Created: 13/Jul/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
This was vaguely discussed here and could potenntially help this ticket as well as be generally useful. I don't speak for everyone but when I saw sequential? I assumed it would have the semantics that seqable? does. Just my opinion, I'd love to hear someone's who is more informed than mine. In the proposed patch referenced in the ticket above, if seqable? could be used in place of sequential? flatten could be more powerful and work with maps/sets/java collections. Here's how it would look: (defn flatten [coll]
(lazy-seq
(when-let [coll (seq coll)]
(let [x (first coll)]
(if (seqable? x)
(concat (flatten x) (flatten (next coll)))
(cons x (flatten (next coll))))))))
And an example: user=> (flatten #{1 2 3 #{4 5 {6 {7 8 9 10 #tok1-block-tok}}}}) |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 9:19 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/401 |
[CLJ-112] GC Issue 108: All Clojure interfaces should specify CharSequence instead of String when possible Created: 17/Jun/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by redchin, Apr 20, 2009
rhickey: unlink: then just use a map {:escaped true :val "foo"}
unlink: What I meant is, everything in between would want to see something
String-y, not caring whether it's a String or MyString.
hiredman: unlink: if you use something that implements CharSequence and
IMeta (I think it's IMeta) you get something that is basically a String,
but with metadata
rhickey: what hiredman said
hiredman: ideally most things would not specify String but CharSequence in
their interface
hiredman: but somehow I doubt that is case
unlink: ok.
unlink: Good to know.
rhickey: hiredman: unfortunately that's not true of some of Clojure - could
you enter an issue for it please - use CharSequence when possible?
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/112 |
| Comment by Assembla Importer [ 24/Aug/10 3:45 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
[CLJ-440] java method calls cannot omit varargs Created: 27/Sep/10 Updated: 29/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 5 |
| Labels: | None | ||
| Description |
|
From http://groups.google.com/group/clojure/browse_thread/thread/7d0d6cb32656a621 E.g., trying to call java.util.Collections.addAll(Collection c, T... elements) user=> (Collections/addAll [] (object-array 0)) false user=> (Collections/addAll []) IllegalArgumentException No matching method: addAll clojure.lang.Compiler$StaticMethodExpr.<init> (Compiler.java:1401) The Method class provides an isVarArg() method, which could be used to inform the compiler to process things differently. |
| Comments |
| Comment by Assembla Importer [ 27/Sep/10 8:19 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/440 |
| Comment by Alexander Taggart [ 01/Apr/11 11:16 PM ] |
|
Patch adds support for varargs. Builds on top of patch in CLJ-445. |
| Comment by Alexander Taggart [ 05/Apr/11 5:45 PM ] |
|
Patch updated to current CLJ-445 patch. |
| Comment by Nick Klauer [ 29/Oct/12 8:12 AM ] |
|
Is this ticket on hold? I find myself typing (.someCall arg1 arg2 (into-array SomeType nil)) alot just to get the right method to be called. This ticket sounds like it would address that extraneous into-array arg that I use alot. |
| Comment by Andy Fingerhut [ 29/Oct/12 10:45 AM ] |
|
fixbug445.diff uploaded on Oct 29 2012 was written Oct 23 2010 by Alexander Taggart. I am simply copying it from the old Assembla ticket tracking system to here to make it more easily accessible. Not surprisingy, it doesn't apply cleanly to latest master. I don't know how much effort it would be to update it, but only a few hunks do not apply cleanly according to 'patch'. See the "Updating stale patches" section on the JIRA workflow page here: http://dev.clojure.org/display/design/JIRA+workflow |
| Comment by Andy Fingerhut [ 29/Oct/12 10:56 AM ] |
|
Ugh. Deleted the attachment because it was for CLJ-445, or at least it was named that way. CLJ-445 definitely has a long comment history, so if one or more of its patches address this issue, then you can read the discussion there to see the history. I don't know of any "on hold" status for tickets, except for one or two where Rich Hickey has explicitly said in a comment that he wants to wait a while before making the change. There are just tickets that contributors choose to work on and ones that screeners choose to screen. |
[CLJ-19] GC Issue 15: JavaDoc for interfaces Created: 17/Jun/09 Updated: 17/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by richhickey, Dec 17, 2008 Add JavaDoc to those interfaces supported for public use - IFn, IPersistentCollection etc. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:44 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/19 |
| Comment by Assembla Importer [ 24/Aug/10 6:44 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Kevin Downey [ 17/Nov/12 8:05 PM ] |
|
this seems like a great task for someone just starting out contributing to clojure. |
[CLJ-274] cannot close over mutable fields (in deftype) Created: 23/Feb/10 Updated: 01/Oct/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
Simplest case: user=> java.lang.IllegalArgumentException: Cannot assign to non-mutable: val (NO_SOURCE_FILE:5) Functions should be able to mutate mutable fields in their surrounding deftype (just like inner classes do in Java). Filed as bug, because the loop special form expands into a fn form sometimes: user=> |
| Comments |
| Comment by Assembla Importer [ 01/Oct/10 9:35 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/274 |
| Comment by Assembla Importer [ 01/Oct/10 9:35 AM ] |
|
donmullen said: Updated each run to [_] for new syntax. Now gives exception listed. |
| Comment by Assembla Importer [ 01/Oct/10 9:35 AM ] |
|
richhickey said: We're not going to allow closing over mutable fields. Instead we'll have to generate something other than fn for loops et al used as expressions. Not going to come before cinc |
[CLJ-15] GC Issue 11: incremental hashcode calculation for collections Created: 17/Jun/09 Updated: 08/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
Reported by richhickey, Dec 17, 2008
So hachCode can be final, more efficient to calc as you go.
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:44 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/15 |
| Comment by Christophe Grand [ 08/Mar/13 6:20 AM ] |
|
Wouldn't the naive approach incur realizing lazy sequences when adding them to a list or a vector or as values in a map? |
[CLJ-259] clojure.lang.Reflector.invokeMatchingMethod is not complete (rejects pontentially valid method invocations) Created: 03/Feb/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Description |
|
There exists invoke expressions on instances, where Java is able to perform the call, yet clojure is not reflectively. This restricts the possible search space. I suggest that if target is not null (e.g. is not a static method), the target.getClass() should be used instead as a root for getAsMethodOfPublicBase. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:12 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/259 |
| Comment by Assembla Importer [ 24/Aug/10 3:12 PM ] |
|
richhickey said: How about some sample case that demonstrates the problem? |
| Comment by Assembla Importer [ 24/Aug/10 3:12 PM ] |
|
hiredman said: Related association with ticket #126 was added |
[CLJ-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-698] class accessible from deftype method bodies is not suitable for instance?, ... Created: 28/Dec/10 Updated: 29/Dec/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | Backlog |
| Type: | Defect | Priority: | Major |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Example interaction: http://pastebin.com/cTdUCKfp
|
| Comments |
| Comment by Stuart Halloway [ 29/Dec/10 12:45 PM ] |
|
The problem occurs in 1.2 but is fixed on master. Leaving in backlog in case we ever cut another 1.2 release--if not, then mark as fixed. |
[CLJ-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-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-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-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-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-666] Add support for Big* numeric types to Reflector Created: 29/Oct/10 Updated: 15/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
This should work as expected, for example: (Integer. 1N) Probably for BigInt, BigInteger, and BigDecimal. Method to look at is c.l.Reflector.paramArgTypeMatch, per Rich in irc. |
| Comments |
| Comment by Colin Jones [ 30/Mar/11 11:52 PM ] |
|
Questions posed on the clojure-dev list around how this impacts bit-shift-left: http://groups.google.com/group/clojure-dev/browse_thread/thread/2191cbf0048d8ca6 |
| Comment by Alexander Taggart [ 31/Mar/11 12:42 AM ] |
|
Patch on CLJ-445 fixes this as well. |
| Comment by Colin Jones [ 27/Apr/11 4:41 PM ] |
|
This patch fails a test around bit-shifting a BigInt: `(bit-shift-left 1N 10000)`. The reason is that the patch changes the dispatch of (BigInt, Long) from (Object, Object) to (long, int). Clearly this can't be applied (unless another change makes it possible), but I'm putting it up as a start of the conversation. |
| Comment by Alexander Taggart [ 27/Apr/11 5:26 PM ] |
|
My comment from the mailing list: If the test breaks it likely means Numbers.shiftLeft(long,int) was The suggestion of "simply" modifying paramArgTypeMatch is not sufficient since the mechanism for preferring one method over another lives in Compiler, and isn't smart enough to make these sorts of decisions. |
| Comment by Christopher Redinger [ 28/Apr/11 9:21 AM ] |
|
Considering moving this out of Release.next - soliciting comments from Chas. |
| Comment by Chas Emerick [ 28/Apr/11 9:41 AM ] |
|
I'm afraid I don't have any particular insight into the issues involved at this point. I ran into the problem originally noted a while back, and opened the ticket at Rich's suggestion. I'm sorry if the text of the ticket led anyone down unfruitful paths… |
| Comment by Luke VanderHart [ 29/Apr/11 10:01 AM ] |
|
The issues relating to bitshift are moot since the decision was made that bit-shifts are only for 32/64 bit values. Still a valid issue, but de-prioritized as per Rich. |
| Comment by Alex Ott [ 25/Jun/12 7:19 AM ] |
|
Modified version of original patch |
| Comment by Andy Fingerhut [ 26/Jun/12 1:38 PM ] |
|
Alex, would you mind attaching it with a unique file name? I know that JIRA lets us create multiple attachments with the same file name, and I know we can tell them apart by date and the account of the person who uploaded the attachment, but giving them the same name only seems to invite confusion. |
| Comment by Alex Ott [ 28/Jun/12 1:00 PM ] |
|
Renamed updated patch to unique name |
[CLJ-415] smarter assert (prints locals) Created: 29/Jul/10 Updated: 18/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Approval: | Incomplete |
| Waiting On: | Rich Hickey |
| Description |
|
Here is an implementation you can paste into a repl. Feedback wanted: (defn ^{:private true} local-bindings
"Produces a map of the names of local bindings to their values."
[env]
(let [symbols (map key env)]
(zipmap (map (fn [sym] `(quote ~sym)) symbols) symbols)))
(defmacro assert
"Evaluates expr and throws an exception if it does not evaluate to
logical true."
{:added "1.0"}
[x]
(when *assert*
(let [bindings (local-bindings &env)]
`(when-not ~x
(let [sep# (System/getProperty "line.separator")]
(throw (AssertionError. (apply str "Assert failed: " (pr-str '~x) sep#
(map (fn [[k# v#]] (str "\t" k# " : " v# sep#)) ~bindings)))))))))
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 5:41 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/415 |
| Comment by Assembla Importer [ 24/Aug/10 5:41 PM ] |
|
alexdmiller said: A simple example I tried for illustration: user=> (let [a 1 b 2] (assert (= a b)))
#<CompilerException java.lang.AssertionError: Assert failed: (= a b)
a : 1
b : 2
|
| Comment by Assembla Importer [ 24/Aug/10 5:41 PM ] |
|
fogus said: Of course it's weird if you do something like: (let [x 1 y 2 z 3 a 1 b 2 c 3] (assert (= x y))) java.lang.AssertionError: Assert failed: (= x y) x : 1 y : 2 z : 3 a : 1 b : 2 c : 3 (NO_SOURCE_FILE:0) </code></pre> So maybe it could be slightly changed to: <pre><code>(defmacro assert "Evaluates expr and throws an exception if it does not evaluate to logical true." {:added "1.0"} [x] (when *assert* (let [bindings (local-bindings &env)] `(when-not ~x (let [sep# (System/getProperty "line.separator") form# '~x] (throw (AssertionError. (apply str "Assert failed: " (pr-str form#) sep# (map (fn [[k# v#]] (when (some #{k#} form#) (str "\t" k# " : " v# sep#))) ~bindings))))))))) </code></pre> So that. now it's just: <pre><code>(let [x 1 y 2 z 3 a 1 b 2 c 3] (assert (= x y))) java.lang.AssertionError: Assert failed: (= x y) x : 1 y : 2 (NO_SOURCE_FILE:0) :f |
| Comment by Assembla Importer [ 24/Aug/10 5:41 PM ] |
|
fogus said: Hmmm, but that fails entirely for: (let [x 1 y 2 z 3 a 1 b 2 c 3] (assert (= [x y] [a c]))). So maybe it's better just to print all of the locals unless you really want to get complicated. |
| Comment by Assembla Importer [ 24/Aug/10 5:41 PM ] |
|
jawolfe said: See also some comments in: Plus one more suggestion to add to the mix: in addition to / instead of printing the locals, how about saving them somewhere. For example, the var assert-bindings could be bound to the map of locals. This way you don't run afoul of infinite/very large sequences, and allow the user to do more detailed interrogation of the bad values (especially useful when some of the locals print opaquely). |
| Comment by Assembla Importer [ 24/Aug/10 5:41 PM ] |
|
stuart.sierra said: Another approach, which I wil willingly donate: |
| Comment by Jeff Weiss [ 15/Dec/10 1:33 PM ] |
|
There's one more tweak to fogus's last comment, which I'm actually using. You need to flatten the quoted form before you can use 'some' to check whether the local was used in the form: (defmacro assert "Evaluates expr and throws an exception if it does not evaluate to logical true." {:added "1.0"} [x] (when *assert* (let [bindings (local-bindings &env)] `(when-not ~x (let [sep# (System/getProperty "line.separator") form# '~x] (throw (AssertionError. (apply str "Assert failed: " (pr-str form#) sep# (map (fn [[k# v#]] (when (some #{k#} (flatten form#)) (str "\t" k# " : " v# sep#))) ~bindings))))))))) |
| Comment by Stuart Halloway [ 04/Jan/11 8:31 PM ] |
|
I am holding off on this until we have more solidity around http://dev.clojure.org/display/design/Error+Handling. (Considering, for instance, having all exceptions thrown from Clojure provide access to locals.) When my pipe dream fades I will come back and screen this before the next release. |
| Comment by Stuart Halloway [ 28/Jan/11 1:14 PM ] |
|
Why try to guess what someone wants to do with the locals (or any other context, for that matter) when you can specify a callback (see below). This would have been useful last week when I had an assertion that failed only on the CI box, where no debugger is available. Rich, at the risk of beating a dead horse, I still think this is a good idea. Debuggers are not always available, and this is an example of where a Lisp is intrinsically capable of providing better information than can be had in other environments. If you want a patch for the code below please mark waiting on me, otherwise please decline this ticket so I stop looking at it. (def ^:dynamic *assert-handler* nil) (defn ^{:private true} local-bindings "Produces a map of the names of local bindings to their values." [env] (let [symbols (map key env)] (zipmap (map (fn [sym] `(quote ~sym)) symbols) symbols))) (defmacro assert [x] (when *assert* (let [bindings (local-bindings &env)] `(when-not ~x (let [sep# (System/getProperty "line.separator") form# '~x] (if *assert-handler* (*assert-handler* form# ~bindings) (throw (AssertionError. (apply str "Assert failed: " (pr-str form#) sep# (map (fn [[k# v#]] (when (some #{k#} (flatten form#)) (str "\t" k# " : " v# sep#))) ~bindings)))))))))) |
| Comment by Jeff Weiss [ 27/May/11 8:16 AM ] |
|
A slight improvement I made in my own version of this code: flatten does not affect set literals. So if you do (assert (some #{x} [a b c d])) the value of x will not be printed. Here's a modified flatten that does the job: (defn symbols [sexp] "Returns just the symbols from the expression, including those inside literals (sets, maps, lists, vectors)." (distinct (filter symbol? (tree-seq coll? seq sexp)))) |
| Comment by Andy Fingerhut [ 18/Nov/12 1:06 AM ] |
|
Attaching git format patch clj-415-assert-prints-locals-v1.txt of Stuart Halloway's version of this idea. I'm not advocating it over the other variations, just getting a file attached to the JIRA ticket. |
[CLJ-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-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-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-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-366] Multiplatform command-line clojure launcher Created: 28/May/10 Updated: 10/Dec/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Clojure needs a lower barrier of entry, long java commands scare people away! We need a script that conveniently launches a clojure repl or executes clojure files, much like the ruby/python/perl/other-favorite-interpreted-language behavior. NOTES: From Russ Olson (regarding Dejure/Dejour):
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 8:21 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/366 |
| Comment by Assembla Importer [ 24/Aug/10 8:21 AM ] |
|
stu said: Updating tickets (#370, #366, #374) |
| Comment by Aaron Bedra [ 10/Dec/10 10:13 AM ] |
|
Design page is at http://dev.clojure.org/display/design/CLJ+Launcher and should be the basis for all future discussion |
[CLJ-949] let undeclared exceptions continue unchecked Created: 07/Mar/12 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Backlog |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Brian Taylor | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
The recent modifications regarding checked exceptions have eliminated the need for several try/catch blocks. This commit removes the blocks that no longer serve a purpose. |
| Comments |
| Comment by Andy Fingerhut [ 09/Mar/12 9:06 AM ] |
|
Patch 0001-let-undeclared-exceptions-continue-unchecked.patch applies cleanly to latest master as of March 9, 2012, and build and test without errors or warnings. One author, Brian Taylor, has signed CA. |
[CLJ-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-700] contains? broken for TransientMaps Created: 01/Jan/11 Updated: 28/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | Priority: | Major |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
(contains? (transient {:x "fine"}) :x)
also (contains? (transient (hash-map :x "fine")) :x)
|
| Comments |
| Comment by Herwig Hochleitner [ 01/Jan/11 8:01 PM ] |
|
the same is also true for TransientVectors {{(contains? (transient [1 2 3]) 0)}}
|
| Comment by Herwig Hochleitner [ 01/Jan/11 8:25 PM ] |
|
As expected, TransientSets have the same issue; plus an additional, probably related one. (:x (transient #{:x}))
(get (transient #{:x}) :x)
|
| Comment by Alexander Redington [ 07/Jan/11 2:07 PM ] |
|
This is caused by expectations in clojure.lang.RT regarding the type of collections for some methods, e.g. contains() and getFrom(). Checking for contains looks to see if the instance passed in is Associative (a subinterface of PersistentCollection), or IPersistentSet. This patch refactors several of the Clojure interfaces so that logic abstract from the issue of immutability is pulled out to a general interface (e.g. ISet, IAssociative), but preserves the contract specified (e.g. Associatives only return Associatives when calling assoc()). With more general interfaces in place the contains() and getFrom() methods were then altered to conditionally use the general interfaces which are agnostic of persistence vs. transience. Includes tests in transients.clj to verify the changes fix this problem. |
| Comment by Stuart Halloway [ 28/Jan/11 10:35 AM ] |
|
Rich: Patch doesn't currently apply, but I would like to get your take on approach here. In particular:
|
| Comment by Alexander Redington [ 25/Mar/11 7:44 AM ] |
|
Rebased the patch off the latest pull of master as of 3/25/2011, it should apply cleanly now. |
| Comment by Stuart Sierra [ 17/Feb/12 2:59 PM ] |
|
Latest patch does not apply as of f5bcf647 |
| Comment by Andy Fingerhut [ 17/Feb/12 5:59 PM ] |
|
clj-700-patch2.txt does patch cleanly to latest Clojure head as of a few mins ago. No changes to patch except in context around changed lines. |
| Comment by Andy Fingerhut [ 07/Mar/12 3:23 AM ] |
|
Sigh. Git patches applied via 'git am' are fragile beasts indeed. Look at them the wrong way and they fail to apply. clj-700-patch3.txt applies cleanly to latest master as of Mar 7, 2012, but not if you use this command: git am -s < clj-700-patch3.txt I am pretty sure this is because of DOS CR/LF line endings in the file src/jvm/clojure/lang/Associative.java. The patch does apply cleanly if you use this command: git am --keep-cr -s < clj-700-patch3.txt |
| Comment by Andy Fingerhut [ 23/Mar/12 6:34 PM ] |
|
This ticket was changed to Incomplete and waiting on Rich when Stuart Halloway asked for feedback on the approach on 28/Jan/2011. Stuart Sierra changed it to not waiting on Rich on 17/Feb/2012 when he noted the patch didn't apply cleanly. Latest patch clj-700-patch3.txt does apply cleanly, but doesn't change the approach used since the time Stuart Halloway's concern was raised. Should it be marked as waiting on Rich again? Something else? |
| Comment by Stuart Halloway [ 08/Jun/12 12:44 PM ] |
|
Patch 4 incorporates patch 3, and brings it up to date on hashing (i.e. uses hasheq). |
| Comment by Andy Fingerhut [ 08/Jun/12 12:52 PM ] |
|
Removed clj-700-patch3.txt in favor of Stuart Halloway's improved clj-700-patch4.txt dated June 8, 2012. |
| Comment by Andy Fingerhut [ 18/Jun/12 3:06 PM ] |
|
clj-700-patch5.txt dated June 18, 2012 is the same as Stuart Halloway's clj-700-patch4.txt, except for context lines that have changed in Clojure master since Stuart's patch was created. clj-700-patch4.txt no longer applies cleanly. |
| Comment by Andy Fingerhut [ 19/Aug/12 4:47 AM ] |
|
Adding clj-700-patch6.txt, which is identical to Stuart Halloway's clj-700-patch4.txt, except that it applies cleanly to latest master as of Aug 19, 2012. Note that as described above, you must use the --keep-cr option to 'git am' when applying this patch for it to succeed. Removing clj-700-patch5.txt, since it no longer applies cleanly. |
| Comment by Stuart Sierra [ 24/Aug/12 1:08 PM ] |
|
Patch fails as of commit 1c8eb16a14ce5daefef1df68d2f6b1f143003140 |
| Comment by Andy Fingerhut [ 24/Aug/12 1:53 PM ] |
|
Which patch did you try, and what command did you use? I tried applying clj-700-patch6.txt to the same commit, using the following command, and it applied, albeit with the warning messages shown: % git am --keep-cr -s < clj-700-patch6.txt Note the --keep-cr option, which is necessary for this patch to succeed. It is recommended in the "Screening Tickets" section of the JIRA workflow wiki page here: http://dev.clojure.org/display/design/JIRA+workflow |
| Comment by Andy Fingerhut [ 28/Aug/12 5:48 PM ] |
|
Presumptuously changing Approval from Incomplete back to None, since the latest patch does apply cleanly if the --keep-cr option is used. It was in Screened state recently, but I'm not so presumptuous as to change it to Screened |
[CLJ-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-1154] Compile.java closes out preventing java from reporting exceptions Created: 31/Jan/13 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | Release 1.5, Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Robert (Bobby) Evans | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
I was trying to compile a project that has some native dependencies. I am using clojure-maven-plugin version 1.3.13 with Maven 2.0. I forgot to set java.library.path properly so that the native library could be found, and only got an error of [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Clojure failed. [INFO] ------------------------------------------------------------------------ I traced this down to Compile.java, where it is flushing and closing out |
| Comments |
| Comment by Stuart Halloway [ 01/Mar/13 10:45 AM ] |
|
I have encountered this problem as well. Did not verify the explanation, but sounds reasonable. |
[CLJ-701] Compiler loses 'loop's return type in some cases Created: 03/Jan/11 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Chouser | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Clojure commit 9052ca1854b7b6202dba21fe2a45183a4534c501, version 1.3.0-master-SNAPSHOT |
||
| Approval: | Vetted |
| Description |
(set! *warn-on-reflection* true)
(fn [] (loop [b 0] (recur (loop [a 1] a))))
Generates the following warnings: recur arg for primitive local: b is not matching primitive, had: Object, needed: long Auto-boxing loop arg: b This is interesting for several reasons. For one, if the arg to recur is a let form, there is no warning: (fn [] (loop [b 0] (recur (let [a 1] a)))) Also, the compiler appears to understand the return type of loop forms just fine: (use '[clojure.contrib.repl-utils :only [expression-info]])
(expression-info '(loop [a 1] a))
;=> {:class long, :primitive? true}
The problem can of course be worked around using an explicit cast on the loop form: (fn [] (loop [b 0] (recur (long (loop [a 1] a)))))
Reported by leafw in IRC: http://clojure-log.n01se.net/date/2011-01-03.html#10:31 |
| Comments |
| Comment by a_strange_guy [ 03/Jan/11 4:36 PM ] |
|
The problem is that a 'loop form gets converted into an anonymous fn that gets called immediately, when the loop is in a expression context (eg. its return value is needed, but not as the return value of a method/fn). so (fn [] (loop [b 0] (recur (loop [a 1] a)))) gets converted into (fn [] (loop [b 0] (recur ((fn [] (loop [a 1] a)))))) see the code in the compiler: this conversion already bites you if you have mutable fields in a deftype and want to 'set! them in a loop |
| Comment by Christophe Grand [ 23/Nov/12 2:28 AM ] |
|
loops in expression context are lifted into fns because else Hotspot doesn't optimize them.
Adressing all those problems isn't easy. [1] beware of |
[CLJ-1058] StackOverflowError on exception in reducef for PersistentHashMap fold Created: 02/Sep/12 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Tom Jack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Clojure 1.5.0-alpha4, Sun Java 1.6.0_35, with [org.codehaus.jsr166-mirror/jsr166y "1.7.0"] |
||
| Approval: | Vetted |
| Description |
|
If reducef throws an exception, the PHM fold code can descend into an infinite loop, causing a stack overflow which masks the problem. This situation is commented "aargh" in PersistentHashMap.java line 444 (as of 412a51d). To reproduce: user> (require '[clojure.core.reducers :as r])
nil
user> (r/fold (fn ([]) ([ret k v] (+ 3 "foo") ret)) (into {} (map (juxt identity identity) (range 10000))))
;; boom
This results in a stack like: https://raw.github.com/gist/3bab917287a7fd635a84/f38bfe3e270556e467f3fc02062af7ea10781390/gistfile1.txt |
| Comments |
| Comment by Timothy Baldridge [ 30/Nov/12 3:40 PM ] |
|
Verified as a bug. |
[CLJ-420] Some compiler exceptions erroneously using REPL line numbers. Created: 08/Aug/10 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Alexander Redington | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
Certain kinds of errors in loaded source files are coming back tagged with the correct source file, but what seems to be the REPL line number. jawolfe@[~/Projects/testproj]: cat > src/test.clj bla (bla) |
| Comments |
| Comment by Assembla Importer [ 28/Sep/10 9:59 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/420 |
| Comment by Assembla Importer [ 28/Sep/10 9:59 PM ] |
|
stu said: Updating tickets (#427, #426, #421, #420, #397) |
| Comment by Assembla Importer [ 28/Sep/10 9:59 PM ] |
|
stu said: Updating tickets (#429, #437, #397, #420) |
[CLJ-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-1202] protocol fns with dashes may get compiled into property access when used higher order Created: 16/Apr/13 Updated: 10/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | David Nolen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
user=> (defprotocol Foo (-foo [x]))
Foo
user=> (deftype Bar [] Foo (-foo [_] :baz))
user.Bar
user=> (map -foo [(Bar.)])
IllegalArgumentException No matching field found: foo for class user.Bar
clojure.lang.Reflector.getInstanceField (Reflector.java:271)
I would have expected to see (:baz). The full stack is: IllegalArgumentException No matching field found: foo for class user.Bar
clojure.lang.Reflector.getInstanceField (Reflector.java:271)
clojure.lang.Reflector.invokeNoArgInstanceMember (Reflector.java:300)
user/eval79/fn--80/G--71--82 (NO_SOURCE_FILE:11)
user/eval79/fn--80/G--70--85 (NO_SOURCE_FILE:11)
clojure.core/map/fn--4207 (core.clj:2485)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:60)
clojure.lang.RT.seq (RT.java:484)
clojure.core/seq (core.clj:133)
clojure.core/print-sequential (core_print.clj:46)
clojure.core/fn--5406 (core_print.clj:143)
clojure.lang.MultiFn.invoke (MultiFn.java:231)
nil
I suspect this is somehow related to the property access changes to make Clojure/ClojureScript compatible. I was in fact prepping core.logic for a unified code base and was adopting the ClojureScript protocol naming convention when I encountered this issue.
|
| Comments |
| Comment by Alan Malloy [ 18/Apr/13 7:18 PM ] |
|
Attached patch fixes the issue, and adds regression test for it. |
| Comment by Gabriel Horner [ 10/May/13 3:19 PM ] |
|
Verified patch works |
[CLJ-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-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-944] compiler makes different concrete maps then the reader Created: 04/Mar/12 Updated: 24/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4, Release 1.5 |
| Fix Version/s: | Release 1.5, Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Alf Kristian Støyle | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
Clojure 1.3 om Mac OS 10.7, Clojure 1.5.0 alpha1 on Linux x86_64 (OpenJDK 1.7.0 b147) |
||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Screened |
| Description |
|
I (Stu) agree with Nicola's assessment in the comments: the single real problem here is that the compiler's MapExpr parser emits maps differently from other map-makers, e.g. RT's factory functions. Patch clj944-plus-tests does three things:
Original report follows: Hi guys, I am getting the following exception: (.containsKey {:one 1} :one)
;=> ClassCastException clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.PersistentHashMap
The map is a clojure.lang.PersistentArrayMap, which obviously has a containsKey method (https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentArrayMap.java#L95). Casting it works fine though: (.containsKey ^clojure.lang.PersistentArrayMap {:one 1} :one)
;=> true
The mailing list suggest that the compiler injects an incorrect cast to clojure.lang.PersistentHashMap. In this case it should probably be cast to a clojure.lang.Associative, the highest common interface having the .containsKey method. The problem is not present in Clojure 1.2.1. |
| Comments |
| Comment by Nicola Mometto [ 30/Oct/12 5:02 PM ] |
|
The attached patch fixes the issue, by emitting IPersistentMap instead of Persistent{Hash|Array}Map as class type for maps literals |
| Comment by Nicola Mometto [ 01/Nov/12 3:48 PM ] |
|
I uploaded another patch fixing the same problem in a different way. This approach is more consistent, making the type of the compiler's internal representation of a map literal equal to the one of the reader. Note that this second approach while being more consistent, breaks some tests that assume some operations on maps (specifically `seq` and `print`) to be order dependent, and written with the hash-map return order implementation in mind. That should not be the case and if the second patch is preferred over the first one, I'll gladly fix those tests. |
| Comment by Stuart Halloway [ 01/Mar/13 12:09 PM ] |
|
Approach #2, relying on consistent choice of concrete map class by size throughout, feels quite fragile. Approach #1 seems to abuse the method name getJavaClass(), now having it return "get the base type I would need for cast". Maybe there needs to be a different thing entirely? |
| Comment by Nicola Mometto [ 01/Mar/13 2:17 PM ] |
|
Patch #2 should get merged (IMHO) regardless of the fragility of its approach to fixing this ticket's bug, since it fixes another bug: prior to the patch: user=> (class {:a 1}) after the patch: user=> (class {:a 1}) This should also lead to some minor performance enhancement since prior to this moment, every map def'ed would be a HashMap instead of an ArrayMap So, I think patch #2 should be applied if not for this ticket's bug, at least for the reason stated above. |
| Comment by Rich Hickey [ 13/Apr/13 9:41 AM ] |
|
This should not have passed screening. There are two issues, should be separate. I have no idea what has been screened nor what will be applied should it be approved. There's contention in the discussion but no resolution. |
| Comment by Nicola Mometto [ 13/Apr/13 12:06 PM ] |
|
I don't think that there are two issues here. The underlying cause of those two symtoms is fixed by the patch 002 that i submitted (incorporated in Stu's clj944-plus-tests patch. Stuart said that this approach feels fragile but the bug is caused by the fact that everywhere else clojure returns a PersistentArrayMap when the element count is <= than the PersistentHashMap threshold, and when emitting maps, it doesn't. Making clojure emit maps consistently with how clojure does internally everywhere else looks to me like the only solution, and I don't really see how making clojure consistent is a fragile approach. But again, if somebody can suggest a better solution to this problem, I'll gladly submit another patch. |
[CLJ-1016] Global scope overrides lexical scope for classes (Clojure assumes no classes in default package / Clojure cannot handle yFiles JARs in classpath) Created: 21/Jun/12 Updated: 24/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Edward Z. Yang | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
The most visible symptom of this bug is having a class named 'w' (default package) in your classpath (such classes are produced by Java obfuscation tools such as yFiles) and then attempting to load Clojure's core class. For example: java -cp hotspotapi.jar:clojure-1.4.0-slim.jar clojure.main (where hotspotapi.jar is a stereotypical example of an obfuscated JAR) results in: Exception in thread "main" java.lang.ExceptionInInitializerError To understand what is going on, consider this simple test: import java.io.StringReader; import clojure.lang.Compiler; public class Test { It should be clear that 'mumble' in the dot operator is referencing the locally defined mumble. However, if we define a class named 'mumble' in the default package, Clojure picks that one up instead. To forestall any objections: yes, we know that placing classes in the default package is extremely poor form. Point of the matter is, the Java ecosystem is extremely diverse and there are a lot of JARs people may not have control over. While one might argue, "Don't put classes in the default namespace", point of the matter is, Clojure is wrong here, and these situations arise in practice, through no fault of the implementer. |
| Comments |
| Comment by Edward Z. Yang [ 21/Jun/12 11:01 AM ] |
|
Here is a workaround patch which makes this error less likely to occur. |
| Comment by Andy Fingerhut [ 27/Aug/12 7:37 PM ] |
|
Edward, it is Rich Hickey's policy only to consider for inclusion in Clojure patches written by people who have signed a Contributor Agreement: http://clojure.org/contributing Were you interested in becoming a contributor? |
| Comment by Edward Z. Yang [ 27/Aug/12 9:24 PM ] |
|
Sure, although the patch attached is emphatically not the one you want to actually applying, since it only band-aids the problem. |
| Comment by Andy Fingerhut [ 24/May/13 1:21 PM ] |
|
I am not sure, but this ticket may be related to CLJ-1171. At least, there the issue was a global name not being shadowed by a local name bound with let. That seems similar to this issue. |
[CLJ-322] Enhance AOT compilation process to emit classfiles only for explicitly-specified namespaces Created: 29/Apr/10 Updated: 24/May/13 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 12 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Incomplete |
| Waiting On: | Chas Emerick |
| Description |
|
Summary: still needs decision on implementation approach. This was originally/erroneously reported by Howard Lewis Ship in the clojure-contrib assembla: My build file specifies the namespaces to AOT compile but if I include another namespace (even from a JAR dependency) that is not AOT compiled, the other namespace will be compiled as well. In my case, I was using clojure-contrib's clojure.contrib.str-utils2 namespace, and I got a bunch of clojure/contrib/str_utils2 classes in my output directory. I think that the AOT compiler should NOT precompile any namespaces that are transitively reached, only namespaces in the set specified by the command line are appropriate. As currently coded, you will frequently find unwanted third-party dependencies in your output JARs; further, if multiple parties depend on the same JARs, this could cause bloating and duplication in the eventual runtime classpath. Having the option of shipping either all AOT-compiled classfiles or mixed source/AOT depending upon one's distribution requirements would make that phase of work with a clojure codebase significantly easier and less error-prone. The only question in my mind is what the default should be. We're all used to the current behaviour, but I'd guess that any nontrivial project where the form of the distributable matters (i.e. the source/AOT mix), providing as much control as possible by default makes the most sense. Given the tooling that most people are using, it's trivial (and common practice, IIUC) to provide a comprehensive list of namespaces one wishes to compile, so making that the default shouldn't be a hurdle to anyone. If an escape hatch is desired, a --transitive switch to clojure.lang.Compile could be added. |
| Comments |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/322 |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
hlship said: I'd like to reinforce this. I've been doing research on Clojure build tools for an upcoming talk and all of them (Maven, Leiningen, Gradle) have the same problem: the AOT compile extends from the desired namespaces (such as one containing a :gen-class) to every reached namespace. This is going to cause a real ugliness when application A uses libraries B and C that both depend on library D (such as clojure-contrib) and B and C are thus both bloated with duplicate, unwanted AOT compiled classes from the library D. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: This behaviour is an implementation detail of Clojure's AOT compilation process, and is orthogonal to any particular build tooling. I am working on a patch that would provide a mechanism for such tooling to disable this default behaviour. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: A first cut of a change to address this issue is here (caution, work in progress!): http://github.com/cemerick/clojure/commit/6f14e0790c0d283a7e44056adf1bb3f36bb16e0e This makes available a new recognized system property, clojure.compiler.transitive, which defaults to true. When set/bound to false (i.e. -Dclojure.compiler.transitive=false when using clojure.lang.Compile), only the first loaded file (either the ns named in the call to compile or each of the namespaces named as arguments to clojure.lang.Compile) will have classfiles written to disk. This means that this compilation invocation: java -cp <your classpath> -Dclojure.compiler.transitive=false clojure.lang.Compile com.bar com.baz
will generate classfiles only for com.bar and com.baz, but not for any of the namespaces or other files they load, require, or use. The only shortcoming of this WIP patch is that classfiles are still generated for proxy and gen-class classes defined outside of the explicitly-named namespaces. What I thought was a solution for this ended up breaking the loading of generated interfaces (as produced by defprotocol, etc). I'll take a second look at this before the end of the week, but wanted to get this out there so as to get any comments people might have. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
technomancy said: Looks good, but I'm having trouble getting it to work. I tried compiling from master of Chas's fork on github, but I still got the all the .class files generated with -Dclojure.compiler.transitive=false. It could be a quirk of the way I'm using ant to fork off processes though. Is it possible to set it using System/setProperty, or must it be given as a property on the command-line? |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: Bah, that's just bad documentation. :-/ The system property is only provided by clojure.lang.Compile; the value of it drives the binding of clojure.core/transitive-compile, which has a root binding of true. You should be able to configure the transitivity the same way you configure compile-path (system prop to clojure.lang.Compile or a direct binding when at the REPL, etc). If not, ping me in irc or elsewhere. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
meikelbrandmeyer said: I think, excluding parts 'load'ed is a little strong. I have some namespaces which load several parts from different files, but which belong to the same namespace. The most prominent example of such a case is clojure.core itself. I'm find with stopping require and use, but load is a bit too much, I'd say. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
technomancy said: Chas: Thanks; will give that a go. Meikel: Do people actually use load outside of clojure.core? I thought it was only used there because clojure.core is a "special" namespace where you want more vars to be available than can reasonably fit in a single file. Splitting up a namespace into several files is quite unadvisable otherwise. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
technomancy said: I can confirm that this works for me modulo the proxy/gen-class issue that Chas mentioned. I would love to see this in Clojure 1.2; it would really clean up a lot of build-related issues. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
meikelbrandmeyer said: I used it several times and this is the first time, I hear that it is unadvisable to do so. Even with a lower number of Vars in the namespace (c.c is here certainly exceptional) and might be of use to split several "sections" of code which belong to the same namespace but have different functionality. Whether to use a big comment in the source to indicate the section or split things into subfiles is a matter of taste. But it's a perfectly reasonable thing todo. Another use case, where I use this (and c.c.lazy-xml, IIRC) is to conditionally load code depending on whether a dependency is available or not. Eg. vimclojure uses c.c.pprint and c.c.stacktrace/clj-stacktrace transparently depending on their availability. There are perfectly legal uses of load. I don't see any "unadvisable" here. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: Thanks, Meikel; I had forgotten about that use case, as I don't use load directly myself at all. I probably wouldn't say it's inadvisable, just mostly unnecessary. In any case, that's a good catch. It complicates things a bit, but we'll see what happens. I'm going to take another whack at resolving the proxy/gen-class case and narrowing the impact of nontransitivity to use and require later tonight. I agree wholeheartedly that this should be in 1.2, assuming the technical bits work out. This has been an irritant for quite a long time. I actually believe that nontransitivity should be the default – no one wants or expects to have classfiles show up for dependencies show up when a project is AOT-compiled. I think the only negative impact would be whoever still fiddles with compilation at the REPL, and doesn't use maven or lein – and even then, it's just a matter of binding another var. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
meikelbrandmeyer said: Then the var should be added to the default bindings in the clojure.main repl. Then it's set!-able like the other vars ��� warn-on-reflection and friends. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: This is looking pretty good (still WIP): http://github.com/cemerick/clojure/commit/fedfb022ecef420a932b3d69c182ec7a8e5960a6 Thank you again for mentioning load, Meikel: it was very helpful in resolving the proxy/gen-class issue as well. Just a single data point: the jar produced by the medium-sized project I've been using for testing the changes has shrunk from 1.8MB to less than 1MB. That's not the only reason this is a good change, but it's certainly a nice side-effect. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: [file:aIWFiWHeGr35ImeJe5cbLA] |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: [file:aI7Eu-HeGr35ImeJe5cbLA] |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: Patched attached. The The user impact of changing the default would be:
|
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
hlship said: Just had a brain-storm: How about an option to support transitive compilation, but only if the Clojure source file being compiled as a file: URL (i.e., its a local file on the file system, not a file stored in a JAR). That would make it easier to use compilation on the local project without transitively compiling imported libraries, such as clojure-contrib. So transitive-compile should be a keyword, not a boolean, with values :all (for 1.1 behavior), :none (to compile only the exact specified namespaces) or :local (to compile transitively, but only for local files, not source files from JARs). |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: (Crossposted to the clojure-dev list) I thought about this some, and I don't think that's a good idea, at least for now. I'm uncomfortable with semantics changing depending upon where code is being loaded from – which, depending upon a tool's implementation, might be undefined. E.g. if the com.foo.bar ns is available in source form in one directory, but as classes from a jar, and classpaths aren't being constructed in a stable fashion, then the results of compilation will change. If we decide that special treatment depending upon the source of code is warranted in the future, that's a fairly straightforward thing to do w.r.t. the API – we could have :all and :local as you suggest, with nil representing :none. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
stu said: Rich is not comfortable enough with the implementation complexity of this patch (e.g. the guard clause for proxies and gen-class) to slide this in as a minor fix under the wire for 1.2. Better to live with the pain we know a little longer than ship something we don't have enough experience with to be confident. |
| Comment by Chas Emerick [ 19/Nov/10 9:28 PM ] |
|
Updated patch to cleanly apply to HEAD and address issues raised by screening done by Cosmin Stejerean. Also includes proper tests. Note: this patch's tests require the fix for |
| Comment by Stuart Halloway [ 29/Nov/10 7:18 AM ] |
|
the "-resolved" patch resolves a conflict in main.clj |
| Comment by Stuart Halloway [ 29/Nov/10 7:25 AM ] |
|
Several questions:
|
| Comment by Stuart Sierra [ 10/Dec/10 3:34 PM ] |
|
An alternative approach: patch write-classes-1.diff.gz From my forked branch What this patch does:
This approach was prompted by the following observations:
|
| Comment by Chas Emerick [ 10/Dec/10 4:04 PM ] |
|
S. Halloway: My apologies, I didn't know you had commented. I thought that, having assigned this issue to myself, I'd be notified of updates. FWIW, I aim to review your comments and SS' approach over the weekend. |
| Comment by Chas Emerick [ 16/Dec/10 7:36 AM ] |
|
S. Halloway: 1. Certainly shouldn't happen. AFAIK, others have screened the patch, presumably with a successful build. |
| Comment by Chas Emerick [ 16/Dec/10 9:00 AM ] |
|
I think S. Sierra's approach is fundamentally superior what I offered. I have two suggestions: one slight perspective change (which implies no change in the actual implementation), and an idea for an even simpler approach (at least from a user perspective), in that order. While interop is the driving requirement behind AOT, I absolutely do not want to have to keep an updated enumeration of all of the classes resulting from each and every defrecord et al. usages in my pom.xml/project.clj (and I wouldn't wish the task of ferreting those usages and their resulting classnames on any build tool author). Right now, *compile-write-classes* is documented to be a set of classname strings, but could just as easily be any other function. *compile-write-classes* should be documented to accept any predicate function (renamed to e.g. *compile-write-class?*?). There's no reason why it shouldn't be bound to, e.g. #(re-matches #"foo\.bar\.[\w_]+$" %) if I know that all my records are defined in the foo.bar namespace. To go along with that, I think some package/classname-globbing utilities along with corresponding options to clojure.lang.Compile would be most welcome. Classname munging rules are not exactly obvious, and it'd be good to make things a little easier for users in this regard. Another alternativeIf there's a closed set of forms that generate classes that one might reasonably be interested in having in a build result (outside of use cases for pervasive AOT), then why not have a simple option that only those forms utilize? gen-class and gen-interface already do this, but reusing the all-or-nothing *compile-files* binding; if they keyed off of a binding that implied a diminished scope (e.g. *compile-interop-forms* – which would be true if *compile-files* were true), then they'd do exactly what we wanted. Extending this approach to deftype (and therefore defrecord) should be straightforward. An implementation of this would probably be somewhat more complicated than S. Sierra's patch, though not as complex as my original stab at the problem (i.e. no *load-level*). On the plus side: 1. No additional configuration for users or implementation work for build tool authors, aside from the addition of the boolean diminished-scope AOT option I can see wanting to further restrict AOT to specific classnames in certain circumstances, in which case the above and S. Sierra's patch might be complimentary. |
| Comment by Stuart Sierra [ 16/Dec/10 11:49 AM ] |
|
I like the idea of *compile-interop-forms*. But is it always possible to determine what an "interop form" is? I think it is, I'm just not sure. |
| Comment by Allen Rohner [ 09/Oct/11 12:50 PM ] |
|
I'm also in favor of compile-interop-forms. As far as determining, how about sticking metadata on the var? (defmacro ^{:interop-form true} deftype ...) |
| Comment by Stuart Sierra [ 21/Oct/11 8:38 AM ] |
|
Summary and design discussion on wiki at http://dev.clojure.org/display/design/Transitive+AOT+Compilation |
| Comment by Stuart Sierra [ 29/Nov/11 6:54 PM ] |
|
New attachment compile-interop-1.patch has new approach: Add a third possible value for *compile-files*. True and false keep their original meanings, but :interop causes only interop-related forms to be written out as .class files. "Interop forms" are gen-class, gen-interface, deftype, defrecord, defprotocol, and definterface. Pros:
Cons:
|
| Comment by Stuart Sierra [ 02/Dec/11 8:12 AM ] |
|
Just realized my patch doesn't solve the transitive compilation problem. If library A loads library B, then compiling interop forms in A will also emit interop .class files in B. |
| Comment by Paudi Moriarty [ 01/Jan/13 3:55 AM ] |
|
It's disappointing to see an important issue like this still unresolved after 2.5 years. This is a real pain for us. We have a large closed source project where shipping source is not an option. This forces us to manage the AOT'ing of dependencies due to the hard dependency on protocol interfaces introduced by transitive AOT compilation (see https://groups.google.com/forum/?fromgroups=#!topic/clojure-dev/r3A1JOIiwVU). |
| Comment by Andy Fingerhut [ 01/Jan/13 4:27 PM ] |
|
Paul, do you have a suggestion for which of the approaches described in comments here, or on the wiki page http://dev.clojure.org/display/design/Transitive+AOT+Compilation would be preferable solution for you? Or perhaps even a patch that implements your preferred approach? |
| Comment by Howard Lewis Ship [ 04/Jan/13 4:18 PM ] |
|
Andy, I'm now consulting with Paudi's organization, so I think I can speak for him (I'm now the default buildmeister). I like Stuart's :interop idea, but that is somewhat orthogonal to our needs. I return to what I would like; compilation would compile specific namespaces; dependencies of those namespaces would not be compiled. To be honest, I'm still a little hung up on the interop forms: especially defprotocol and friends; from a cursory glance, it appears that todays AOT compilation will compile the protocol into a Java class, then compile the namespace that references the protocol with the assumption that the protocol's Java class is available. When we use build rules to only package our namespace's class files into the output JAR, the code fails with a NoClassDefFoundError because the protocol really needs to be recompiled, at runtime compilation, into an in-memory Java class. Obviously, supporting this correctly will be a challenge; the compiled bytecode for our namespace would ideally: I can imagine any number of ways to juggle things to make this work, so I won't suggest a specific implementation. In the meantime, our workaround is to create a "stub" module as part of our build; it simply requires in the necessary namespaces (for example, org.clojure:core.cache); this forces an AOT compile of the dependencies and we have a special rule to package such dependencies in the stub module's output JAR. This may not be a scalable problem, and it is expensive to identify what 3rd party dependencies require this treatment. |
| Comment by Stuart Halloway [ 24/May/13 1:25 PM ] |
|
I am marking this incomplete because there does not yet seem to be plurality, much less consensus or unanimity, on approach. Personally I am in favor of a solution based on a predicate that gets handed the class name and compiled bits, and then can choose whether to write the class. Pretty close to Stuart Sierra's compile-write-classes. Might be possible to flow more information than classname to the predicate. |
[CLJ-1207] Importing a class that does not exist fails to report the name of the class that did not exist Created: 29/Apr/13 Updated: 26/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Howard Lewis Ship | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | feedback | ||
| Environment: |
1.5.1, OS X |
||
| Waiting On: | Howard Lewis Ship |
| Description |
|
Pop quiz: What Java class is missing from the classpath? java.lang.NoClassDefFoundError: Could not initialize class com.annadaletech.nexus.util.logging__init
at java.lang.Class.forName0 (Class.java:-2)
java.lang.Class.forName (Class.java:264)
clojure.lang.RT.loadClassForName (RT.java:2098)
clojure.lang.RT.load (RT.java:430)
clojure.lang.RT.load (RT.java:411)
clojure.core$load$fn__5018.invoke (core.clj:5530)
clojure.core$load.doInvoke (core.clj:5529)
clojure.lang.RestFn.invoke (RestFn.java:408)
clojure.core$load_one.invoke (core.clj:5336)
clojure.core$load_lib$fn__4967.invoke (core.clj:5375)
clojure.core$load_lib.doInvoke (core.clj:5374)
clojure.lang.RestFn.applyTo (RestFn.java:142)
clojure.core$apply.invoke (core.clj:619)
clojure.core$load_libs.doInvoke (core.clj:5413)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invoke (core.clj:619)
clojure.core$require.doInvoke (core.clj:5496)
clojure.lang.RestFn.invoke (RestFn.java:512)
novate.console.app$eval1736$loading__4910__auto____1737.invoke (app.clj:1)
novate.console.app$eval1736.invoke (app.clj:1)
clojure.lang.Compiler.eval (Compiler.java:6619)
clojure.lang.Compiler.eval (Compiler.java:6608)
clojure.lang.Compiler.load (Compiler.java:7064)
user$eval1732.invoke (NO_SOURCE_FILE:1)
clojure.lang.Compiler.eval (Compiler.java:6619)
clojure.lang.Compiler.eval (Compiler.java:6582)
clojure.core$eval.invoke (core.clj:2852)
clojure.main$repl$read_eval_print__6588$fn__6591.invoke (main.clj:259)
clojure.main$repl$read_eval_print__6588.invoke (main.clj:259)
clojure.main$repl$fn__6597.invoke (main.clj:277)
clojure.main$repl.doInvoke (main.clj:277)
clojure.lang.RestFn.invoke (RestFn.java:1096)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__584.invoke (interruptible_eval.clj:56)
clojure.lang.AFn.applyToHelper (AFn.java:159)
clojure.lang.AFn.applyTo (AFn.java:151)
clojure.core$apply.invoke (core.clj:617)
clojure.core$with_bindings_STAR_.doInvoke (core.clj:1788)
clojure.lang.RestFn.invoke (RestFn.java:425)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:41)
clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__625$fn__628.invoke (interruptible_eval.clj:171)
clojure.core$comp$fn__4154.invoke (core.clj:2330)
clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__618.invoke (interruptible_eval.clj:138)
clojure.lang.AFn.run (AFn.java:24)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:603)
java.lang.Thread.run (Thread.java:722)
If you guess "com.annadaletech.nexus.util.logging__init" you are wrong! Wait, I'll give you a hint: (ns com.annadaletech.nexus.util.logging
(:use [clojure.string :only [trim-newline]]
[clojure.pprint :only [code-dispatch pprint with-pprint-dispatch *print-right-margin*]])
(:import [java.io StringWriter]
[org.slf4j MDC MarkerFactory Marker LoggerFactory]
[java.util.concurrent.locks ReentrantLock]))
Oh, sorry, did that not help? The correct answer is "org.slf4j.MDC". Having that information in the stack trace would have saved me nearly an hour. I think it is worth the effort to get that reported correctly. |
| Comments |
| Comment by Gabriel Horner [ 10/May/13 1:56 PM ] |
|
When I try this on a fresh project, I get this error: Howard, could you give us a project.clj or better yet a github repository that recreates this issue? |
| Comment by Howard Lewis Ship [ 10/May/13 4:51 PM ] |
|
I'll see what I can do. Probably be next week. Thanks for looking at this. |
| Comment by Gary Fredericks [ 26/May/13 8:20 AM ] |
|
This reminds me of an issue with `lein run` that resulted from it trying to figure out whether you wanted to run a namespace or a java class: |
[CLJ-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-864] defrecord positional arity factory fn should have an inline version that calls the record constructor Created: 26/Oct/11 Updated: 26/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Kevin Downey | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
defrecord positional arity factory fn should have an inline version that calls the record constructor |
| Comments |
| Comment by Gary Fredericks [ 26/May/13 3:39 PM ] |
|
I had the idea recently that the factory fn was useful partly for being a redefinable var, e.g. that you could wrap with contracts or anything else. This idea would preclude that. It makes sense though if the only purpose of ->Foo is to avoid having to :import something. |
[CLJ-1212] Silent truncation/downcasting of primitive type on reflection call to overloaded method (Math/abs) Created: 28/May/13 Updated: 29/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Matthew Willson | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Clojure 1.5.1 |
||
| Description |
|
I realise relying on reflection when calling these kinds of methods isn't a great idea performance-wise, but it shouldn't lead to incorrect or dangerous behaviour. Here it seems to trigger a silent downcast of the input longs, giving a truncated integer output: user> (defn f [a b] (Math/abs (- a b))) |
| Comments |
| Comment by Matthew Willson [ 28/May/13 12:50 PM ] |
|
For an even simpler way to replicate the issue: user> (#(Math/abs %) 1000000000000) |
| Comment by Andy Fingerhut [ 28/May/13 1:36 PM ] |
|
I was able to reproduce the behavior you see with these Java 6 JVMs on Ubuntu 12.04.2: java version "1.6.0_27" java version "1.6.0_45" However, I tried two Java 7 JVMs, and it gave the following behavior which looks closer to what you would hope for. I do not know what is the precise difference between Java 6 and Java 7 that leads to this behavior difference, but this is some evidence that this has something to do with Java 6 vs. Java 7. user=> (set! warn-on-reflection true) Above behavior observed with Clojure 1.5.1 on these JVMs: Ubuntu 12.04.2 plus this JVM: Mac OS X 10.8.3 plus this JVM: |
| Comment by Matthew Willson [ 29/May/13 5:17 AM ] |
|
Ah, interesting. Here's the bytecode generated incase anyone's curious: public java.lang.Object invoke(java.lang.Object); |
| Comment by Matthew Willson [ 29/May/13 5:20 AM ] |
|
Just an idea (and maybe this is what's happening under java 7?) but given it's a static method and all available overloaded variants are presumably known at compile time, perhaps it could generate code along the lines of: (cond |
| Comment by Andy Fingerhut [ 29/May/13 3:19 PM ] |
|
In Reflector.java method invokeStaticMethod(Class c, String methodName, Object[] args) there is a call to getMethods() followed by a call to invokeMatchingMethod(). getMethods() returns the 4 java.lang.Math/abs methods in different orders on Java 6 and 7, causing invokeMatchingMethod() to pick a different one on the two JVMs: java version "1.6.0_39" user=> (pprint (seq (clojure.lang.Reflector/getMethods java.lang.Math 1 "abs" true))) java version "1.7.0_21" user=> (pprint (seq (clojure.lang.Reflector/getMethods java.lang.Math 1 "abs" true))) That might be a sign of undesirable behavior in invokeMatchingMethod() that is too dependent upon the order of methods given to it. As you mention, type hinting is good for avoiding the significant performance hit of reflection. |
[CLJ-1214] Compiler runs out of memory on a small snippet of code Created: 31/May/13 Updated: 02/Jun/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Praki Prakash | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux 3.2.0-39-generic |
||
| Attachments: |
|
| Description |
|
Clojure compiler runs out of memory when loading the attached file. Transcript below. $ java -cp ~/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar:. clojure.main Clojure 1.5.1 user=> (load "fubar") OutOfMemoryError GC overhead limit exceeded [trace missing] user=> The file contents are: (ns fu.bar) (defn foo[l] (concat (drop-last l) (repeat (last l)))) (def ^:const bar (foo [#(print "") #(println ";")])) bar If I remove the metadata on bar, it works. Removal of namespace seems to fix it as well. Pretty strange. Although I realize this code is not quite kosher, it would be nice to have the compiler deal with it. |
| Comments |
| Comment by Andy Fingerhut [ 01/Jun/13 7:40 PM ] |
|
If you really do have 'bar' on a line by itself at the end of file fubar.clj, it seems you are asking it to evaluate the value of bar, which by the definitions is an infinite list, and will of course exhaust all available memory if you attempt to evaluate it. It seems to me the more odd thing is not that it runs out of memory as shown, but that it does not run out of memory when you remove the metadata on bar. What is the purpose of having 'bar' on a line by itself at the end of the file? If I try this but remove 'bar' as the last line of the file, loading the file causes no errors regardless of whether there is metadata on bar's definition or not. It is strange that doing (load "fubar") followed by (first fu.bar/bar) seems to go into an infinite loop if the :const is there on bar, but quickly returns the correct answer if the metadata is removed. |
| Comment by Praki Prakash [ 01/Jun/13 8:40 PM ] |
|
This code snippet is a minimal test case to show that the compiler runs out of memory. What I meant by "it works" was that the compiler doesn't run out of memory and successfully loads the file (or in my real code base, the namespace is compiled). In my code, I use bar (or whatever the real thing is) as source of sequence of functions. The sole reference to bar is needed to trigger this issue. I believe that bar is not being fully evaluated here and thus no infinite loop. If I try to print it, yes, it will ultimately fail. |
| Comment by Praki Prakash [ 01/Jun/13 9:04 PM ] |
|
Having thought about this a bit more, it seems to me that when bar is annotated with const, the compiler is trying to evaluate the associated expression which exhausts the heap? I have never looked at the compiler source and thus not sure if this is what is happening. If it is, then it seems like one should be really careful when adding metadata. That still leaves the other question about the namespace requirement to cause memory exhaustion. I quite distinctly recall having to add the namespace when trying to come up with minimal test case to reproduce the bug. If you think this is really user error, I would accept it |
| Comment by Andy Fingerhut [ 02/Jun/13 4:56 AM ] |
|
It is not just any old metadata that causes this issue, only :const metadata. I tried testing with :const replaced with :dynamic and :private, and there was no problem. This might shed some light on the issue: https://github.com/clojure/clojure/blob/master/changes.md#215-const-defs It appears that ^:const is causing the compiler to evaluate the value at compile time. The value in your example is unbounded, so that can never complete. |
[CLJ-827] unsigned-bit-shift-right Created: 09/Aug/11 Updated: 10/Jun/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Joe Gallo | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 12 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Screened |
| Description |
|
Add a clojure equivalent of >>>. A simple version of this is implemented here (https://github.com/joegallo/clojure/tree/unsigned-bit-shift-right), and just follows the example set by shift-right. The downside of this implementation is that it treats all integer types as longs, and shifts them accordingly, which yields different results than you would get in java. A previous version of this did not have the same problem, when BitOps was its own thing. I'm not sure if this limitation is acceptable and appropriate, or needs to be worked around (my inclination is the latter). |
| Comments |
| Comment by Joe Gallo [ 11/Nov/11 12:58 PM ] |
|
I just realized (with the asssistance of Paul Stadig) that just doing only longs is probably sufficient, as you can get the integer version if you really want it: > (int (bit-and Integer/MAX_VALUE (unsigned-bit-shift-right -5 1))) Of course, that's less efficient than just doing it directly with java, but it's enough that I think my concern from the previous comment is addressed. |
| Comment by Tim McCormack [ 16/Jan/12 6:01 PM ] |
|
I have attached "0001-CLJ-827-Add-bit-shift-right-logical.patch", which implements a logical bit-shift-right using the same JVM bytecode as >>>. The patch mimics the implementations of << and >>. |
| Comment by Stuart Halloway [ 02/Feb/13 5:09 PM ] |
|
For context, this feature appears to be needed for Clojure-in-Clojure data structures: https://groups.google.com/d/msg/clojure-dev/iAwH7CLSFzE/6wzDH4RS1YQJ |
| Comment by Michał Marczyk [ 08/Feb/13 5:31 AM ] |
|
Just wanted to note that I've introduced this operation to ClojureScript when implementing PersistentHashMap. The name over there is bit-shift-right-zero-fill. Would it be alright for Clojure to use that name? Failing that, ClojureScript would probably have to change to match. |
| Comment by Gabriel Horner [ 24/May/13 2:23 PM ] |
|
I've added clj-827-unsigned-bit-shift-right-with-tests.patch which builds off of Tim's patch and adds tests. I also renamed the new fn to unsigned-bit-shift-right after chatting with Rich. @Michal - This may mean you need to rename the cljs fn. After this lands on master, I can open a ticket with a patch if you'd like. |
| Comment by Michał Marczyk [ 31/May/13 3:43 PM ] |
|
@Gabriel: Thanks! bit-shift-right-zero-fill is not marked private in ClojureScript, so it'll be a breaking change; if it's going to happen eventually (that is, if the name is settled), I suppose it's best to make it without waiting for Clojure. At any rate, I went ahead and created CLJS-514 to track the coordination effort. No patch attached; if you'd like to do the patching on both sides, that would be cool, otherwise I'll be happy to provide the CLJS patch. |
| Comment by Gabriel Horner [ 03/Jun/13 10:10 AM ] |
|
@Michal - I didn't mark it private. Are we taking about the same with-tests.patch? I'll try to get around to the cljs patch but feel free to beat me to it if I'm slow. |
| Comment by Michał Marczyk [ 10/Jun/13 1:57 AM ] |
|
@Gabriel: I mean it's not marked private in ClojureScript, so ClojureScript already exports the ...-zero-fill name, technically speaking. As per David Nolen's comment on CLJS-514, this is probably not a big deal. |
[CLJ-1217] for consumes sequence argument more eagerly than necessary Created: 14/Jun/13 Updated: 14/Jun/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
In a call like (do (for [x (do (println "realized") nil)] x) nil), no elements of the for comprehension are ever requested, and so it is not actually necessary to evaluate the inner do-block. However, this expression causes "realized" to be printed, because the first sequence-expression in for is evaluated even if no items are ever requested from the output lazy-seq. It's not documented whether this is intended or unintentional, but I was surprised by this behavior, and a brief unscientific survey on #clojure suggests that other users, even "old hands" who've been using clojure for years, don't expect this either. I've attached a patch that wraps the problematic expression in a lazy-seq call. This is not quite ideal, because it means that the first iteration is "lazied" twice, as in ((fn step [s] (lazy-seq ...)) (lazy-seq xs)), but a change to make this not happen would be much broader in scope, and this seemed the least dangerous. |
[CLJ-1219] Make identical? variadic Created: 19/Jun/13 Updated: 19/Jun/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Irakli Gozalishvili | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
(= 1 1 1) ;; => true I think it would make far more sense to make identical? consistent with all other comparison operators |
[CLJ-69] GC Issue 66: Add "keyset" to Clojure; make .keySet for APersistentMap return IPersistentSet Created: 17/Jun/09 Updated: 10/Dec/10 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Incomplete |
| Description |
Reported by wolfe.a.jason, Feb 04, 2009 Describe the feature/change. Add "keyset" to Clojure; make .keySet for APersistentMap return an IPersistentSet Was this discussed on the group? If so, please provide a link to the discussion: http://groups.google.com/group/clojure/browse_thread/thread/66e708e477ae992f/ff3d8d588068b60e?hl=en#ff3d8d588068b60e ----------------------------------------------------- A patch is attached. Some notes: I chose to add a "keyset" function, rather than change the existing "keys", so as to avoid breaking anything. The corresponding RT.keyset function just calls .keySet on the argument. I would have liked to have "keyset" return an IPersistentSet even when passed a (non-Clojure) java.util.Map, but this seems impossible to do in sublinear time because of essentially the same limitation mentioned in the above thread (the Map interface does not support getKey() or entryAt()) -- assuming, again, that "get" is supposed to return the actual (identical?) key in a set, and not just an .equal key. I then changed the implementation of .keySet for APersistentMap to essentially copy APersistentSet. A more concise alternative would have been to extend APersistentSet and override the .get method, but that made me a bit nervous (since if APeristentSet changed this could break). Anyway, this is my first patch for the Java side of Clojure, and I'm not yet solid on the conventions and aesthetics, so comments/questions/criticisms/requests for revisions are very welcome. |
| Comments |
| Comment by Assembla Importer [ 28/Sep/10 7:00 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/69 |
| Comment by Assembla Importer [ 28/Sep/10 7:00 AM ] |
|
oranenj said: [file:dKgE6mw3Gr3O2PeJe5afGb] |
| Comment by Assembla Importer [ 28/Sep/10 7:00 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Stuart Halloway [ 03/Dec/10 1:12 PM ] |
|
patch not in correct format |
[CLJ-211] Support arbitrary functional destructuring via -> and ->> Created: 17/Nov/09 Updated: 10/Dec/10 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Incomplete |
| Description |
|
Support arbitrary functional destructuring, that is the use of The discussion began here: The attached patch implements the spec described here: That is, the following examples would now work: user=> (let [(-> str a) 1] a) user=> (let [[a (-> str b) c] [1 2]] (list a b c)) user=> (let [(->> (map int) [a b]) "ab"] (list a b)) |
| Comments |
| Comment by Assembla Importer [ 28/Sep/10 6:57 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/211 |
| Comment by Assembla Importer [ 28/Sep/10 6:57 AM ] |
|
chouser@n01se.net said: [file:aHWQ_W06Kr3O89eJe5afGb]: [PATCH] Support -> and ->> in destructuring forms. |
| Comment by Assembla Importer [ 28/Sep/10 6:57 AM ] |
|
cgrand said: I think the current patch suffers from the problem described here http://groups.google.com/group/clojure-dev/msg/80ba7fad2ff04708 too. |
| Comment by Assembla Importer [ 28/Sep/10 6:57 AM ] |
|
richhickey said: so, don't use syntax-quote, just use clojure.core/-> |
| Comment by Assembla Importer [ 28/Sep/10 6:57 AM ] |
|
chouser@n01se.net said: Only -> and ->> are actually legal here anyway – if you've locally bound foo to -> there's not really any good reason to think (fn [(foo inc a)] a) should work. And if you've redefined -> or ->> to mean something else in your ns, do we need to catch that at compile time, or is it okay to emit the rearranged code and see what happens? In short, would '#{ |
| Comment by Assembla Importer [ 28/Sep/10 6:57 AM ] |
|
cgrand said: Only -> and ->> are legal here but what if they are aliased or shadowed? Instead of testing the symboil per se I would check, if:
(when-not (&env (first b)) (#{#'clojure.core/-> #'clojure.core/->>} (resolve (first b))))
but it requires to change destructure's sig to pass the env around |
| Comment by Stuart Halloway [ 03/Dec/10 1:03 PM ] |
|
Rich: Are you assigned to this by accident? If so, please deassign yourself. |
[CLJ-291] (take-nth 0 coll) redux... Created: 08/Apr/10 Updated: 10/Dec/10 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Incomplete |
| Description |
|
I dont seem to be able make the old ticket uninvalid so here goes (let [j 0 I used jvisualvm and the jvm is doing some RNI call - no clojure code is running at all |
| Comments |
| Comment by Assembla Importer [ 17/Oct/10 9:47 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/291 |
| Comment by Assembla Importer [ 17/Oct/10 9:47 AM ] |
|
bhurt said: Before this bug gets marked as invalid as well, let me point out that the problem here is that (take-nth 0 any-list) is a meaningless construction- the only question is what to do when this happens. IMHO, the correct behavior is to throw an exception. |
| Comment by Assembla Importer [ 17/Oct/10 9:47 AM ] |
|
ataggart said: [file:dfNhoS2Cir3543eJe5cbLA]: throws IllegalArgumentException on negative step size |
| Comment by Stuart Halloway [ 29/Oct/10 10:36 AM ] |
|
Does calling (take-nth 0 ...) cause the problem, or only realizing the result? |
| Comment by Chouser [ 29/Oct/10 11:06 AM ] |
|
I'm not seeing a problem. Calling take-nth and even partially consuming the seq it returns works fine for me: (take 5 (take-nth 0 [1 2 3])) Note however that it is returning an infinite lazy seq. The example in the issue description seems to include essentially (doall <infinite-lazy-seq>) which does blow the heap: (doall (range)) This issue still strikes me as invalid. |
| Comment by Rich Hickey [ 29/Oct/10 11:06 AM ] |
|
(take-nth 0 ...) returns an infinite sequence of the first item: (take 12 (take-nth 0 [1 2 3])) Is something other than this happening on Solaris? |
[CLJ-699] make sure compile paths shares as much code as possible Created: 31/Dec/10 Updated: 31/Dec/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stuart Halloway | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Issue http://dev.clojure.org/jira/browse/CLJ-697 highlighted the fact that compilation has more than one entry point. Review these entry points and make them share code. |
[CLJ-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-761] print-dup generates call to nonexistent method for APersistentVector$SubVector Created: 19/Mar/11 Updated: 04/Nov/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Backlog |
| Fix Version/s: | Backlog |
| Type: | Defect | Priority: | Minor |
| Reporter: | Stuart Sierra | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Originally reported by Carson print-dup on any collection type generates code to call the create method of the collection's class. APersistentVector$SubVector has no create method. Example with Clojure at commit ecae8ff08a298777c365a261001adfe9bfa4d83c : Clojure 1.3.0-master-SNAPSHOT
user=> (read-string (binding [*print-dup* true] (pr-str (subvec [1 2 3] 1))))
IllegalArgumentException No matching method found: create clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:50)
|
| Comments |
| Comment by Kevin Downey [ 04/Nov/11 11:29 AM ] |
|
33.927 hiredman ,(binding [*print-dup* true] (pr-str (first {:a 1}))) |
[CLJ-807] hash-maps print-dup as literal, thus can be read as array-maps Created: 07/Jun/11 Updated: 29/Jul/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | Priority: | Minor |
| Reporter: | Alexander Taggart | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Per Rich in user=> (hash-map :k :v)
{:k :v}
user=> (type *1)
clojure.lang.PersistentHashMap
user=> (binding [*print-dup* true] (print-str *2))
"{:k :v}"
user=> (read-string *1)
{:k :v}
user=> (type *1)
clojure.lang.PersistentArrayMap
The cause is due to RT.map conditionally creating an array-map if the size is within the PersistentArrayMap.HASHTABLE_THRESHOLD. |
| Comments |
| Comment by Aaron Bedra [ 28/Jun/11 6:47 PM ] |
|
Rich: do you want a patch for this? |
| Comment by Rich Hickey [ 29/Jul/11 7:42 AM ] |
|
Only if it important to someone, solves some problem. |
[CLJ-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-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 eas |