[CLJ-1208] Namespace is not loaded on defrecord class init Created: 03/May/13 Updated: 03/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Tim McCormack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
As a user of Clojure interop from Java, I want defrecords (and deftypes?) to load their namespaces upon class initialization so that I can simply construct and use AOT'd record classes without manually requiring their namespaces first. Calling the defrecord's constructor may or may not result in "Attempting to call unbound fn" exceptions, depending on what code has already been run. This issue has been raised several times over the years, but I could not find an existing ticket for it:
|
[CLJ-1207] Importing a class that does not exist fails to report the name of the class that did not exist Created: 29/Apr/13 Updated: 10/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Howard Lewis Ship | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | feedback | ||
| Environment: |
1.5.1, OS X |
||
| Waiting On: | Howard Lewis Ship |
| Description |
|
Pop quiz: What Java class is missing from the classpath? java.lang.NoClassDefFoundError: Could not initialize class com.annadaletech.nexus.util.logging__init
at java.lang.Class.forName0 (Class.java:-2)
java.lang.Class.forName (Class.java:264)
clojure.lang.RT.loadClassForName (RT.java:2098)
clojure.lang.RT.load (RT.java:430)
clojure.lang.RT.load (RT.java:411)
clojure.core$load$fn__5018.invoke (core.clj:5530)
clojure.core$load.doInvoke (core.clj:5529)
clojure.lang.RestFn.invoke (RestFn.java:408)
clojure.core$load_one.invoke (core.clj:5336)
clojure.core$load_lib$fn__4967.invoke (core.clj:5375)
clojure.core$load_lib.doInvoke (core.clj:5374)
clojure.lang.RestFn.applyTo (RestFn.java:142)
clojure.core$apply.invoke (core.clj:619)
clojure.core$load_libs.doInvoke (core.clj:5413)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invoke (core.clj:619)
clojure.core$require.doInvoke (core.clj:5496)
clojure.lang.RestFn.invoke (RestFn.java:512)
novate.console.app$eval1736$loading__4910__auto____1737.invoke (app.clj:1)
novate.console.app$eval1736.invoke (app.clj:1)
clojure.lang.Compiler.eval (Compiler.java:6619)
clojure.lang.Compiler.eval (Compiler.java:6608)
clojure.lang.Compiler.load (Compiler.java:7064)
user$eval1732.invoke (NO_SOURCE_FILE:1)
clojure.lang.Compiler.eval (Compiler.java:6619)
clojure.lang.Compiler.eval (Compiler.java:6582)
clojure.core$eval.invoke (core.clj:2852)
clojure.main$repl$read_eval_print__6588$fn__6591.invoke (main.clj:259)
clojure.main$repl$read_eval_print__6588.invoke (main.clj:259)
clojure.main$repl$fn__6597.invoke (main.clj:277)
clojure.main$repl.doInvoke (main.clj:277)
clojure.lang.RestFn.invoke (RestFn.java:1096)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__584.invoke (interruptible_eval.clj:56)
clojure.lang.AFn.applyToHelper (AFn.java:159)
clojure.lang.AFn.applyTo (AFn.java:151)
clojure.core$apply.invoke (core.clj:617)
clojure.core$with_bindings_STAR_.doInvoke (core.clj:1788)
clojure.lang.RestFn.invoke (RestFn.java:425)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:41)
clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__625$fn__628.invoke (interruptible_eval.clj:171)
clojure.core$comp$fn__4154.invoke (core.clj:2330)
clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__618.invoke (interruptible_eval.clj:138)
clojure.lang.AFn.run (AFn.java:24)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:603)
java.lang.Thread.run (Thread.java:722)
If you guess "com.annadaletech.nexus.util.logging__init" you are wrong! Wait, I'll give you a hint: (ns com.annadaletech.nexus.util.logging
(:use [clojure.string :only [trim-newline]]
[clojure.pprint :only [code-dispatch pprint with-pprint-dispatch *print-right-margin*]])
(:import [java.io StringWriter]
[org.slf4j MDC MarkerFactory Marker LoggerFactory]
[java.util.concurrent.locks ReentrantLock]))
Oh, sorry, did that not help? The correct answer is "org.slf4j.MDC". Having that information in the stack trace would have saved me nearly an hour. I think it is worth the effort to get that reported correctly. |
| Comments |
| Comment by Gabriel Horner [ 10/May/13 1:56 PM ] |
|
When I try this on a fresh project, I get this error: Howard, could you give us a project.clj or better yet a github repository that recreates this issue? |
| Comment by Howard Lewis Ship [ 10/May/13 4:51 PM ] |
|
I'll see what I can do. Probably be next week. Thanks for looking at this. |
[CLJ-1206] 'eval' of closures or fns with runtime metadata within a call expr yields "No matching ctor found" exceptions Created: 28/Apr/13 Updated: 28/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Jason Wolfe | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I ran into some issues with 'eval' when writing compilation strategies for Graph. It seems these may have been known for some time [1], but I couldn't find a ticket for them, so here we are. Clojure docs [2] say "If the operator is not a special form or macro, the call is considered a function call. Both the operator and the operands (if any) are evaluated, from left to right," and "Any object other than those discussed above will evaluate to itself." While bare fns do seem to evaluate to themselves in all cases, when in a call expression, the evaluation of the operator fails on fn objects that are closures or have run-time metadata applied: ;; raw non-closures are fine ;; raw closures are fine ;; non-closures in exprs are fine ;; but closures in exprs cause an error ;; as do fns with metadata in exprs [1] http://stackoverflow.com/a/11287181 |
[CLJ-1201] There should also be writing in clojure.edn Created: 15/Apr/13 Updated: 15/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Vitaly Shukela | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | edn | ||
| Description |
|
In clojure.edn I see only "read" and "read-string". For symmetry I expect "write" and "write-string" to be nearby. At first it could be just alias for "pr" and "pr-str", but in furure they may limited version of "pr" which only produces valid input for clojure.edn/read. |
[CLJ-1199] Record values are not 'eval'uated, unlike values of PersistentMap: Created: 13/Apr/13 Updated: 13/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Jason Wolfe | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I'm not sure if this is by design, but it caught me off guard. user> (defrecord A [x]) user> (eval (hash-map :x `long)) and in case it matters, here's a simplified version of the real use case where this came up, with no eval – just a macro: user> (defmacro munge-meta1 [x] (assoc x :schema (->A (:schema (meta x))))) user> (defmacro munge-meta2 [x] (assoc x :schema (hash-map :x (:schema (meta x))))) This seems to be fixed by moving the record creation post-evaluation, so it's not a big deal, just surprising (plus I haven't yet convinced myself that this will always work if the user's schema itself contains record-creating forms, although it seems to work OK): user> (defmacro munge-meta1 [x] (assoc x :schema `(->A ~(:schema (meta x))))) I brought this up on the mailing list here: https://groups.google.com/forum/?fromgroups=#!topic/clojure-dev/UgD35E1RQTo |
[CLJ-1198] Apply metadata to primitive fns causes them to lose their primitive-ness Created: 13/Apr/13 Updated: 13/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Jason Wolfe | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
user> (def f (fn [^long x] x)) We're working on libraries that use metadata on functions to track information about their arguments (schemata, etc), and this currently blocks us from fully supporting primitive fns. |
[CLJ-1195] emit-hinted-impl expands to non-ns-qualified invocation of 'fn' Created: 09/Apr/13 Updated: 09/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Jason Wolfe | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Mac os X Clojure 1.5.1 |
||
| Description |
|
(ns plumbing.tmp (defprotocol Foo (extend-protocol Foo yields CompilerException java.lang.RuntimeException: Unable to resolve symbol: fn in this context, compiling This makes it difficult to construct a namespace that provides a replacement def for fn. |
[CLJ-1192] vec function is substantially slower than into function Created: 06/Apr/13 Updated: 07/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Luke VanderHart | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
(vec coll) and (into [] coll) do exactly the same thing. However, due to into using transients, it is substantially faster. On my machine: (time (dotimes [_ 100] (vec (range 100000)))) (time (dotimes [_ 100] (into [] (range 100000)))) This is consistently repeatable. Since vec's sole purpose is to transform collections into vectors, it should do so at the maximum speed available. |
| Comments |
| Comment by Andy Fingerhut [ 07/Apr/13 5:50 PM ] |
|
I am pretty sure that Clojure 1.5.1 also uses transient vectors for (vec (range n)) (probably also some earlier versions of Clojure, too). Look at vec in core.clj. It checks whether its arg is a java.util.Collection, which lazy seqs are, so calls (clojure.lang.LazilyPersistentVector/create coll). LazilyPersistentVector's create method checks whether its argument is an ISeq, which lazy seqs are, so it calls PersistentVector.create(RT.seq(coll)). All 3 of PersistentVector's create() methods use transient vectors to build up the result. I suspect the difference in run times are not because of transients or not, but because of the way into uses reduce, and perhaps may also have something to do with the perhaps-unnecessary call to RT.seq in LazilyPersistentVector's create method (in this case, at least – it is likely needed for other types of arguments). |
[CLJ-1190] Javadoc for public Java API Created: 03/Apr/13 Updated: 03/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stuart Halloway | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
We should publish javadoc for http://dev.clojure.org/jira/browse/CLJ-1188.
This ticket should wait until |
[CLJ-1189] Map-destructuring :or fumble needs compiler warning Created: 31/Mar/13 Updated: 31/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Phill Wolf | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Here is a map-destructuring blunder that I wish the compiler warned about: (defn server It would be splendid to get a warning that :or keys that are not symbols being bound have no effect. The incomplete code snippet above comes from Pedestal.service 0.1.0. Here is a complete one-line example with the coding error: user> (defn picnic [{botulism :botulism :or {:botulism 6}}] botulism) |
[CLJ-1184] Evaling #{do ...} or [do ...] is treated as the do special form Created: 16/Mar/13 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Jiří Maršík | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | Compiler, bug | ||
| Approval: | Vetted |
| Description |
|
Evaluating a persistent collection for which the function 'first' returns the symbol 'do' leads to that collection being treated as the do special form, even though it may be a vector or even a set. IMHO, the expected result would be to report that 'do' cannot be resolved. For the cause, see the if condition on line 6604 of Compiler.java in clojure-1.5.1. E.g.: #{"hello" "goodbye" do} |
[CLJ-1183] java interop - cannot call a final method on non-public superclass Created: 13/Mar/13 Updated: 18/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Shlomi | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
when trying to call a method on a concrete class that is defined as final on its super class that is not public, the runtime throws: "java.lang.IllegalArgumentException: Can't call public method of non-public class" even when fully annotated, Reflection is still used and the call fails. you can read the full description here https://groups.google.com/d/msg/clojure/p2tBMT-BIYc/mDQB8cSponMJ I included a sample project that demonstrate the problem |
| Comments |
| Comment by Shlomi [ 13/Mar/13 6:51 AM ] |
|
in my sample project, i used a nested class, but i didnt have to (as pointed by Marko Topolnik). changing the java code to: abstract class AbstractParent{ public class test extends AbstractParent {} and the clojure to: (ns call-test.core (:gen-class)) would produce the same error, java.lang.IllegalArgumentException: Can't call public method of non-public class: public final int AbstractParent.x() |
| Comment by zoowar [ 16/May/13 12:05 PM ] |
|
This issue affects the upcoming netty-4.0 release in which the public modifier of AbstractBootstrap was removed. |
| Comment by Matthew Phillips [ 18/May/13 3:48 AM ] |
|
To get Netty 4 working with Clojure I had to create a set of public static Java methods for the various inaccessible Netty calls, which I then call from Clojure. A PITA, but works fine. Happy to post code if anyone would find it useful. |
| Comment by Shlomi [ 18/May/13 4:31 AM ] |
|
Matthew, i kinda left that project after running to these and other troubles (focused on previous Netty until version 4 will become ready and be properly documented), but i'd still like to see your code. you have a github account or a gist with it? Clojure devs - are there any plans of checking this problem out? it came up from Netty, but the problem is pretty generic |
| Comment by Matthew Phillips [ 18/May/13 7:22 PM ] |
|
Shlomi: here's a gist with the code I'm using in it. It's not comprehensive, just the bits I needed. |
[CLJ-1181] clojure.pprint/code-dispatch breaks on certain types of anonymous functions Created: 10/Mar/13 Updated: 18/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Devin Walters | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
(with-out-str
(with-pprint-dispatch code-dispatch
(pp/pprint (read-string "(fn* [x] x)"))))
breaks because the format string here: https://github.com/clojure/clojure/blob/master/src/clj/clojure/pprint/dispatch.clj#L378 expects a sequence. In the case of (fn* [x] x) it is passed a symbol. |
| Comments |
| Comment by Jean Niklas L'orange [ 18/Mar/13 5:40 PM ] |
|
I think the main "issue" here resides within the undocumented functionality of fn*. (fn* [x] x) is a semantically working function, but (fn [x] x) expands into (fn* ([x] x)). Anonymous function literals expand into (fn* [gensyms] (...)), and as such, it also accepts expressions like (fn* [x] x). Should pprint pretty print expressions which has used fn* directly, or should it "just" ignore it? |
[CLJ-1172] Cross-linking between clojure.lang.Compiler and clojure.lang.RT Created: 28/Feb/13 Updated: 23/Mar/13 |
|
| Status: | Reopened |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Yegor Bugayenko | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
version 1.5.0-RC17 |
||
| Description |
|
This is my code (an example): import clojure.lang.Compiler;
import clojure.lang.RT;
import clojure.lang.Var;
Compiler.load("(+ 5 %)");
Var foo = RT.var("bar", "foo");
Object result = foo.invoke(10);
assert result.toString().equals("15");
This is what I'm getting: ava.lang.ExceptionInInitializerError at clojure.lang.Compiler.<clinit>(Compiler.java:47) at foo.main(Main.java:75) Caused by: java.lang.NullPointerException at clojure.lang.RT.baseLoader(RT.java:2043) at clojure.lang.RT.load(RT.java:417) at clojure.lang.RT.load(RT.java:411) at clojure.lang.RT.doInit(RT.java:447) at clojure.lang.RT.<clinit>(RT.java:329) ... 36 more The same code worked just fine with version 1.4. Looks like Compiler is using RT and RT is using Compiler, both statically. |
| Comments |
| Comment by Yegor Bugayenko [ 04/Mar/13 11:40 AM ] |
|
I cross-posted this question to SO: http://stackoverflow.com/questions/15207596 |
| Comment by Yegor Bugayenko [ 05/Mar/13 12:04 AM ] |
|
calling RT.init() before Compiler.load() solves the problem |
| Comment by Andy Fingerhut [ 05/Mar/13 4:17 AM ] |
|
Yegor, do you consider it OK to close this ticket as not being a problem, or at least one with a reasonable workaround? |
| Comment by Yegor Bugayenko [ 05/Mar/13 1:11 PM ] |
|
Yes, of course. Let's close it. |
| Comment by Andy Fingerhut [ 05/Mar/13 6:14 PM ] |
|
Ticket submitter agrees that this is not an issue, or that there is a reasonable workaround. |
| Comment by Andy Fingerhut [ 13/Mar/13 12:58 AM ] |
|
This issue came up again on the Clojure group. https://groups.google.com/forum/?hl=en_US&fromgroups=#!topic/clojure/2xdLNMb9yyQ I did some testing, and the issue did not exist in Clojure 1.5.0-RC3 and before, and it has existed since 1.5.0-RC4. There was only one commit between those two points: https://github.com/clojure/clojure/commit/9b80a552fdabeabdd93951a625b55ae49c2f8d83 Maybe this new behavior is an intended consequence of that change. I don't know. In any case, it seems like perhaps the "No need to call RT.init() anymore" message might be outdated? |
| Comment by Andy Fingerhut [ 13/Mar/13 12:59 AM ] |
|
Reopening since it came up again, and there is some more info known about the issue. I'll let someone who knows more about the issue decide whether to close it. |
| Comment by Edward [ 23/Mar/13 10:31 AM ] |
|
Doing this RT.load("clojure/core"); at the top works avoids the message from RT.init() |
[CLJ-1167] repl value of *file* is "NO_SOURCE_PATH", of *source-path* is "NO_SOURCE_FILE" Created: 19/Feb/13 Updated: 19/Feb/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Brian Marick | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Comments |
| Comment by Brian Marick [ 19/Feb/13 4:22 PM ] |
|
Forgot to mention: I think it's intended to be the other way around, given the names. |
[CLJ-1162] Error Message when calling deref on a non-IDeref is unhelpful Created: 12/Feb/13 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Julian Birch | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Found this on ubuntu, lein 2, Clojure 1.5 snapshot, but it's obvious from inspection |
||
| Description |
|
If you just type "@1" is the repl, on previous versions you'll get an error that Long cannot be cast to IDeref. In 1.5, the error message is that it cannot be cast to java.util.concurrent.Future. This is because it assumes that anything that isn't an IDeref is automatically a Future. The deref method should generate a custom error stating that the type you've passed in is neither an IDeref nor a Future. |
[CLJ-1159] clojure.java.io/delete-file doesn't return the status of the deletion(true/false) Created: 10/Feb/13 Updated: 10/Feb/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | AtKaaZ | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | delete-file, evil, or | ||
| Environment: |
any |
||
| Description |
|
initially reported it here(somehow): Basically clojure.java.io/delete-file doesn't ever return false (even when silently is true, it returns the value of silently), it's due to how it's implemented - but it's obvious from the code, so I'll stop here. Thanks. PS: this is what I'm using as my current workaround: I'm sure you guys can find a better way, but as a clojure newbie(really!) that's what I have. |
| Comments |
| Comment by AtKaaZ [ 10/Feb/13 2:01 PM ] |
|
I kinda just realized it affects all versions since and including 1.2, because it appears that its implementation was the same since then. If it's not meant to return the result of the delete, maybe it should specifically return nil and/or the doc say something? |
| Comment by Sean Corfield [ 10/Feb/13 2:21 PM ] |
|
As noted in a thread on the Clojure ML, you can pass a known value in the second argument position to detect a delete that failed: (clojure.java.io/delete-file some-file :not-deleted) This returns true on success and :not-deleted on failure. However the docstring could be better worded to make that intention clear. Perhaps: Delete file f. Return true if it succeeds. If silently is nil or false, raise an exception if it fails, else return the value of silently. |
[CLJ-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-1152] PermGen leak in multimethods and protocol fns Created: 30/Jan/13 Updated: 30/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Chouser | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
There is a PermGen memory leak that we have tracked down to protocol methods and multimethods called inside an eval, because of the caches these methods use. The problem only arises when the value being cached is an instance of a class (such as a function or reify) that was defined inside the eval. Thus extending IFn or dispatching a multimethod on an IFn are likely triggers. My fellow LonoClouder, Jeff Dik describes how to reproduce and work around the problem: The easiest way that I have found to test this is to set "-XX:MaxPermSize" to a reasonable value so you don't have to wait too long for the PermGen space to fill up, and to use "-XX:+TraceClassLoading" and "-XX:+TraceClassUnloading" to see the classes being loaded and unloaded. leiningen project.clj (defproject permgen-scratch "0.1.0-SNAPSHOT" :dependencies [[org.clojure/clojure "1.5.0-RC1"]] :jvm-opts ["-XX:MaxPermSize=32M" "-XX:+TraceClassLoading" "-XX:+TraceClassUnloading"]) You can use lein swank 45678 and connect with slime in emacs via M-x slime-connect. To monitor the PermGen usage, you can find the Java process to watch with "jps -lmvV" and then run "jstat -gcold <PROCESS_ID> 1s". According to the jstat docs, the first column (PC) is the "Current permanent space capacity (KB)" and the second column (PU) is the "Permanent space utilization (KB)". VisualVM is also a nice tool for monitoring this. Multimethod leakEvaluating the following code will run a loop that eval's (take* (fn foo [])). multimethod leak (defmulti take* (fn [a] (type a))) (defmethod take* clojure.lang.Fn [a] '()) (def stop (atom false)) (def sleep-duration (atom 1000)) (defn run-loop [] (when-not @stop (eval '(take* (fn foo []))) (Thread/sleep @sleep-duration) (recur))) (future (run-loop)) (reset! sleep-duration 0) In the lein swank session, you will see many lines like below listing the classes being created and loaded. [Loaded user$eval15802$foo__15803 from __JVM_DefineClass__] [Loaded user$eval15802 from __JVM_DefineClass__] These lines will stop once the PermGen space fills up. In the jstat monitoring, you'll see the amount of used PermGen space (PU) increase to the max and stay there. - PC PU OC OU YGC FGC FGCT GCT 31616.0 31552.7 365952.0 0.0 4 0 0.000 0.129 32000.0 31914.0 365952.0 0.0 4 0 0.000 0.129 32768.0 32635.5 365952.0 0.0 4 0 0.000 0.129 32768.0 32767.6 365952.0 1872.0 5 1 0.000 0.177 32768.0 32108.2 291008.0 23681.8 6 2 0.827 1.006 32768.0 32470.4 291008.0 23681.8 6 2 0.827 1.006 32768.0 32767.2 698880.0 24013.8 8 4 1.073 1.258 32768.0 32767.2 698880.0 24013.8 8 4 1.073 1.258 32768.0 32767.2 698880.0 24013.8 8 4 1.073 1.258 A workaround is to run prefer-method before the PermGen space is all used up, e.g. (prefer-method take* clojure.lang.Fn java.lang.Object)
Then, when the used PermGen space is close to the max, in the lein swank session, you will see the classes created by the eval'ing being unloaded. [Unloading class user$eval5950$foo__5951] [Unloading class user$eval3814] [Unloading class user$eval2902$foo__2903] [Unloading class user$eval13414] In the jstat monitoring, there will be a long pause when used PermGen space stays close to the max, and then it will drop down, and start increasing again when more eval'ing occurs. - PC PU OC OU YGC FGC FGCT GCT 32768.0 32767.9 159680.0 24573.4 6 2 0.167 0.391 32768.0 32767.9 159680.0 24573.4 6 2 0.167 0.391 32768.0 17891.3 283776.0 17243.9 6 2 50.589 50.813 32768.0 18254.2 283776.0 17243.9 6 2 50.589 50.813 The defmulti defines a cache that uses the dispatch values as keys. Each eval call in the loop defines a new foo class which is then added to the cache when take* is called, preventing the class from ever being GCed. The prefer-method workaround works because it calls clojure.lang.MultiFn.preferMethod, which calls the private MultiFn.resetCache method, which completely empties the cache. Protocol leakThe leak with protocol methods similarly involves a cache. You see essentially the same behavior as the multimethod leak if you run the following code using protocols. protocol leak (defprotocol ITake (take* [a])) (extend-type clojure.lang.Fn ITake (take* [this] '())) (def stop (atom false)) (def sleep-duration (atom 1000)) (defn run-loop [] (when-not @stop (eval '(take* (fn foo []))) (Thread/sleep @sleep-duration) (recur))) (future (run-loop)) (reset! sleep-duration 0) Again, the cache is in the take* method itself, using each new foo class as a key. A workaround is to run -reset-methods on the protocol before the PermGen space is all used up, e.g. (-reset-methods ITake) This works because -reset-methods replaces the cache with an empty MethodImplCache. |
| Comments |
| Comment by Chouser [ 30/Jan/13 9:10 AM ] |
|
I think the most obvious solution would be to constrain the size of the cache. Adding an item to the cache is already not the fastest path, so a bit more work could be done to prevent the cache from growing indefinitely large. That does raise the question of what criteria to use. Keep the first n entries? Keep the n most recently used (which would require bookkeeping in the fast cache-hit path)? Keep the n most recently added? |
[CLJ-1149] Unhelpful error message from :use (and use function) when arguments are malformed Created: 17/Jan/13 Updated: 17/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Sean Corfield | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
the following exception happens when you have something like this(bad): (ns runtime.util-test as opposed to any of these(correct): (ns runtime.util-test (ns runtime.util-test and the exception is: Note that this is similar to the equally unhelpful message shown in http://dev.clojure.org/jira/browse/CLJ-1140 although that is a different root cause. Probably best to enhance the `use` function to validate its arguments before trying to apply hash-map? |
[CLJ-1147] Threading macro (->) does not permit inline function declarations Created: 14/Jan/13 Updated: 19/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Stephen Nelson | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
(-> [1 2 3] (fn [args] apply + args)) CompilerException java.lang.Exception: Unsupported binding form: 1, compiling:(NO_SOURCE_PATH:1:13) The expression is expanded to: (fn [1 2 3] [args] apply + args) If this is intended behaviour then at the least the compiler error message is confusing. It would be preferable if the -> macro checked for (fn..) before treating a form as a sequence and injecting the argument. |
| Comments |
| Comment by Andy Fingerhut [ 15/Jan/13 12:56 AM ] |
|
Note that this works as you might have hoped: (-> [1 2 3] ((fn [args] (apply + args)))) because it expands into: ((fn [args] (apply + args)) [1 2 3]) Your suggestion that -> check for (fn ...) before treating it as a sequence and injecting the argument leaves open the question: Why only (fn ...) should be treated specially? Why not (let ...), (for ...), (doseq ...), etc? And if you go that far, how do you decide what should be allowed and what not? |
| Comment by Gabriel Horner [ 17/May/13 2:56 PM ] |
|
I agree with Andy, that it's not realistic suggestion to check for fn,let,etc. Perhaps a doc fix would help here but I'm not sure if we just want to call out (fn ...). I'd recommend closing this unless Stephen speaks up. |
| Comment by Stephen Nelson [ 19/May/13 10:29 PM ] |
|
I'm happy with Andy's synopsis of the problem, and it's reasonable not to change the behaviour of the threading macro specifically for (fn..). However, this is a mistake that I'm sure many others make/have made and it's hard to diagnose what is going wrong without dumping interpreted form – hardly a reasonable expectation for a novice user. Before closing this issue, I'd like to see improved failure reporting, such as causing the threading macro to throw a compile error or warning if passed a raw (unwrapped) function declaration (are there legitimate use cases this would affect?). |
[CLJ-1146] Symbol name starting with digits to defn throws "Unmatched delimiter )" Created: 13/Jan/13 Updated: 13/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Linus Ericsson | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | reader | ||
| Environment: |
$java -jar clojure-1.5.0-RC2.jar $java -version |
||
| Description |
|
When trying to use an invalid symbol name when defining a function, the error message thrown is a confusing and wrong one. The error message is "RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:219)", which unfortunately is the only message seen in nrepled emacs. $ java -jar clojure-1.5.0-RC2.jar Expected: |
[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-1141] Allow pre and post-conditions in defprotocol and deftype macros Created: 02/Jan/13 Updated: 07/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Alexander Kiel | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Dos not matter. |
||
| Description |
|
The fn special form and the defn macro allow pre- and post-conditions. It would be nice if one could use that conditions also in method declarations of the defprotocol and deftype macro. Currently I use the extend function as workaround where one can specify the methods using a map of keyword-name and fn special form. |
| Comments |
| Comment by Michael Drogalis [ 06/Jan/13 6:22 PM ] |
|
Using :pre and :post, IMO, isn't a good idea. Handling assertions is a two part game. The mechanism needs to account for both detection and reaction, and the latter is missing. This isn't a perfect work-around, as it's a little verbose, but using Dire might work better than using extend. In addition, you get the "reaction" functionality that's missing from :pre and :post Example for protocol preconditions: https://gist.github.com/4471276 |
| Comment by Alexander Kiel [ 07/Jan/13 11:52 AM ] |
|
@Michael I read your gist and the README of Dire. I think the supervision concept of Erlang has it's places but I don't like it for pre- and post-conditions. For me, such conditions have two proposes:
To support my first point, your pre- and post-conditions are just lexical too far away from the actual function definition. For the second point: I think in the case of violations the program should just crash. One could maybe wrap some part of the program with one of your exception supervisors handling an AssertionError. But I don't think that handling pre- and post-condition violations for individual functions is a good thing. |
| Comment by Michael Drogalis [ 07/Jan/13 5:28 PM ] |
|
@Alexander Indeed, your points are correct. Dire is meant to be exactly what you described. Lexically removed from application logic, and opportunity to recover from crashing. That was my best shot at aiding your needs quickly, anyway. |
[CLJ-1138] data-reader returning nil causes exception Created: 22/Dec/12 Updated: 14/Feb/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Steve Miner | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | reader | ||
| Environment: |
clojure 1.5 beta2, Mac OS X 10.8.2, java version "1.6.0_37" |
||
| Description |
|
If a data-reader returns nil, the reader throws java.lang.RuntimeException: No dispatch macro... The error message implies that there is no dispatch macro for whatever the first character of the tag happens to be. Here's a simple example: (binding [*data-readers* {'f/ignore (constantly nil)}] (read-string "#f/ignore 42 10")) RuntimeException No dispatch macro for: f clojure.lang.Util.runtimeException (Util.java:219) |
| Comments |
| Comment by Steve Miner [ 22/Dec/12 9:43 AM ] |
|
clj-1138-allow-data-reader-to-return-nil-instead-of-throwing.patch allows a data-reader to return nil instead of throwing. Does sanity check that possible tag or record isJavaIdentifierStart(). Gives better error message for special characters that might actually be dispatch macros (rather than assuming it's a tagged literal). |
| Comment by Steve Miner [ 22/Dec/12 10:06 AM ] |
|
clj-1138-data-reader-return-nil-for-no-op.patch allows a data-reader returning nil to be treated as a no-op by the reader (like #_). nil is not normally a useful value (actually it causes an exception in Clojure 1.4 through 1.5 beta2) for a data-reader to return. With this patch, one could get something like a conditional feature reader using data-readers. |
| Comment by Steve Miner [ 22/Dec/12 10:26 AM ] |
|
clj-1138-allow-data-reader-to-return-nil-instead-of-throwing.patch is the first patch to consider. It merely allows nil as a value from a data-reader and returns nil as the final value. I think it does what was originally intended for dispatch macros, and gives a better error message in many cases (mostly typos). The second patch, clj-1138-data-reader-return-nil-for-no-op.patch, depends on the other being applied first. It takes an extra step to treat a nil value returned from a data-reader as a no-op for the reader (like #_). |
| Comment by Steve Miner [ 23/Dec/12 11:52 AM ] |
|
It turns out that you can work around the original problem by having your data-reader return '(quote nil) instead of plain nil. That expression conveniently evaluates to nil so you can get a nil if necessary. This also works after applying the patches so there's still a way to return nil if you really want it. (binding [*data-readers* {'x/nil (constantly '(quote nil))}] (read-string "#x/nil 42")) |
| Comment by Andy Fingerhut [ 07/Feb/13 9:20 AM ] |
|
Patch clj-1138-allow-data-reader-to-return-nil-instead-of-throwing.patch dated Dec 22 2012 still applies cleanly to latest master if you use the following command: % git am --keep-cr -s --ignore-whitespace < clj-1138-allow-data-reader-to-return-nil-instead-of-throwing.patch Without the --ignore-whitespace option, the patch fails only because some whitespace was changed in Clojure master recently. |
| Comment by Andy Fingerhut [ 13/Feb/13 11:24 AM ] |
|
OK, now with latest master (1.5.0-RC15 at this time), patch clj-1138-allow-data-reader-to-return-nil-instead-of-throwing.patch no longer applies cleanly, not even using --ignore-whitespace in the 'git am' command given above. Steve, if you could see what needs to be updated, that would be great. Using the patch command as suggested in the "Updating stale patches" section of http://dev.clojure.org/display/design/JIRA+workflow wasn't enough, so it should probably be carefully examined by hand to see what needs updating. |
| Comment by Steve Miner [ 14/Feb/13 12:21 PM ] |
|
I removed my patches. Things have changes recently with the LispReader and new EdnReader. |
[CLJ-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-1133] Certain actions on mutable fields in deftype lead to very strange error messages Created: 18/Dec/12 Updated: 19/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Vladimir Matveev | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Archlinux x86_64, Windows 7 x86_64 |
||
| Description |
|
Consider the following code: (definterface Test (deftype TestImpl Its compilation fails with the following message: The following code works: (definterface Test (deftype TestImpl The only change here is that I have wrapped (dec x) form into (int) call. I understand that in fact the former code should not work anyway (or at least should not work as I have expected) because (dec) is defined as a call to clojure.lang.Numbers.dec(), which is overloaded for double, long and Object only (in fact, changing :tag int to :tag long in the first example allows the program to compile). However, the error message is completely uninformative and misleading; it also looks like that it is a consequence of compiler error. It is also not a problem of this concrete example; I found this error in more complex interface method implementation where (set!) call was right in the middle of its body. I'm using Clojure 1.4.0 and have experienced this problem on Archlinux x86_64 and Windows 7 x86_64. Full stack trace of the error, in case it would be helpful: java.lang.VerifyError: (class: test/TestImpl, method: fail signature: ()V) Expecting to find integer on stack, compiling |
| Comments |
| Comment by Vladimir Matveev [ 18/Dec/12 1:51 PM ] |
|
Shouldn't have set major priority; but I cannot edit issue again |
| Comment by Andy Fingerhut [ 19/Dec/12 1:20 AM ] |
|
Reduced priority to minor, since ticket creator could not do so themselves. |
[CLJ-1132] For record type Rec, (instance? Rec (map->Rec {...})) need not return true, though (instance? Rec (Rec. ...)) does. Created: 18/Dec/12 Updated: 18/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Christopher Genovese | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | constructor, defrecord | ||
| Environment: |
Apache Tomcat/6.0.24 JVM/1.6.0_26-b03 Linux 2.6.32-279.el6.x86_64 Clojure 1.4.0, Ring 1.1.6, Compojure 1.1.3, Lein-Ring Plugin 0.7.5 (for lein ring uberwar) |
||
| Attachments: |
|
| Description |
|
(defrecord Rec ...) (instance? Rec (Rec. ...)) ;=> true (.getClassLoader Rec) ;=> WebappClassLoader (delegate: false, repositories: /WEB-INF/classes/, parent: org.apache.catalina.loader.StandardClassLoader@790bc49d) The map->Rec delegates to the create method, which seems to be where the problem lies. The record namespace is AOT compiled, properly I think/hope, and the requisite classes I have attached a minimal web app that reproduces the problem and shows Again, I've only been able to reproduce the problem under Tomcat, |
[CLJ-1131] Importing a non-existent class causes an exception that does not fully identify the source file Created: 17/Dec/12 Updated: 17/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Howard Lewis Ship | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | feedback | ||
| Description |
|
I'm in the process of stripping out some OSGi support, and I missed one import. The exception identifies "init.clj", but I'd prefer to see the full path there, as I have a few different "init.clj" files in my overall project. :core-services:compileClojure Reflection warning, com/annadaletech/nexus/services/registry.clj:37 - call to unregisterAll can't be resolved. Reflection warning, com/annadaletech/nexus/services/registry.clj:131 - call to getConfiguration can't be resolved. Reflection warning, com/annadaletech/nexus/services/registry.clj:150 - call to getConfiguration can't be resolved. Exception in thread "main" java.lang.ClassNotFoundException: org.osgi.framework.ServiceRegistration, compiling:(init.clj:1) at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3387) at clojure.lang.Compiler.compile1(Compiler.java:7035) at clojure.lang.Compiler.compile1(Compiler.java:7025) at clojure.lang.Compiler.compile(Compiler.java:7097) at clojure.lang.RT.compile(RT.java:387) at clojure.lang.RT.load(RT.java:427) at clojure.lang.RT.load(RT.java:400) at clojure.core$load$fn__4890.invoke(core.clj:5415) at clojure.core$load.doInvoke(core.clj:5414) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5227) at clojure.core$compile$fn__4895.invoke(core.clj:5426) at clojure.core$compile.invoke(core.clj:5425) at clojuresque.tasks.compile$main$fn__64.invoke(compile.clj:23) at clojuresque.cli$with_command_line_STAR_.invoke(cli.clj:92) at clojuresque.tasks.compile$main.doInvoke(compile.clj:6) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:601) at clojure.lang.Var.invoke(Var.java:419) at clojuresque.Driver.main(Driver.java:39) Caused by: java.lang.ClassNotFoundException: org.osgi.framework.ServiceRegistration |
| Comments |
| Comment by Gabriel Horner [ 17/May/13 3:56 PM ] |
|
While it's reasonable to want this for your case, having long path names in a stacktrace could be inconvenient for others. I'd recommend posting your desired change on the dev list - https://groups.google.com/forum/?fromgroups#!forum/clojure-dev . If they're ok with it, then I'd recommend submitting a patch. |
[CLJ-1130] Invoking a static method with the wrong number of arguments results in a NoSuchFieldException, rather than a proper message that the arguments could not be matched to the method Created: 17/Dec/12 Updated: 06/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Howard Lewis Ship | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | feedback | ||
| Description |
|
My code inadventently invoked a method that expected a single parameter, but passed no parameters. The exception: Exception in thread "main" java.lang.NoSuchFieldException: getService, compiling:(com/annadaletech/nexus/services/registry.clj:168) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6462) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6443) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.access$100(Compiler.java:37) at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:5883) .... Caused by: java.lang.NoSuchFieldException: getService at java.lang.Class.getField(Class.java:1520) at clojure.lang.Compiler$StaticFieldExpr.<init>(Compiler.java:1180) at clojure.lang.Compiler$HostExpr$Parser.parse(Compiler.java:923) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6455) ... 78 more That threw me for a bit; really, it looks like the compiler is attempting to access a field and invoke it as an IFn. However, a proper message would be "getService() requires 1 parameter, not 0" (or something to that effect). Even "invalid number of parameters for SmashRuntime/getService()" would be better. |
| Comments |
| Comment by Michael Drogalis [ 06/Jan/13 6:44 PM ] |
|
It looks like it's first trying to resolve a field by name, since field access with / is legal. For example: user=> (Integer/parseInt) user=> (Integer/MAX_VALUE) Would trying to resolve a method before a field fix this? |
[CLJ-1124] for-as Created: 10/Dec/12 Updated: 10/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Yongqian Li | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
A common pattern in programming is building up some data structure step by step: In Python: [code] In an imperative for loop this is easy since we have easy access to the "current" data structure being built up. I propose the addition of a function for-as similar to as-> except the value of the last loop iteration is bound to the name. So we can write the above as: [code] An (un-optimized) implementation might be something like: [code] Note: reduce-for does not return a seq, instead it returns the result of the last loop body iteration. |
| Comments |
| Comment by Yongqian Li [ 10/Dec/12 11:31 PM ] |
|
(Fixed formatting) x = {0: 1}
for item in stuff:
x[item] = item * x.get(item - 1, 0)
(last (for-as [x {0 1}]
[item stuff]
(assoc x item (* item (get x (- item 1) 0)))))
(defmacro reduce-for [[res init] for-seq-exprs body-expr] `(reduce #(%2 %1) ~init (for ~for-seq-exprs (fn [~res] ~body-expr)))) (Someone please fix the formatting in above and delete this comment.) |
[CLJ-1119] inconsistent behavior of lazy-seq w/ macro & closure on excptions Created: 03/Dec/12 Updated: 16/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Hank | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
lazy-seq seems to evaluate inconsistently when body includes a macro and throws and exception. 1st evalutation throws the exceptions, subsequent ones return empty sequence. demo code: (defn gen-lazy [] (def lazy (gen-lazy)) (try (try It should throw an exception both times but only does on 1st. Generally speaking an expression shouldn't evaluate to different things depending on whether it's been evaluated before. When removing the closure ... (defn gen-lazy [] ... or removing the when-let macro ... (defn gen-lazy [] It works i.e. consistently throws the exception, so seems to be some interaction between the closure and the macro at work here. This particular combination is used in the 'map' function. See also: https://groups.google.com/forum/?fromgroups=#!topic/clojure/Z3EiBUQ7Inc |
| Comments |
| Comment by Hank [ 03/Dec/12 4:26 AM ] |
|
N.B. The primary use case I have for this, in case it matters, is interrupting the evaluation of a 'map' expression in which the mapped fn is slow to evaluate (throwing an InterruptedException), because I am not interested in its result any more. Then later I re-evaluate it because I am interested in the result after all, however with above bug the lazy sequence terminates instead of recommencing where it left off. (UPDATE: This use case is similar to the kind of ersatz continuations that Jetty does (RetryRequest runtime exception) or even Clojure itself when barging STM transactions with the RetryEx exception.) |
| Comment by Hank [ 03/Dec/12 8:45 AM ] |
|
Related to CLJ-457 according to Christophe. His patch fixes this,too. |
| Comment by Hank [ 04/Dec/12 5:02 AM ] |
|
Sorry Christophe's patch doesn't work for me here. It avoids evaluating the LazySeq a second time by prematurely throwing an exception. However a LazySeq might evaluate properly the second time around b/c the situation causing the exception was transient. As per comment above an evaluation might get interrupted, throwing InterruptedException the first time around but not the second time. Also the observation with the closure and macro need explanation IMHO. |
| Comment by Hank [ 08/Dec/12 3:51 AM ] |
|
further insight: 'delay' exhibits the same behavior and is a more simple case to examine. the macro suspicion is a red herring: as demoed below it is actually the closed over variable magically turns to nil, the when-let macro simply turned that into a nil for the whole expression. (def delayed (let [a true] (delay (print "a=" a) (throw (Exception.))))) (try (print "delayed 1:") (force delayed) (catch Exception ex (println ex))) (try (print "delayed 2:") (force delayed) (catch Exception ex (println ex))) prints: delayed 1:a= true#<Exception java.lang.Exception> |
| Comment by Hank [ 09/Dec/12 1:31 AM ] |
|
The above leads to dodgy outcomes such as: The following expression leads to an Exception on 1st evaluation and to "w00t!" on subsequent ones. (def delayed (let [a true] (delay (if a (throw (Exception.)) "w00t!")))) Try it like this: (try (print "delayed 1:" ) (println (force delayed)) (catch Exception ex (println ex))) (try (print "delayed 2:") (println (force delayed)) (catch Exception ex (println ex))) Results in: This code shows that the problem is tied to the :once flag as suspected. (def test-once (let [a true] (^{:once true} fn* foo [] (println "a=" a) (throw (Exception.))))) Invoking the fn twice will show 'a' turning from 'true' to 'nil', try it like this: (try (print "test-once 1:") (test-once) (catch Exception ex (println ex))) (try (print "test-once 2:") (test-once) (catch Exception ex (println ex))) Results in: That doesn't happen when the ^{:once true} is removed. Now one could argue that above fn is invoked twice, which is exactly what one is not supposed to do when decorated with the :once flag, but I argue that an unsuccessful call doesn't count as invocation towards the :once flag. The delay and lazy-seq macros agree with me there as the resulting objects are not considered realized (as per realized? function) if the evaluation of the body throws an exception, and realization/evaluation of the body is therefore repeated on re-evaluation of the delay/lazy-seq. Try this using (realized? delayed) The :once flag affects this part of the compiler only. Some field is set to nil there in the course of a function invocation, for the good reason of letting the garbage compiler collect objects, however this should to be done after the function successfully completes only. Can this be changed? |
| Comment by Hank [ 16/Dec/12 4:02 AM ] |
|
A workaround for the case of the 'map' function as described in the 1st comment, works as this: The original map function, if you take out the cases for several colls, the performance enhancements for chunked seqs and forcing the coll argument to a seq, looks like this: (defn map [f s]
(lazy-seq
(cons (f (first s)) (map f (rest s)))))
In my workaround I evaluate f twice: (defn map [f s]
(lazy-seq
(f (first s))
(cons (f (first s)) (map f (rest s)))))
Because the downstream functions that are slow to evaluate are all of the deref kind that cache their result (more lazy-seqs, delays, futures, promises), the InterruptedException can only happen during the 1st evaluation, while the tail call optimization that sets closed-over variables to nil (it pays to read this here: http://clojure.org/lazy) only happens on the second call. The first still creates an fn that captures the head of the sequence 's', however this is not being held onto as it is not returned. I use this special version of map (and other, similarly rewritten functions based on lazy-seq such as iterate) when I want interruptible, restartable seq evaluations. |
[CLJ-1105] defrecord classes implement IPersistentCollection but not .empty, clojure.walk assumes collections support empty Created: 08/Nov/12 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Jouni K. Seppänen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
Using clojure.walk functions fails surprisingly for data containing records defined with defrecord: user=> (defrecord Foo [x]) This seems to be because clojure.walk/walk guards a call to (empty form) with a (coll? form) check. The check succeeds because records implement IPersistentCollection, but (empty form) throws an exception. This looks to me like a bug in clojure.walk (it should check records separately and either treat them as atomic or implement a way of walking through them) but perhaps it is a sign of some unclarity in the contract of collections. |
| Comments |
| Comment by Nicola Mometto [ 08/Nov/12 2:35 PM ] |
|
maybe clojure should follow clojurescript's footsteps and move empty out of IPersistentCollection and create an |
| Comment by Stuart Halloway [ 25/Nov/12 6:39 PM ] |
|
Can whoever claims this please consider walk's behavior in the face of all different collection types? I think it also fails with Java collections. Also, the collection partitioning code in clojure.data may be of use. |
[CLJ-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-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-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-1057] Var's .setDynamic does not set :dynamic in metadata Created: 02/Sep/12 Updated: 03/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
((juxt (comp :dynamic meta) #(.isDynamic %)) #'*agent*) |
| Comments |
| Comment by Timothy Baldridge [ 03/Dec/12 9:10 AM ] |
|
This is actually an enhancement as no where in the clojure code is provision made for syncing var's metadata and dynamic state. .isDynamic is the authoritative source, and the calling of .setDynamic is configured by the compiler. If you'd like to see this change, please, feel free to bring it up on clojure-dev for a discussion. |
[CLJ-1056] defprotocol: invalid method overload syntax getting accepted Created: 01/Sep/12 Updated: 29/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Víctor M. Valenzuela | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
The compiler accepts both of these erroneous forms which while silly, are not imposible to come up with. (defprotocol Foo (f ([this]) ([this arg]))) |
| Comments |
| Comment by Timothy Baldridge [ 29/Nov/12 4:02 PM ] |
|
Can not reproduce the fist error: user=> (defprotocol Foo (f ([this]) ([this arg]))) But the 2nd one I can reproduce: user=> (defprotocol Bar (m [this]) (m [this arg])) Notice that :arglists only has one entry Vetting |
[CLJ-1053] Locals still cleared too aggressively on delay in specific cases Created: 30/Aug/12 Updated: 09/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Jean Niklas L'orange | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
This seems to be an extension of #CLJ-232. Locals are still cleared too aggressively in some specific instances: If the delay throws an exception when realized, and you dereference a local within the delay, the local may or may not be cleared depending on its need in the tail positions (without any obvious pattern). Examples of functions which works as intended and doesn't work as intended follows. (def d (let [y (delay 0)]
(delay (if (zero? @y) (/ 0 0) (/ @y 1))))) ; works properly
(def d (let [y (delay 0)]
(delay (if (zero? @y) (/ 0 0) (/ 1 1))))) ; does not work properly
(def d (let [y (delay 0)]
(delay (if (zero? @y) (/ @y 0) (/ 1 1))))) ; does not work properly
(def d (let [y (delay 0)]
(delay (if (zero? @y) (/ @y 0) (/ @y 1))))) ; does not work properly
(def d (let [y (delay 0)]
(delay @y (/ 0 0)))) ; does not work properly
(def d (let [y (delay 0)]
(delay @y (/ 0 0) @y))) ; works properly
By "works", d will throw "ArithmeticException Divide by zero" every single time it is dereferenced. By "does not work", d will throw "ArithmeticException Divide by zero" on first dereferencing, but from second and onwards it will throw "NullPointerException [trace missing]". |
| Comments |
| Comment by Jean Niklas L'orange [ 09/Apr/13 11:55 AM ] |
|
With Clojure 1.5.1, the trace is given and returns NullPointerException clojure.core/deref-future (core.clj:2NullPointerException clojure.core/deref-future (core.clj:2108)108), which refers to a .get call. The stacktrace reveals the following: NullPointerException clojure.core/deref-future (core.clj:2108) clojure.core/deref (core.clj:2129) user/fn--1/fn--4 (NO_SOURCE_FILE:2) clojure.lang.Delay.deref (Delay.java:33) clojure.core/deref (core.clj:2128) user/eval13 (NO_SOURCE_FILE:-1) clojure.lang.Compiler.eval (Compiler.java:6619) clojure.lang.Compiler.eval (Compiler.java:6582) clojure.core/eval (core.clj:2852) clojure.main/repl/read-eval-print--6588/fn--6591 (main.clj:259) clojure.main/repl/read-eval-print--6588 (main.clj:259) clojure.main/repl/fn--6597 (main.clj:277) |
[CLJ-1043] Unordered literals does not preserve left-to-right evaluation of arguments Created: 16/Aug/12 Updated: 23/Sep/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Given: (defn f [x] (println x) x) #{(f 2) (f 1)} Prints: 1 But expected would be: 2 This issue is related to CLJS-288 |
| Comments |
| Comment by Andy Fingerhut [ 23/Sep/12 6:01 PM ] |
|
I have the same question as David Nolen for CLJS-288: Is this a bug, or just behavior you didn't expect? It seems that vectors preserve the order of evaluation, so if you really want to control evaluation order you could use something like (set [(f 2) (f 1)]) or (set (map f [2 1])). |
| Comment by Brandon Bloom [ 23/Sep/12 7:38 PM ] |
|
I'd consider the expected default behavior of any syntax or macro to evaluate each sub-form once each, from left to right. Conditional, repeated, or out-of-order evaluation should be documented as deviations from that norm. If you buy that, then this is either a code or a documentation bug. My vote is for code bug. |
[CLJ-1039] Using 'def with metadata {:type :anything} throws ClassCastException Created: 09/Aug/12 Updated: 10/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Gunnar Völkel | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu, lein 1.7.1 - lein repl |
||
| Approval: | Vetted |
| Description |
|
In lein 1.7.1 (and CCW) the form (def ^{:type :anything} mydef 1) throws "ClassCastException clojure.lang.Var cannot be cast to clojure.lang.IObj clojure.core/with-meta (core.clj:211)". If it is intended to forbid setting the :type metadata, then there should be an appropriate error message instead of the ClassCastException In lein2 repl which is using "REPL-y 0.1.0-beta8" the exception does not occur. Full stacktrace: |
| Comments |
| Comment by Stuart Halloway [ 10/Aug/12 1:40 PM ] |
|
This is caused by the printer dispatch function (defmulti print-method (fn [x writer]
(let [t (get (meta x) :type)]
(if (keyword? t) t (class x)))))
which ends up calling the default dispatch, which tries to vary-meta. |
[CLJ-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-1033] pr-str and read-string don't handle @ symbols inside keywords properly Created: 26/Jul/12 Updated: 13/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Steven Ruppert | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | reader | ||
| Environment: |
Ubuntu 12.04 LTS; Java 1.7.0_05 Java HotSpot(TM) Client VM |
||
| Approval: | Vetted |
| Description |
user=> (read-string (pr-str {(keyword "key@other") :stuff}))
RuntimeException Map literal must contain an even number of forms clojure.lang.Util.runtimeException (Util.java:170)
pr-str emits "{:key@other :stuff}", which read-string fails to interpret correctly. Either pr-str needs to escape the @ symbol, or read-string needs to handle the symbol inside a keyword. Background: I'm passing a map with email addresses as keys through Storm bolts, which require a thrift-serializable form. Using the pr-str/read-string combo fails on these keys, so I've fallen back to JSON serialization. |
| Comments |
| Comment by Stuart Halloway [ 10/Aug/12 12:51 PM ] |
|
The '@' character is not a legal character for keywords or symbols (see http://clojure.org/reader). Recategorized as enhancement request. |
| Comment by Steven Ruppert [ 10/Aug/12 1:04 PM ] |
|
Then why doesn't (keyword "keywith@") throw an exception? It seems inconsistent with your statement. |
| Comment by Andy Fingerhut [ 13/Sep/12 2:23 PM ] |
|
It is a long standing property of Clojure that it does not throw exceptions for everything that is illegal. |
| Comment by Steven Ruppert [ 17/Sep/12 2:16 PM ] |
|
Yeah, but read-string clearly does. Is there a good reason that the "keyword" function can't throw an exception? With the other special rules on namespaces within symbol names, the "keyword" function really should be doing validation. Another solution would be to allow a ruby-like :"symbol with disallowed characters" literal, but that would also be confusing with how the namespace is handled. https://groups.google.com/forum/?fromgroups=#!topic/clojure/Ct5v9w0yNAE has some older discussion on this topic. |
| Comment by Andy Fingerhut [ 17/Sep/12 7:43 PM ] |
|
Disclaimer: I'm not a Clojure/core member, just an interested contributor who doesn't know all the design decisions that were made here. Steven, I think perhaps a couple of concerns are: (1) doing such checks would be slower than not doing them, and (2) implementing such checks means having to update them if/when the rules for legal symbols, keywords, namespace names, etc. change. Would you be interested in writing strict versions of functions like symbol and keyword for addition to a contrib library? And test suites that try to hit a significant number of corner cases in the rules for what is legal and what is not? I mean those as serious questions, not rhetorical ones. This would permit people that want to use the strict versions of these functions to do so, and at the same time make it easy to measure performance differences between the strict and loose versions. |
| Comment by Steven Ruppert [ 13/Jan/13 10:58 PM ] |
|
Looking back at this, the root cause of the problem is that the {pr} function, although it by default "print[s] in a way that objects can be read by the reader" [0], doesn't always do so. Thus, the easiest "fix" is to change its docstring to warn that not all keywords can be read back. The deeper problem is that symbol don't have a reader form that can represent all actually possible keywords (in this case, those with "@" in them). Restricting the actually-possible keywords to match the reader form, i.e. writing a strict "keyword" function actually seems like a worse solution overall to me. The better solution would be to somehow extend the keyword reader form to allow it to express all possible keywords, possibly ruby's :"keyword" syntax. Plus, that solution would avoid having to keep hypothetical strict keyword/symbol functions in sync with reader operation, and write test cases for that, and so on. Thus, the resolution of this bug comes down to how far we're willing to go. Changing the docstring would be the easiest, but extending the keyword form would be the "best" resolution, IMO. |
[CLJ-1027] Outdated documentation for gen-class's :exposes-methods option Created: 18/Jul/12 Updated: 18/Jul/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Dan Lidral-Porter | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | docs, documentation | ||
| Description |
|
The docstring for gen-class says the following regarding the :exposes-methods option: "It is sometimes necessary to call the superclass' implementation of an To me, this suggests that supplying something like `{foo fooSuper}` allows me to use the symbol `fooSuper` in my new method implementation. Doing this actually results in an error while compiling because `fooSuper` cannot be resolved. It seems that what actually happens is that a `fooSuper` instance method is defined, which calls the superclass's implementation. The docstring should be updated to reflect this. |
[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-1017] Metadata expressions are evaluated after the expression they affect Created: 23/Jun/12 Updated: 23/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Repro: user=> (def x (atom 1)) Presumably this is because ^:foo x expands to (with-meta x {:foo true}) but probably should have reversed argument order or use a let expression. |
[CLJ-1016] Global scope overrides lexical scope for classes (Clojure assumes no classes in default package / Clojure cannot handle yFiles JARs in classpath) Created: 21/Jun/12 Updated: 27/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Edward Z. Yang | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
The most visible symptom of this bug is having a class named 'w' (default package) in your classpath (such classes are produced by Java obfuscation tools such as yFiles) and then attempting to load Clojure's core class. For example: java -cp hotspotapi.jar:clojure-1.4.0-slim.jar clojure.main (where hotspotapi.jar is a stereotypical example of an obfuscated JAR) results in: Exception in thread "main" java.lang.ExceptionInInitializerError To understand what is going on, consider this simple test: import java.io.StringReader; import clojure.lang.Compiler; public class Test { It should be clear that 'mumble' in the dot operator is referencing the locally defined mumble. However, if we define a class named 'mumble' in the default package, Clojure picks that one up instead. To forestall any objections: yes, we know that placing classes in the default package is extremely poor form. Point of the matter is, the Java ecosystem is extremely diverse and there are a lot of JARs people may not have control over. While one might argue, "Don't put classes in the default namespace", point of the matter is, Clojure is wrong here, and these situations arise in practice, through no fault of the implementer. |
| Comments |
| Comment by Edward Z. Yang [ 21/Jun/12 11:01 AM ] |
|
Here is a workaround patch which makes this error less likely to occur. |
| Comment by Andy Fingerhut [ 27/Aug/12 7:37 PM ] |
|
Edward, it is Rich Hickey's policy only to consider for inclusion in Clojure patches written by people who have signed a Contributor Agreement: http://clojure.org/contributing Were you interested in becoming a contributor? |
| Comment by Edward Z. Yang [ 27/Aug/12 9:24 PM ] |
|
Sure, although the patch attached is emphatically not the one you want to actually applying, since it only band-aids the problem. |
[CLJ-1015] Standalone Clojure library for Java users Created: 14/Jun/12 Updated: 14/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Edward Z. Yang | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Many of Clojure's data structures (e.g. PersistentHashMap) may be of interest to the wider Java community, and would benefit from being packaged in a way that makes them easy to include in projects. While they are public (and thus can be accessed by way of clojure.lang), Clojure's classloader is implemented in a way such that Clojure files such as core.clj end up being loaded, even when an end-user is not interested in the Clojure environment itself. The Java classes could also use some documentation! I'd be happy to work on a patch but this change may require some restructuring of the build process, so it'd be good to get community sign-off first. |
| Comments |
| Comment by Andy Fingerhut [ 14/Jun/12 5:39 PM ] |
|
I am assuming this ticket is a request that the original Clojure distribution be modified to easily build such a library of data structures, and be maintained as a separate build target, going forward. Reference to related info: Below is a copy of most of a message from someone with userid Krukow posted to the Clojure Google group on June 3, 2012: https://groups.google.com/forum/?fromgroups#!topic/clojure/UyjmafY_ZE8 I created a project containing only the persistent data structures for use with Java et al. https://github.com/krukow/clj-ds It is the data structures only so no bootstrap penalty. There are also Java'ish "improvements" like basic Generics and improved performance on the iterator pattern. It's still on Clojure 1.3 (As far as I recall), but I am planning on taking another iteration. TODO:
|
[CLJ-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-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-1003] :100 is a valid Clojure keyword. Is that intentional? Created: 27/May/12 Updated: 13/Sep/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Brian Taylor | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In the latest clojure (eccde24c7), These parse as keywords: :100 This is an error: :a/100 Is this behavior intentional? In LispReader.java, the pattern for a symbol (and keyword) is "[:]?([\\D&&[^/]].*/)?([ http://clojure.org/reader says that none of my examples should parse. Clojurescript does not accept any of my examples, see |
| Comments |
| Comment by Andy Fingerhut [ 13/Sep/12 6:34 PM ] |
|
The reason that :100 parses as a keyword is that [ Whether this is intentional or not, my guess is probably not. Given that the docs at http://clojure.org/reader also say "A symbol can contain one or more non-repeating ':'s", writing a regexp that matches only what is documented there looks fairly complex. Clojure has a history of allowing things, without throwing exceptions or giving any other errors, even if they are documented as not legal. This may be one of those cases. Do not consider this last paragraph as any kind of authoritative answer. It is only my observation. |
[CLJ-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-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-997] max-key and min-key to return the first entry in case of several candidates Created: 18/May/12 Updated: 18/May/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Oleksandr Shyshko | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Consider the following code: (def values [[1 2] [3 4] [5] [6 7] [8]]) Which returns the last max entry [6 7]. Why its not the first max entry [1 2]? Consider the following example in Scala: println(List(List(0, 1, 2), List(2, 3, 4), List(1), List(1, 2, 3)).maxBy(_.length)) The very same function in Scala returns the first max entry (by default). The code from relase 1.4 file "clojure/core.clj#4419-4426" looks is: I am unsure what is the motivation in returning the last candidate, but I suggest two following things: 1. Make "max-key" and "min-key" return the first max/min entry if there are several candidates. This behavior seems more natural/convenient (to me), because in most cases you want to get first "winner". Line #4424 should have ">=" instead of ">". 2. Make "max-key" and "min-key" make warranty on order, which max/min entry will be returned (either first or last). Line #4420 should say "Returns the x for which (k x), a number, is greatest. In case of several matches, the first max entry will be returned" or the same doc, but saying "the last max entry will returned". |
| Comments |
| Comment by Steve Miner [ 18/May/12 4:03 PM ] |
|
The current behavior matches the documentation so I wouldn't consider it a "defect". There doesn't seem to be a compelling reason to impose a tie-breaker rule on the implementation. |
[CLJ-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-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-983] proxy-super does not restore original binding if call throws exception Created: 05/May/12 Updated: 05/May/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.1, Release 1.2, Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Valentin Mahrwald | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug | ||
| Attachments: |
|
| Description |
|
The code for proxy-call-with-super internally used by proxy-super does not handle exceptions from the call method: (defn proxy-call-with-super [call this meth] As a result the following sequence behaves unexpectedly: A try-finally block around the invocation would solve this particular issue. |
| Comments |
| Comment by Valentin Mahrwald [ 05/May/12 9:04 AM ] |
|
Test & fix patch on latest Clojure github branch. |
[CLJ-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-971] Jar within a jar throws a runtime error Created: 10/Apr/12 Updated: 10/Apr/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2, Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Ron Romero | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug | ||
| Environment: |
Maven using the one-jar plugin |
||
| Description |
|
I've created two jar files in my multi-project Maven setup. The first jar is the "engine", and it includes the clojure jar in it. The other jar is the "application". It includes the engine and then packages itself into a one-jar jar file. This means we have a jar within a jar: The "onejar" contains the engine jar, which in turn contains that clojure jar. I then get an error in the runtime: Exception in thread "main" java.lang.reflect.InvocationTargetException See also my Stack Overflow question on this at http://stackoverflow.com/questions/7763480/making-an-executable-jar-that-evals-clojure-strings In researching it, I've found the problem lies in RT.lastModified, where it tries to determine last modified time by looking at the modified time on the jar file for Clojure. But there's not actually a jar file, since it's embedded in another. I've found that adding a null check solves the problem. My lastModified looks like this now: static public long lastModified(URL url, String libfile) throws Exception{ return url.openConnection().getLastModified(); This runs successfully. If you'd prefer, I can submit a patch, or commit directly. |
[CLJ-969] Symbol/keyword implements IFn for lookup but a non-collection argument produces non-intuitive results Created: 09/Apr/12 Updated: 09/Apr/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Sean Corfield | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
('+ 1 2) ;; return 2 because it is treated as (get 1 '+ 2) Whilst this is "consistent" once you know the lookup behavior, it's confusing for Clojure newbies and it seems to be a non-useful behavior. Proposal: modify Keyword.invoke() and Symbol.invoke() to restrict first Object argument to instanceof ILookup, Map or IPersistentSet (or null) so that the "not found" behavior doesn't produce non-intuitive behavior. |
[CLJ-968] ns emitting gen-class before imports results in imported annotations being discarded. Created: 09/Apr/12 Updated: 09/Apr/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Charles Duffy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The following discards the imported annotations: (ns com.example.BaseXModuleTest (:import (org.basex.query QueryModule QueryModule$Deterministic)) (:gen-class :extends org.basex.query.QueryModule :methods [ [^{QueryModule$Deterministic {}} addOne [int] int]])) However, when moving the gen-class call out of the ns declaration, the annotation is correctly applied: (ns com.example.BaseXModuleTest (:import (org.basex.query QueryModule QueryModule$Deterministic))) (gen-class :extends org.basex.query.QueryModule :name com.example.BaseXModuleTest :methods [ [^{QueryModule$Deterministic {}} addOne [int] int]]) It appears that imported names are not yet in-scope when gen-class is run from a ns declaration. |
[CLJ-959] after call to clojure.java.shell/sh, jvm won't exit Created: 26/Mar/12 Updated: 08/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Jeff Chiu | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | shell | ||
| Environment: |
Reproduced on Ubuntu using Sun Java 1.6, OpenJDK 1.6, and Sun Java 1.7 |
||
| Description |
|
Create the following four-line file, shell_example.clj: ;; simple example of call to sh that causes jvm to hang after print Run: After the message is printed, the jvm doesn't quit. It just sits there. I have to hit Ctrl-C to force the jvm to quit. This happens on 1.3 and the most recent code in github as of 3/26/2012. I imagine the jvm is waiting for a thread that hasn't terminated, but the code in the sh function doesn't look like it's doing anything obviously wrong. I'm too much of a newcomer to Clojure to dig any deeper. My workaround right now is to do (System/exit 0) to force the jvm to quit. Thank you for your work on Clojure, it's simply an amazing language. |
| Comments |
| Comment by Andy Fingerhut [ 27/Mar/12 12:19 AM ] |
|
Jeff, this occurs in any Clojure program where certain threading mechanisms are invoked. In your case, clojure.java.shell/sh uses future, which causes threads to be created that then sit around for about 60 seconds after everything else quits, and the main Java process does not exit until that happens. Another way to get the program to exit quickly is to call (shutdown-agents), but that isn't any more convenient than (System/exit 0), nor is there any obvious way you can tell as a newcomer that you should be doing this. The ticket CLJ-124 is marked with status "Approved" at this time, which leads me to believe that perhaps soon there will be a change made to Clojure such that this situation will change. |
| Comment by Andy Fingerhut [ 08/Jun/12 12:47 PM ] |
|
This behavior is now documented on clojuredocs.org for future, and both pmap and clojure.java.shell/sh refer to future for details. |
[CLJ-955] java object reader constructor doesn't work Created: 18/Mar/12 Updated: 19/Mar/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Brent Millare | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Here is a transcript: ;user=> clojure-version Another transcript from google groups https://groups.google.com/forum/?fromgroups&hl=en#!topic/clojure/vlsFgVaKcSQ user=> (def x #java.net.URL["file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"]) user=> (.getProtocol #java.net.URL["file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"]) user=> (.getProtocol #java.net.URL["file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"]) user=> (def x #java.net.URL["file:///home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"]) user=> (defmethod print-dup java.net.URL [o, ^java.io.Writer w] (.write w (str o))) |
| Comments |
| Comment by Andy Fingerhut [ 19/Mar/12 2:58 AM ] |
|
I've confirmed this behavior with 1.4.0 beta5. I've only tracked it down as far as finding the "Can't embed object in code" message, which is easy to find in Compiler.java in method emitValue. That exception is thrown because printString in RT.java throws an exception. It isn't clear to me what should be done instead, though. |
| Comment by Fogus [ 19/Mar/12 9:03 AM ] |
|
What would it mean to construct an arbitrary Java object for the purpose of embedding it in code in a generic way? You could say that it's just a matter of calling its constructor with the right args but very often in Java that is not enough to make an object considered "initialize". Sometimes there are init methods or putters or whatever that are required for object construction. So right there I hope it's clear that even though #some.Klass["foo"] provides a way to call an arbitrary constructor, it's in no way a guarantee that an instance is properly constructed. The reason that (for example) defrecords are embeddable anywhere is because we know for certain that the constructor creates a fully initialized instance. If you need to embed specific instances in your own code then you have two options:
Quick point of note: Your code (defmethod print-dup java.net.URL [o, ^java.io.Writer w] (.write w (str o))) Doesn't do what you think it does. It spits out exactly file:///home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs that Clojure reads in as a symbol. Something like the following might be more appropriate: (defmethod print-dup java.net.URL [o, ^java.io.Writer w] (.write w "#java.net.URL") (.write w (str [ (str o) ]))) (let [x #java.net.URL["file:///home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"]] (printf "(class x)=%s x='%s'\n" (class x) x) x) ; (class x)=class java.net.URL x='file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs' ;=> #<URL file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs> (.getProtocol *1) ;=> "file" |
| Comment by Brent Millare [ 19/Mar/12 10:09 AM ] |
|
Fogus, can you please elaborate on using clojure 1.4's tagged literal features. While I understand that you can define data-reader functions, for example (binding [*data-readers* {'user/f (fn [x] (java.io.File. (first x)))}] (read-string "#user/f [\"hello\"]")) ;=> #<File hello>
however, I feel this is only half a fix, compared with the first mentioned solution (involving print-dup), since clojure's tagged literals only are important for reading, not for printing. Does using tagged literals, so that (read-string (pr-str (read-string ...) works, imply that you must also define print methods per class? If this is true, it seems problematic since if different code wants to define different print methods, this will conflict since defining print-dup methods is global. Is there a good solution for printing objects depending on the context? As an alternative solution, I propose making the default print-method of all objects that didn't already have a printed representation to be a tagged literal, this way, users can customize what it means to read it. (See https://groups.google.com/forum/?fromgroups&hl=en#!topic/clojure/GdT5cO6JoSQ ) |
| Comment by Fogus [ 19/Mar/12 10:18 AM ] |
|
"Fogus, can you please elaborate on using clojure 1.4's tagged literal features." I can, but it falls outside of the scope of this particular ticket. It might be better to take the broader conversation to the design page at http://dev.clojure.org/display/design/Tagged+Literals and the clojure-dev list. Has the original motivation for this ticket been addressed? |
| Comment by Brent Millare [ 19/Mar/12 10:26 AM ] |
|
I think you've explained the underlying problem, so yes. One possible caveat might be that it may be a concern that the current error message is not telling that the underlying problem lies in an improperly initialized object. (or maybe it is, and that's the error message I should expect). |
[CLJ-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-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-938] Output of clojure.reflect is not suitable for type hints Created: 23/Feb/12 Updated: 24/Feb/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I'm trying to write a macro which generate reify forms using some reflection. clojure.reflect produces type symbols similar to 'java.util.Iterator<> Unfortunately, the compiler doesn't accept the <> syntax in type hints: (reify Iterable (^{:tag java.util.Iterator} iterator [this] nil)) ; works (reify Iterable (^{:tag java.util.Iterator<>} iterator [this] nil)) ;; fails It seems like the compiler should understand the <> just enough to strip it, rather than reject it. This would make it much easier to write correct macros involving type hinting and reflection. The workaround I have been using is: (defn hint |
| Comments |
| Comment by Brandon Bloom [ 24/Feb/12 1:37 AM ] |
|
I'm sorry, I got this wrong earlier. The problem is real, but it's arrays, not generics. My workaround is useless... :-/ |
[CLJ-929] Accessing Java property starting with _ has issues in 1.4 Created: 07/Feb/12 Updated: 09/Feb/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When attempting to use interop syntax with symbols which aren't legal Java names (such as deleted?), the names are mangled a bit. That's necessary, of course, and the method of munging can be internal to the compiler. However, the behavior when munging changed a little between 1.3 and 1.4 beta1. Obviously the specifics of munging are something I should avoid relying on, but the way it changed looks like an accident or a bug even so. The use-case I ran into is that defrecords contain a field named __meta for tracking their metadata. In both 1.3 and 1.4 you can get at that field with (. record __meta), which avoids munging. But on 1.3 (. record --meta) also accesses it (translating each - to a _), while on 1.4 (. record -meta) works and (. record --meta) doesn't. Actually, looking at line 883 of Compiler.java, it looks like this may be related to the (. foo -property) syntax ported from CLJS, and indeed (. record ---meta) works, I guess by reducing to an "old style" (. record --meta). So that clears up why --meta fails: it's looking for __meta. I'm still not clear on why (. record -meta) works, though. So it looks like the - prefix for properties is not 100% backwards-compatible like it seemed to be. Is this an issue we need to fix, or is the recommendation simply to never have fields that start with - or _? |
| Comments |
| Comment by Fogus [ 09/Feb/12 2:33 PM ] |
|
Is this a general problem with fields starting with _ or just fields named __meta as in (defrecord [__meta] ...) |
| Comment by Alan Malloy [ 09/Feb/12 3:01 PM ] |
|
It's a general issue. (defrecord [__meta]) actually breaks immediately, because the record mechanism itself generates a field named __meta, but any field named with a - or _ prefix has this issue. user=> (defrecord Foo [-blah]) |
[CLJ-919] cannot create anonymous primitive functions Created: 27/Jan/12 Updated: 27/Jan/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Ben Mabey | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Primitive functions only work (e.g. return primitive types) when defined with `defn`. An equivalent function created with `fn` does not behave the same way as when created with `defn`. For example: (definterface IPrimitiveTester (deftype PrimitiveTester [] (defmacro pt [x] (defn with-defn ^double [^double x] (pt (with-defn 1.0)) ; => :double (let [a (fn ^double [^double x] (+ x 0.5))] Please see the discussion on the mailing list for more details and thoughts on what is happening: |
[CLJ-911] 'proxy' prevents overriding Object.finalize (and doesn't document it) Created: 16/Jan/12 Updated: 16/Jan/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Norman Gray | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
OS X, Java 1.6.0? |
||
| Description |
|
It appears to be impossible to override Object.finalize() using proxy. If the method is defined using proxy, then it cannot be called straightforwardly (see below), and it is not called as a finalizer during normal program execution (not demonstrated below). See extensive discussion at: https://groups.google.com/group/clojure/browse_thread/thread/a1e2fca45af6c1af
There is at least one of two bugs here (thanks to Cedric Greevey for summarising this way):
|
[CLJ-903] extend-protocol does not allow classnames as a String Created: 30/Dec/11 Updated: 30/Dec/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2, Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Meikel Brandmeyer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In various places Clojure accepts classnames as String, eg. in gen-class or type hints. However it does not in extend-protocol. This does not allow simple specification of array types. See also here: http://groups.google.com/group/clojure/browse_thread/thread/722a0c09d02bb0ac |
[CLJ-899] Accept and ignore colon between key and value in map literals Created: 18/Dec/11 Updated: 19/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Stuart Halloway | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 4 |
| Labels: | None | ||
| Description |
|
Original title was 'treat colons as whitespace' which isn't a problem description but a (flawed) implementation approach For JSON compatibility |
| Comments |
| Comment by Tassilo Horn [ 23/Dec/11 3:22 AM ] |
|
Discussed here: https://groups.google.com/d/msg/clojure/XvJUzaY1jec/l8xEwlFl8EUJ |
| Comment by Kevin Downey [ 11/Jan/12 2:23 PM ] |
|
please no |
| Comment by Tavis Rudd [ 16/Jan/12 12:17 PM ] |
|
Alan Malloy raises a good point in the google group discussion (https://groups.google.com/d/msg/clojure/XvJUzaY1jec/aVpWBicwGhsJ) about accidental confusion between trailing (or floating) and leading colons: This issue could be avoided by only treating a colon as whitespace when followed by a comma. As easy cut-paste of json seems the be the key motivation here, the commas are going to be there anyway: valid {"v":, 1234} vs syntax error {a-key: should-be-a-keyword}. |
| Comment by Alex Baranosky [ 16/Jan/12 5:23 PM ] |
|
This would be visually confusing imo. |
| Comment by Laurent Petit [ 17/Jan/12 5:01 PM ] |
|
Please, oh please, no. |
| Comment by Tavis Rudd [ 18/Jan/12 2:40 PM ] |
|
Er, brain fart. I was typing faster than I was thinking and put the comma in the wrong place. In my head I meant the form following the colon would have to have a comma after it. Thus, {"a-json-key": 1234, ...} would be valid while {"a-json-key": was-supposed-to-be-a-keyword "another-json-key" foo} would complain about the colon being an Invalid Token. I don't see the need for it, however. |
| Comment by Joseph Smith [ 27/Feb/12 10:55 AM ] |
|
Clojure already has reader syntax for a map. If we support JSON, do we also support ruby map literals? Seems like this addition would only add confusion, imo, given colons are used in keywords and keywords are frequently used in maps - e.g., when de-serializing from XML, or even JSON. |
| Comment by David Nolen [ 27/Feb/12 11:19 AM ] |
|
Clojure is no longer a language hosted only on the JVM. Clojure is also hosted on the CLR, and JavaScript. In particular ClojureScript can't currently easily deal with JSON literals - an extremely common (though problematic) data format. By allowing colon whitespace in map literals - Clojure data structures can effectively become an extensible JSON superset - giving the succinctness of JSON and the expressiveness of XML. +1 from me. |
| Comment by Tim McCormack [ 13/Nov/12 7:27 PM ] |
|
Clojure is only hosted on the JVM; ClojureScript is hosted on JS VMs. If this is useful for CLJS, it should just be a CLJS feature. |
| Comment by Mike Anderson [ 10/Dec/12 11:51 PM ] |
|
-1 for this whole idea: that way madness lies.... If we keep adding syntactical oddities like this then the language will become unmaintainably complex. It's the exact opposite of simple to have lots of special cases and ambiguities that you have to remember. If people want to use JSON that is fine, but then the best approach use a specific JSON parser/writer, not just paste it into Clojure source and expect it to work. |
| Comment by Laszlo Török [ 11/Dec/12 4:54 AM ] |
|
-1 for reasons mentioned by Allan Malloy and Mike Anderson |
[CLJ-889] Specifically allow '.' inside keywords Created: 01/Dec/11 Updated: 15/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Reviewed Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Howard Lewis Ship | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | keywords, reader | ||
| Description |
|
The documentation for keywords (on page http://clojure.org/reader) specifically states that '.' is not allowed as part of a keyword name; however '.' is specifically useful. For example, several web frameworks for Clojure use keywords to represent HTML elements, using CSS selector syntax (i.e., :div.important is equivalent to <div class='important'>). In any case, the use of '.' is not checked by the reader and it is generally useful. I would like to see '.' officially allowed (in the documentation). Further, I'd like to see additional details about which punctuation characters are allowed (my own web framework uses '&', '?' and '>' inside keywords for various purposes ... again, current reader implementation does not forbid this, but if a future reader will reject it, I'd like to know now). |
| Comments |
| Comment by Howard Lewis Ship [ 08/Dec/11 3:37 PM ] |
|
To clarify, Hiccup and Cascade both use keywords containing '#' and '.' Cascade goes further, using '&' (to represent HTML entities), '>', and (possibly in the future) '?'. |
| Comment by Devin Walters [ 20/Oct/12 6:46 PM ] |
|
I think the EDN spec mitigates some of the concern, but as of yet the official clojure.org reader documentation does not reflect the language used in the description of EDN. Where does EDN stand right now? Can the description being used on the github page be pulled over to clojure.org? References:
|
| Comment by Howard Lewis Ship [ 15/Apr/13 5:56 AM ] |
|
Unfortunately, the EDN specification does not mention '>'. |
[CLJ-888] defprotocol should throw error when signatures include variable number of parameters Created: 29/Nov/11 Updated: 29/Nov/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Greg Chapman | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I tried to use & in the signature for a method in defprotocol. Apparently (see below), this is compiled so that & becomes a simple parameter name, and there is no special handling for variable number of parameters. I think the use of & in a protocol signature ought to be detected and immediately cause an exception (I also think this restriction on the signatures ought to be documented; I couldn't find it specified in the current documentation, though of course it is implied (as I later realized) by the fact that defprotocol creates a Java interface). user=> (defprotocol Applier (app [this f & args])) |
[CLJ-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-880] syntax-quote should be a macro instead of implemented inside the reader Created: 17/Nov/11 Updated: 17/Nov/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Kevin Downey | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
syntax-quote is currently a somewhat gnarly bit of java code in LispReader.java, would be great to replace it with a (hopefully less gnarly) clojure macro. LispReader.java would be required to do something similar to 'x => (quote x). `x => (syntax-quote x) , ~x => (unquote x), ~@x => (unquote-splicing x) |
[CLJ-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-864] defrecord positional arity factory fn should have an inline version that calls the record constructor Created: 26/Oct/11 Updated: 26/Oct/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Kevin Downey | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
defrecord positional arity factory fn should have an inline version that calls the record constructor |
[CLJ-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-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-823] Piping seque into seque can deadlock Created: 03/Aug/11 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Greg Chapman | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Windows 7; JVM 1.6; Clojure 1.3 beta 1 |
||
| Approval: | Vetted |
| Description |
|
I'm not sure if this is a supported scenario, but the following deadlocks in Clojure 1.3: (let [xs (seque (range 150000)) As I understand it, the problem is that ys' fill takes place on an agent thread, so when it calls xs' drain, the (send-off agt fill) does not immediately trigger xs' fill, but is instead put on the nested list to be performed when ys' agent returns. Unfortunately, ys' fill will eventually block trying to take from xs, and so it never returns and the pending send-offs are never sent. Wrapping the send-off in drain to: (future (send-off agt fill)) is a simple (probably not optimal) way to fix the deadlock. |
| Comments |
| Comment by Peter Monks [ 07/Jan/13 3:43 PM ] |
|
Reproduced on 1.4.0 and 1.5.0-RC1 as well, albeit with this example: (seque 3 (seque 3 (range 10))) |
| Comment by Stuart Halloway [ 30/Mar/13 9:16 AM ] |
|
release-pending-sends? |
[CLJ-809] fn's created using defn should not lexical shadow the var that holds them Created: 11/Jun/11 Updated: 29/Jul/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Kevin Downey | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
currently (defn foo [x] (foo x)) expands to something like (def foo because of this lexical shadowing self calls to fns defined with defn the lexical shadowing also breaks memoization if you create the 1.3 has changes to eliminate some of the cost of going through the var. since going through the var is much cheaper now it would be nice to http://groups.google.com/group/clojure-dev/browse_thread/thread/33b52b24616967f?hl=en |
| Comments |
| Comment by Kevin Downey [ 11/Jun/11 2:40 PM ] |
|
tests indicate that accessing the fn through the var vs. accessing through the lexical binding have very similar access times https://gist.github.com/1013008 results in $ java -jar clojure.jar ~/src/lexicaltest.clj |
| Comment by Jason Wolfe [ 13/Jun/11 5:05 PM ] |
|
Here's another test that makes sure no JIT funny business (e.g. dead code elimination) is going on, and also looks at primitive hinted versions. https://gist.github.com/1023816 var-obj result, time: 14930352 ,"Elapsed time: 965.577 msecs" I'm not sure how to properly hint the var in the var-prim version to get truly comparable results. In any case, this use case should definitely be kept in mind. |
| Comment by Kevin Downey [ 13/Jun/11 5:35 PM ] |
|
I think the point is we want to make sure the jvm can optimize both just as well, so making the code purposefully unoptimizable is kind of silly, yes? |
| Comment by Jason Wolfe [ 21/Jun/11 4:41 PM ] |
|
@Kevin In your gist, the return value of foo is not used, and foo has no side effects. A sufficiently smart compiler could optimize the calls out entirely, which would not tell us much about the runtime of foo. |
| Comment by Aaron Bedra [ 28/Jun/11 6:49 PM ] |
|
Rich: Given the performance testing (in the email thread) what is the next step here?
Are there things that this might break that we need to consider? |
| Comment by Rich Hickey [ 29/Jul/11 7:39 AM ] |
|
Someone needs to make a patch, and then test perf with and without the patch. These simulated tests aren't necessarily indicative. Naive fib is an ok test once you have a patch. And yes, more things might break - needs careful assessment. |
[CLJ-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-790] Primitive type hints on function names should print error message Created: 10/May/11 Updated: 10/May/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alan Dipert | Assignee: | Alan Dipert |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Functions returning primitives are hinted with metadata on the argument list, not on the function name. Using a primitive type hint on a function name should print an error message. Currently, misplaced primitive hints are read without error. |
[CLJ-787] transient blows up when passed a vector created by subvec Created: 03/May/11 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Backlog |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Alexander Redington | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
Subvectors created with subvec from a PersistentVector cannot be made transient: user=> (transient (subvec [1 2 3 4] 2)) ClassCastException clojure.lang.APersistentVector$SubVector cannot be cast to clojure.lang.IEditableCollection clojure.core/transient (core.clj:2864) |
| Comments |
| Comment by Stuart Sierra [ 31/May/11 9:28 AM ] |
|
Confirmed. APersistentVector$SubVector does not implement IEditableCollection. The current implementation of TransientVector depends on implementation details of PersistentVector, so it is not a trivial fix. The simplest fix might be to implement IEditableCollection.asTransient in SubVector by creating a new PersistentVector, but I do not know the performance implications. |
[CLJ-776] seque broken for some BlockingQueues Created: 21/Apr/11 Updated: 22/Apr/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Pepijn de Vos | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
clojure.core/seque takes an optional argument that can be the initial capacity for a LinkedBlockingQueue or an instance of the BlockingQueue interface. PriorityBlockingQueue is such a class, but fails to work because seque makes a few assumptions about BlockingQueues that are not true for all BlockingQueues. user=> (def s (seque (java.util.concurrent.PriorityBlockingQueue. 100) (shuffle (range 100)))) user=> (seque (java.util.concurrent.SynchronousQueue.) (shuffle (range 100))) user=> (seque (java.util.concurrent.ArrayBlockingQueue. 10) (shuffle (range 100))) |
| Comments |
| Comment by Pepijn de Vos [ 21/Apr/11 11:32 AM ] |
|
A working implementation with some tests. |
| Comment by Pepijn de Vos [ 22/Apr/11 9:27 AM ] |
|
Attachement removed, I'm working on it here: https://gist.github.com/934781 |
[CLJ-764] (partition 0 seq) and (parition-all 0 seq) are infinite sequences of empty sequences Created: 21/Mar/11 Updated: 21/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.1, Release 1.2 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Paul Stadig | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
(partition n seq) and (partition-all n seq) are implemented by taking n and dropping n from seq. When n=0 this becomes an infinite sequence of empty sequences. While conceptionally this makes sense, I think practically it may surprise people, and perhaps it should return an empty sequence or a sequence of a single empty sequence. |
| Comments |
| Comment by Paul Stadig [ 21/Mar/11 9:22 AM ] |
|
Ugh! I didn't mean for this to be major priority, and I can't seem to edit it after the fact. |
| Comment by Mike Anderson [ 21/Jan/13 5:40 AM ] |
|
I think the current behaviour is logically more correct than returning a empty sequence or a single empty sequence. In particular, I would expect (partition n infinite-seq) to return an infinite sequence of sequences of length n, for any value of n >= 0. Anything else would be very surprising. The only other sensible option would be throwing an exception, on the philosophical grounds that it isn't possible to partition a non-empty sequence into sub-sequences of length 0. But I think that changing behaviour in this way would break backwards compatibility for no obvious gain. I suggest closing this issue. |
[CLJ-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-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-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-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-731] Create macro to variadically unroll a combinator function definition Created: 26/Jan/11 Updated: 28/Jan/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Fogus | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
Clojure contains a set of combinators that are implemented in a similar, but slightly different way. That is, they are implemented as a complete set of variadic overloads on both the call-side and also on the functions that they return. Visually, they all tend to look something like: (defn foo
([f]
(fn
([] do stuff...)
([x] do stuff...)
([x y] do stuff...)
([x y z] do stuff...)
([x y z & args] do variadic stuff...)))
([f1 f2]
(fn
([] do stuff...)
([x] do stuff...)
([x y] do stuff...)
([x y z] do stuff...)
([x y z & args] do variadic stuff...)))
([f1 f2 f3]
(fn
([] do stuff...)
([x] do stuff...)
([x y] do stuff...)
([x y z] do stuff...)
([x y z & args] do variadic stuff...)))
([f1 f2 f3 & fs]
(fn
([] do stuff...)
([x] do stuff...)
([x y] do stuff...)
([x y z] do stuff...)
([x y z & args] do variadic stuff...))))
To build this type of function for each combinator is tedious and error-prone. There must be a way to implement a macro that takes a "specification" of a combinator including: 1. name And builds something like the function foo above. This macro should be able to implement the current batch of combinators (assuming that http://dev.clojure.org/jira/browse/CLJ-730 is completed first for the sake of verification). |
| Comments |
| Comment by Stuart Halloway [ 28/Jan/11 9:03 AM ] |
|
This seems useful. Rich, would you accept a patch? |
| Comment by Stuart Halloway [ 28/Jan/11 9:40 AM ] |
|
Nevermind, just saw that Rich already suggested this on the dev list. Patch away. |
[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-704] range function has missing documentation Created: 04/Jan/11 Updated: 11/May/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Maarten Hus | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
All |
||
| Description |
|
The range function's documentation does indicate the following usage: (range 10 0 -1) -> (10, 9, 8, 7, 6, 5, 4, 3, 2, 1) Current doc: Returns a lazy seq of nums from start (inclusive) to end Suggestion: Returns a lazy seq of nums from start (inclusive) to end Its also possible to step down rather than up, for example counting |
| Comments |
| Comment by Rasmus Svensson [ 15/Jan/11 7:39 AM ] |
|
The current doc actually mentions the 'step' parameter briefly: "[...] to end (exclusive), by step, where start [...]" But as this might be easy to miss, an addition to the doc is still a good idea, I think. My suggestion: Returns a lazy seq of nums from start (inclusive) to end |
[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-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-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-668] Improve slurp performance by using native Java StringWriter and jio/copy Created: 01/Nov/10 Updated: 01/Nov/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Jürgen Hötzel | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Instead of copying each character from InputReader to StringBuffer. Performance improvement: From: user> (time (count (slurp "/home/juergen/test.dat"))) "Elapsed time: 4269.980863 msecs" 104857600 To: user> (time (count (slurp "/home/juergen/test.dat"))) "Elapsed time: 1140.854023 msecs" 104857600 Patch: http://github.com/juergenhoetzel/clojure/commit/af1a5713cd485ba5f1db25c37906ebaf7d474b47 |
[CLJ-459] RFE: modify description of "assoc" Created: 14/Oct/10 Updated: 14/Oct/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The documentation for "assoc" in clojure.core should probably (assoc vector index val) </code></pre> and <pre><code>(assoc vector index val & ivs) in the usage line. |
| Comments |
| Comment by Assembla Importer [ 14/Oct/10 4:55 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/459 |
[CLJ-451] fn literals lack name/arglists/namespace metadata Created: 05/Oct/10 Updated: 05/Oct/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
I would expect (meta (fn not-so-anonymous [a b c])) to include {:name not-so-anonymous :arglists ([a b c])} alongside line number information and possibly namespace/file as well, but currently it only includes :line. |
| Comments |
| Comment by Assembla Importer [ 05/Oct/10 12:29 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/451 |
[CLJ-450] Add default predicate argument to filter, every?, take-while Created: 01/Oct/10 Updated: 27/Apr/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Some seq processing functions that take predicates could be improved by the addition of a default value of identity for the predicate argument. This has been discussed on the mailing list, and people seem favorable: I can put together a patch. |
| Comments |
| Comment by Assembla Importer [ 01/Oct/10 4:39 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/450 |
| Comment by Jason Orendorff [ 13/Mar/12 2:51 PM ] |
|
I independently wanted this. Here's a patch for: some, not-any?, every?, not-every?. If this is roughly what's wanted I'll be happy to add filter, remove, take-while, drop-while. |
| Comment by Jason Orendorff [ 13/Mar/12 4:57 PM ] |
|
Note that there are a few cases of (every? identity ...) and (some identity ...) in core.clj itself; the patch removes "identity" from those. |
| Comment by Andy Fingerhut [ 26/Apr/12 7:51 PM ] |
|
clj-450-add-default-pred-arg-to-core-fns-patch.txt dated Apr 26 2012 is identical to Jason Orendorff's, except it is in git format. Jason is not on the list of Clojure contributors as of today. I have sent him an email asking if he has done so, or is planning to. |
| Comment by Jason Orendorff [ 27/Apr/12 10:35 AM ] |
|
Of course I'd be happy to send in a contributor agreement. ...Is there actually any interest in taking this patch or something like it? |
| Comment by Andy Fingerhut [ 27/Apr/12 11:38 AM ] |
|
I don't know if there is any interest in taking this patch. Perhaps a Clojure screener will take a look at it and comment, but I am not a screener and can't promise anything. |
[CLJ-445] Method/Constructor resolution does not factor in widening conversion of primitive args Created: 29/Sep/10 Updated: 20/Feb/12 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Reviewed Backlog |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alexander Taggart | Assignee: | Alexander Taggart |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Approval: | Incomplete |
| Description |
|
Problem: Examples: user=> (Integer. (byte 0)) java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Integer (NO_SOURCE_FILE:0) </code></pre> The above occurs because there is no Integer(byte) constructor, though it should match on Integer(int). <pre><code>user=> (bit-shift-left (byte 1) 1) Reflection warning, NO_SOURCE_PATH:3 - call to shiftLeft can't be resolved. 2 In the above, a call is made via reflection to Numbers.shiftLeft(Object, Object) and its associated auto-boxing, instead of directly to the perfectly adequate Numbers.shiftLeft(long, int). Workarounds: Ancillary benefits of fixing: |
| Comments |
| Comment by Assembla Importer [ 23/Oct/10 6:43 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/445 |
| Comment by Assembla Importer [ 23/Oct/10 6:43 PM ] |
|
ataggart said: [file:b6gDSUZOur36b9eJe5cbCb] |
| Comment by Assembla Importer [ 23/Oct/10 6:43 PM ] |
|
ataggart said: Also fixes #446. |
| Comment by Stuart Halloway [ 03/Dec/10 12:50 PM ] |
|
The patch is causing a test failure [java] Exception in thread "main" java.lang.IllegalArgumentException:
More than one matching method found: equiv, compiling:(clojure/pprint/cl_format.clj:428)
Can you take a look? |
| Comment by Stuart Halloway [ 28/Jan/11 12:30 PM ] |
|
The failing test happens when trying to find the correct equiv for signature (Number, long). Is the compiler wrong to propose this signature, or is the resolution method wrong in not having an answer? (It thinks two signatures are tied: (Object, long) and (Number, Number).) Exception in thread "main" java.lang.IllegalArgumentException: More than one matching method found: equiv, compiling:(clojure/pprint/cl_format.clj:428) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6062) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6050) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.access$100(Compiler.java:35) at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:5492) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6043) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6043) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$IfExpr$Parser.parse(Compiler.java:2372) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6043) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3277) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6057) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5231) at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:5527) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6043) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5231) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$IfExpr$Parser.parse(Compiler.java:2385) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5231) at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:5527) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6043) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$IfExpr$Parser.parse(Compiler.java:2385) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5231) at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:5527) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6043) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5231) at clojure.lang.Compiler$FnMethod.parse(Compiler.java:4667) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3397) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6053) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6043) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.access$100(Compiler.java:35) at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:480) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) at clojure.lang.Compiler.analyze(Compiler.java:5866) at clojure.lang.Compiler.analyze(Compiler.java:5827) at clojure.lang.Compiler.eval(Compiler.java:6114) at clojure.lang.Compiler.load(Compiler.java:6545) at clojure.lang.RT.loadResourceScript(RT.java:340) at clojure.lang.RT.loadResourceScript(RT.java:331) at clojure.lang.RT.load(RT.java:409) at clojure.lang.RT.load(RT.java:381) at clojure.core$load$fn__1427.invoke(core.clj:5308) at clojure.core$load.doInvoke(core.clj:5307) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.pprint$eval3969.invoke(pprint.clj:46) at clojure.lang.Compiler.eval(Compiler.java:6110) at clojure.lang.Compiler.load(Compiler.java:6545) at clojure.lang.RT.loadResourceScript(RT.java:340) at clojure.lang.RT.loadResourceScript(RT.java:331) at clojure.lang.RT.load(RT.java:409) at clojure.lang.RT.load(RT.java:381) at clojure.core$load$fn__1427.invoke(core.clj:5308) at clojure.core$load.doInvoke(core.clj:5307) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.core$load_one.invoke(core.clj:5132) at clojure.core$load_lib.doInvoke(core.clj:5169) at clojure.lang.RestFn.applyTo(RestFn.java:143) at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:77) at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28) at clojure.core$apply.invoke(core.clj:602) at clojure.core$load_libs.doInvoke(core.clj:5203) at clojure.lang.RestFn.applyTo(RestFn.java:138) at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:77) at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28) at clojure.core$apply.invoke(core.clj:604) at clojure.core$use.doInvoke(core.clj:5283) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.main$repl.doInvoke(main.clj:196) at clojure.lang.RestFn.invoke(RestFn.java:422) at clojure.main$repl_opt.invoke(main.clj:267) at clojure.main$main.doInvoke(main.clj:362) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.lang.Var.invoke(Var.java:401) at clojure.lang.AFn.applyToHelper(AFn.java:163) at clojure.lang.Var.applyTo(Var.java:518) at clojure.main.main(main.java:37) Caused by: java.lang.IllegalArgumentException: More than one matching method found: equiv at clojure.lang.Reflector.getMatchingParams(Reflector.java:639) at clojure.lang.Reflector.getMatchingParams(Reflector.java:578) at clojure.lang.Reflector.getMatchingMethod(Reflector.java:569) at clojure.lang.Compiler$StaticMethodExpr.<init>(Compiler.java:1439) at clojure.lang.Compiler$HostExpr$Parser.parse(Compiler.java:896) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6055) ... 115 more |
| Comment by Alexander Taggart [ 08/Feb/11 6:27 PM ] |
|
In working on implementing support for vararg methods, I found a number of flaws with the previous solutions. Please disregard them. I've attached a single patch (reflector-compiler-numbers.diff) which is a rather substantial overhaul of the Reflector code, with some enhancements to the Compiler and Numbers code. The patch notes:
|
| Comment by Alexander Taggart [ 10/Feb/11 7:35 PM ] |
|
Updated patch to fix a bug where a concrete class with multiple identical Methods (e.g., one from an interface, another from an abstract class) would result in ambiguity. Now resolved by arbitrary selection (this is what the original code did as well albeit not explicitly). |
| Comment by Alexander Taggart [ 25/Feb/11 9:29 PM ] |
|
Updated patch to work with latest master branch. |
| Comment by Stuart Halloway [ 06/Mar/11 1:54 PM ] |
|
patch appears to be missing test file clojure/test_clojure/reflector.clj. |
| Comment by Alexander Taggart [ 06/Mar/11 2:39 PM ] |
|
Bit by git. Patch corrected to contain clojure.test-clojure.reflector. |
| Comment by Stuart Halloway [ 11/Mar/11 10:30 AM ] |
|
Rich: I verified that the patch applied but reviewed only briefly, knowing you will want to go over this one closely. |
| Comment by Stuart Halloway [ 11/Mar/11 10:55 AM ] |
|
After applying this patch, I am getting method missing errors: java.lang.NoSuchMethodError: clojure.lang.Numbers.lt(JLjava/lang/Object;)
but only when using compiled code, e.g. the same code works in the REPL and then fails after compilation. Haven't been able to isolate an example that I can share here yet, but hoping this will cause someone to have an "a, hah" moment... |
| Comment by Alexander Taggart [ 02/Apr/11 12:55 PM ] |
|
The patch now contains only the minimal changes needed to support widening conversion. Cleanup of Numbers overloads, etc., can wait until this patch gets applied. The vararg support is in a separate patch on CLJ-440. |
| Comment by Christopher Redinger [ 15/Apr/11 12:50 PM ] |
|
Please test patch |
| Comment by Christopher Redinger [ 21/Apr/11 11:02 AM ] |
|
FYI: Patch applies cleanly on master and all tests pass as of 4/21 (2011) |
| Comment by Christopher Redinger [ 22/Apr/11 9:57 AM ] |
|
This work is too big to take into the 1.3 beta right now. We'll revisit for a future release. |
| Comment by Alexander Taggart [ 28/Apr/11 1:19 PM ] |
|
To better facilitate understanding of the changes, I've broken them up into two patches, each with a number of isolable, incremental commits: reorg-reflector.patch: Moves the reflection/invocation code from Compiler to Reflector, and eliminates redundant code. The result is a single code base for resolving methods/constructors, which will allow for altering that mechanism without excess external coordination. This contains no behaviour changes. prim-conversion.patch: Depends on the above. Alters the method/constructor resolution process:
This also provides a base to add further features, e.g., CLJ-666. |
| Comment by Alexander Taggart [ 29/Apr/11 3:01 PM ] |
|
It's documented in situ, but here are the conversion rules that the reflector uses to find methods:
|
| Comment by Alexander Taggart [ 10/May/11 3:13 PM ] |
|
prim-conversion-update-1.patch applies to current master. |
| Comment by Alexander Taggart [ 11/May/11 2:15 PM ] |
|
Created CLJ-792 for the reflector reorg. |
| Comment by Stuart Sierra [ 17/Feb/12 2:29 PM ] |
|
prim-conversion-update-1.patch does not apply as of f5bcf64. Is CLJ-792 now a prerequisite of this ticket? |
| Comment by Alexander Taggart [ 17/Feb/12 3:15 PM ] |
|
Yes, after the original patch was deemed "too big". After this much time with no action from TPTB, feel free to kill both tickets. |
| Comment by Andy Fingerhut [ 20/Feb/12 2:04 PM ] |
|
Again, not sure if this is any help, but I've tested starting from Clojure head as of Feb 20, 2012, applying clj-792-reorg-reflector-patch2.txt attached to CLJ-792, and then applying clj-445-prim-conversion-update-2-patch.txt attached to this ticket, and the result compiles and passes all but 2 tests. I don't know whether those failures are easy to fix or not, or whether issues may have been introduced with these patches. |
[CLJ-440] java method calls cannot omit varargs Created: 27/Sep/10 Updated: 29/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 5 |
| Labels: | None | ||
| Description |
|
From http://groups.google.com/group/clojure/browse_thread/thread/7d0d6cb32656a621 E.g., trying to call java.util.Collections.addAll(Collection c, T... elements) user=> (Collections/addAll [] (object-array 0)) false user=> (Collections/addAll []) IllegalArgumentException No matching method: addAll clojure.lang.Compiler$StaticMethodExpr.<init> (Compiler.java:1401) The Method class provides an isVarArg() method, which could be used to inform the compiler to process things differently. |
| Comments |
| Comment by Assembla Importer [ 27/Sep/10 8:19 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/440 |
| Comment by Alexander Taggart [ 01/Apr/11 11:16 PM ] |
|
Patch adds support for varargs. Builds on top of patch in CLJ-445. |
| Comment by Alexander Taggart [ 05/Apr/11 5:45 PM ] |
|
Patch updated to current CLJ-445 patch. |
| Comment by Nick Klauer [ 29/Oct/12 8:12 AM ] |
|
Is this ticket on hold? I find myself typing (.someCall arg1 arg2 (into-array SomeType nil)) alot just to get the right method to be called. This ticket sounds like it would address that extraneous into-array arg that I use alot. |
| Comment by Andy Fingerhut [ 29/Oct/12 10:45 AM ] |
|
fixbug445.diff uploaded on Oct 29 2012 was written Oct 23 2010 by Alexander Taggart. I am simply copying it from the old Assembla ticket tracking system to here to make it more easily accessible. Not surprisingy, it doesn't apply cleanly to latest master. I don't know how much effort it would be to update it, but only a few hunks do not apply cleanly according to 'patch'. See the "Updating stale patches" section on the JIRA workflow page here: http://dev.clojure.org/display/design/JIRA+workflow |
| Comment by Andy Fingerhut [ 29/Oct/12 10:56 AM ] |
|
Ugh. Deleted the attachment because it was for CLJ-445, or at least it was named that way. CLJ-445 definitely has a long comment history, so if one or more of its patches address this issue, then you can read the discussion there to see the history. I don't know of any "on hold" status for tickets, except for one or two where Rich Hickey has explicitly said in a comment that he wants to wait a while before making the change. There are just tickets that contributors choose to work on and ones that screeners choose to screen. |
[CLJ-434] Additional copy methods for URLs in clojure.java.io Created: 10/Sep/10 Updated: 10/Sep/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The copy method in clojure.java.io doesn't handle java.net.URL as input. |
| Comments |
| Comment by Assembla Importer [ 10/Sep/10 7:32 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/434 |
[CLJ-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-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-405] better error messages for bad defrecord calls Created: 20/Jul/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
defrecord could tell you if, e.g., you didn't specify an interface before leaping into method bodies. See http://groups.google.com/group/clojure/browse_thread/thread/f52f90954edd8b09 |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 12:28 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/405 |
| Comment by Assembla Importer [ 24/Aug/10 12:28 AM ] |
|
stu said: This could be fixed with an assert-valid-defrecord call in core_deftype, similar to assert-valid-fdecl in core.clj. Such a function would also be a place to hang other defrecord error messages. |
[CLJ-401] Promote "seqable?" from contrib? Created: 13/Jul/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
This was vaguely discussed here and could potenntially help this ticket as well as be generally useful. I don't speak for everyone but when I saw sequential? I assumed it would have the semantics that seqable? does. Just my opinion, I'd love to hear someone's who is more informed than mine. In the proposed patch referenced in the ticket above, if seqable? could be used in place of sequential? flatten could be more powerful and work with maps/sets/java collections. Here's how it would look: (defn flatten [coll]
(lazy-seq
(when-let [coll (seq coll)]
(let [x (first coll)]
(if (seqable? x)
(concat (flatten x) (flatten (next coll)))
(cons x (flatten (next coll))))))))
And an example: user=> (flatten #{1 2 3 #{4 5 {6 {7 8 9 10 #tok1-block-tok}}}}) |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 9:19 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/401 |
[CLJ-400] A faster flatten Created: 13/Jul/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
As discussed in this thread, I am submitting a more performant version of flatten for review. It has the same semantics as the current core/flatten. I have also updated the doc string to say that "(flatten nil) returns the empty list", because that's what the current version of core/flatten does as well. I haven't mailed in a CA yet, but I will tomorrow morning. Edit: Of course I'd mess my first ticket up |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 12:19 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/400 |
[CLJ-396] Better support for multiple inheritance in hierarchies and multimethods Created: 07/Jul/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
While the hierarchies produced with 'derive' allow multiple parents per child, there is no way to indicate precedence between those parents, other than by laboriously specifying 'prefer-method' for every type X every multimethod. When 2 multimethods are both applicable to the supplied arguments, Clojure produces a nonspecific IllegalArgumentException containing only an error string. All this means that while Clojure does have an "inheritance" mechanism in the form of the ad hoc hierarchies, it is currently not really possible to implement multiple inheritance using the ad hoc hierarchy mechanism. 'Prefer-method' will not scale up to use in large applications with complex type hierarchies and heavy use of multimethods. Some potential ways to solve this are:
Paul |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 11:06 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/396 |
[CLJ-379] problem with classloader when run as windows service Created: 13/Jun/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I found following error when I run clojure application as MS Windows service (via procrun from Apache Daemon project). When I tried to do 'require' during run-time, I got NullPointerException. This happened as baseLoader function from RT class returned null in such environment (the value of Thread.currentThread().getContextClassLoader()). (Although my app works fine when I run my application as standalone program, not as service). (.setContextClassLoader (Thread/currentThread) (java.lang.ClassLoader/getSystemClassLoader)) before any call to 'require'.... May be you need to modify 'baseLoader' function, so it will check is value of Thread.currentThread().getContextClassLoader() is null or not, and if null, then return value of java.lang.ClassLoader.getSystemClassLoader() ? |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 10:40 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/379 |
| Comment by Assembla Importer [ 24/Aug/10 10:40 AM ] |
|
alexott said: possible fix is attached |
| Comment by Assembla Importer [ 24/Aug/10 10:40 AM ] |
|
alexott said: [file:c5XWHcD4yr34HveJe5ccaP] |
[CLJ-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-348] reify allows use of qualified name as method parameter Created: 13/May/10 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
This should complain about using a fully-qualified name as a parameter: (defmacro lookup [] Instead it simply ignores that parameter in the method body in favour of clojure.core/key. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 8:03 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/348 |
| Comment by Assembla Importer [ 24/Aug/10 8:03 AM ] |
|
technomancy said: [file:d2xUJIxTyr36fseJe5cbLA]: A test to expose the unwanted behaviour |
| Comment by Assembla Importer [ 24/Aug/10 8:03 AM ] |
|
richhickey said: I'm not sure the bug is what you say it is, or the resolution should be what you suggest. The true problem is the resolution of key when qualified. Another possibility is to ignore the qualifier there. |
| Comment by Assembla Importer [ 24/Aug/10 8:03 AM ] |
|
technomancy said: Interesting. So it's not appropriate to require auto-gensym here? Why are the rules different for reify methods vs proxy methods? > (defmacro lookup [] Can't use qualified name as parameter: clojure.core/key |
[CLJ-346] (pprint-newline :fill) is not handled correctly Created: 12/May/10 Updated: 29/Nov/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Tom Faulhaber |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Incomplete |
| Waiting On: | Tom Faulhaber |
| Description |
|
Filled pretty printing (where we try to fit as many elements on a line as possible) is being too aggressive as we can see when we try to print the following array: user> (binding [*print-right-margin* 20] (pprint (int-array (range 10)))) Produces: [0, Rather than [0, 1, 2, 3, 4, or something like that. (I haven't worked through the exact correct representation for this case). We currently only use :fill style newlines for native java arrays. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 8:01 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/346 |
| Comment by Assembla Importer [ 24/Aug/10 8:01 AM ] |
|
stu said: [file:diLxv6y4Sr35GVeJe5cbLr] |
| Comment by Assembla Importer [ 24/Aug/10 8:01 AM ] |
|
stu said: The second patch includes the first, and adds another test. |
| Comment by Assembla Importer [ 24/Aug/10 8:01 AM ] |
|
tomfaulhaber said: This patch was attached to the wrong bug. It should be attached to bug #347. There is no fix for this bug yet. |
| Comment by Rich Hickey [ 05/Nov/10 8:07 AM ] |
|
Is this current? |
| Comment by Stuart Halloway [ 29/Nov/10 8:48 PM ] |
|
Tom, this patch doesn't apply, and I am not sure why. Can you take a look? |
[CLJ-326] add :as-of option to refer Created: 30/Apr/10 Updated: 24/Aug/10 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Christophe Grand |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Test |
| Description |
|
Discussed here: http://groups.google.com/group/clojure-dev/msg/74af612909dcbe56 :as-of allows library authors to specify a known subset of vars to refer from clojure (or any other library which would use :added metadata). (ns foo (:refer-clojure :as-of "1.1")) is equivalent to (ns foo (:refer-clojure :only [public-documented-vars-which-already-existed-in-1.1])) |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 10:19 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/326 |
| Comment by Assembla Importer [ 24/Aug/10 10:19 AM ] |
|
cgrand said: [file:a8SumUvcOr37SmeJe5cbLA]: requires application of #325 |
| Comment by Assembla Importer [ 24/Aug/10 10:19 AM ] |
|
richhickey said: Do we still need this? |
[CLJ-319] TransactionalHashMap bug Created: 26/Apr/10 Updated: 01/Oct/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
TransactionalHashMap computation of the bin is buggy. The implementation doesn't unset the sign bit before using it in accessing the bin array which in some cases cause an ArrayOutOfBoundException to be thrown. As Rich Hickey has pointed out, this is an unsupported experimental Class and won't be fixed unless I provided a patch, so attached is the patch file. |
| Comments |
| Comment by Assembla Importer [ 01/Oct/10 4:06 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/319 |
| Comment by Assembla Importer [ 01/Oct/10 4:06 PM ] |
|
megabyte2021 said: [file:cuuZnsuuWr36H0eJe5dVir]: The patch file |
| Comment by Assembla Importer [ 01/Oct/10 4:06 PM ] |
|
stu said: Please add a test case. |
[CLJ-304] contrib get-source no longer works with deftype Created: 20/Apr/10 Updated: 03/Dec/10 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Description |
|
Now that deftype creates a class (but not a var), you can't use c.c.repl-utils/get-source on a deftype. Is there something we can do on the Clojure side to help this work again? |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 4:38 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/304 |
| Comment by Assembla Importer [ 24/Aug/10 4:38 PM ] |
|
chouser@n01se.net said: That's a great question. get-source just needs a file name and line number. If IMeta were a protocol, it could be extended to Class. That implementation could look for a "well-known" static field, perhaps? __clojure_meta or something? Then deftype would just have to populate that field, and get-source would be all set. Does that plan have any merit? Is there a better place to store a file name and line number? |
| Comment by Assembla Importer [ 24/Aug/10 4:38 PM ] |
|
stu said: Seems like a reasonable idea, but this is going to get back-burnered for now, unless there is a dire use case we have missed. |
[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-277] Making clojure.xml/emit a little friendler to xml consumers Created: 03/Mar/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Currently, clojure.xml/emit breaks the eBay api, because emit adds whitespace before and after :contents. This trivial patch fixes it for me: (Dunno whether there's a good reason emit works that way, or if I'm missing something obvious.) I realize that emit's behavior conforms to the XML spec and it's probably eBay at fault here. But I can nevertheless see this whitespace causing problems. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 9:41 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/277 |
| Comment by Assembla Importer [ 24/Aug/10 9:41 AM ] |
|
bpsm said: I've attached a patch to #410, which also fixes this issue. (In fact, it turns out that it's the same patch tlj previously attached here.) |
| Comment by Assembla Importer [ 24/Aug/10 9:41 AM ] |
|
stu said: Duplicated association with ticket #410 was added |
[CLJ-274] cannot close over mutable fields (in deftype) Created: 23/Feb/10 Updated: 01/Oct/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Vetted |
| Description |
|
Simplest case: user=> java.lang.IllegalArgumentException: Cannot assign to non-mutable: val (NO_SOURCE_FILE:5) Functions should be able to mutate mutable fields in their surrounding deftype (just like inner classes do in Java). Filed as bug, because the loop special form expands into a fn form sometimes: user=> |
| Comments |
| Comment by Assembla Importer [ 01/Oct/10 9:35 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/274 |
| Comment by Assembla Importer [ 01/Oct/10 9:35 AM ] |
|
donmullen said: Updated each run to [_] for new syntax. Now gives exception listed. |
| Comment by Assembla Importer [ 01/Oct/10 9:35 AM ] |
|
richhickey said: We're not going to allow closing over mutable fields. Instead we'll have to generate something other than fn for loops et al used as expressions. Not going to come before cinc |
[CLJ-273] def with a function value returns meta {:macro false}, but def itself doesn't have meta Created: 23/Feb/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Rich Hickey |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
On the master (1.2) branch, if you create a def with an initial function value, {:macro false} is added to the metadata of the return value for def. However, if you look again at the metadata on the var itself, the {:macro false} is not present! This breaks the use of contrib's defalias when aliasing macros, because the new alias is marked as {:macro false}. The code below demonstrates the issue, which was introduced in http://github.com/richhickey/clojure/commit/430dd4fa711d0008137d7a82d4b4cd27b6e2d6d1, "metadata for fns." ;; all running on 1.2, DIFF noted in comments
(defmacro foo [])
-> #'user/foo
(meta (def bar (.getRoot #'foo)))
-> {:macro false, :ns #<Namespace user>, :name bar, :file "NO_SOURCE_PATH", :line 83}
;; DIFF: where did that :macro false come from??
(def bar (.getRoot #'foo))
-> #'user/bar
(meta #'bar)
-> {:ns #<Namespace user>, :name bar, :file "NO_SOURCE_PATH", :line 84}
;; LIKE 1.1, but really weird: now the :macro false is gone again!
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 9:32 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/273 |
[CLJ-272] load/ns/require/use overhaul Created: 18/Feb/10 Updated: 28/Feb/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Description |
|
Creating this ticket to describe various things people have wanted to change about how ns works: Minimal needs
Other possibilities to discuss.
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 9:27 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/272 |
| Comment by Assembla Importer [ 24/Aug/10 9:27 AM ] |
|
stu said: Suggestions from Volkan Yazici: Hi, I saw your "load/ns/require/use overhaul" ticket[1] and would like to tr/edu/bilkent/cs/retop.clj In retop.clj, I have below ns definition. (ns tr.edu.bilkent.cs.retop And in every .clj file in retop/ directory I have below in-ns in the (in-ns 'tr.edu.bilkent.cs.retop) The problems with the ns decleration are: 1) Most of the :import's in retop.clj only belong to a single .clj file. (tr.edu.bilkent.cs.patoh imports are only used by graph.clj. Yep, I can add an (import ...) 2) See (:load ...) clause in (ns ...) form. There are lots of (:load Also, being able to use wildcards would be awesome. 3) There are inconsistencies between macros and functions. For instance, (ns foo.bar.baz (:use mov)) I'd like to get rid of quotations in both cases. I'm not sure if I'm using the right tools and doing the right approach |
| Comment by Assembla Importer [ 24/Aug/10 9:27 AM ] |
|
stuart.sierra said: My requests: 1. If writing macros that do not evaluate their arguments, provide function versions that do evaluate their arguments. 2. Do not support prefix lists for loading Clojure namespaces. It's hard to parse with external tools. 3. Do not conflate importing Java classes with loading Clojure namespaces. They are fundamentally different operations with different semantics. I have implemented some ideas in a macro called "need" at http://github.com/stuartsierra/need |
| Comment by Stuart Sierra [ 12/Dec/10 4:08 PM ] |
|
Further requests: Permit tools to read the "ns" declaration and statically determine the dependencies of a namespace, without evaluating any code. |
| Comment by Paudi Moriarty [ 28/Feb/12 3:56 AM ] |
This would be great for building OSGi bundles where Bnd is currently not much help. |
[CLJ-270] defn-created fns inherit old metadata from the Var they are assigned to Created: 13/Feb/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Rich Hickey |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
user> (def #^{:foo "bar"} x 5)
I expect (meta #'x) to evaluate to the value of the final (meta x) in the above.
Current master (commit 61202d2ff6925002400a9843e8fbd080f3bef3a5).
Prompted by discussion at
I think this is due to DefExpr's eval method binding the Var to init.eval() first and attaching the supplied metadata to the Var later – see Compiler.java lines 341-352. (Note the Var is always already in place when init.eval() is called, regardless of whether it existed prior to the evaluation of the def / defn.) Thus the init expression supplied by defn sees the old (and wrong) metadata on the Var. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/270 |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
stu said: [file:dwK4yssayr37y_eJe5d-aX] |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
stu said: The problem happens with defn, but not with def+fn, so I think the original diagnosis is incorrect. Another stab at diagnosis: The defn macro copies metadata from a var onto its new value, so if you defn a var that already exists, the old var metadata becomes metadata on the new value. I don't know why this would be the right thing to do, and if you eliminate this behavior (see patch) all the Clojure and Contrib tests still pass. If this is correct, please assign back to me and I will write tests. If this is wrong, please tell me what's going on here so I know how to write the tests. |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
cgrand said: Child association with ticket #363 was added |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
cgrand said: I think the original diagnosis is correct. Note that the behavior differ when def iscompiled: user=> (def #^{:foo "bar"} x 5) See also http://groups.google.com/group/clojure/browse_thread/thread/6afd81896ca368b2# |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
cgrand said: [file:arrhbiAI4r35lQeJe5cbLr] |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
cgrand said: My patch aligns DefExpr.eval with DefExpr.emit (first set meta then eval the init value). |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
cgrand said: Forget it, my current patch is broken. |
| Comment by Assembla Importer [ 24/Aug/10 6:23 AM ] |
|
cgrand said: My current patch is broken because of #352, what is the rational for #352? |
[CLJ-259] clojure.lang.Reflector.invokeMatchingMethod is not complete (rejects pontentially valid method invocations) Created: 03/Feb/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Description |
|
There exists invoke expressions on instances, where Java is able to perform the call, yet clojure is not reflectively. This restricts the possible search space. I suggest that if target is not null (e.g. is not a static method), the target.getClass() should be used instead as a root for getAsMethodOfPublicBase. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:12 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/259 |
| Comment by Assembla Importer [ 24/Aug/10 3:12 PM ] |
|
richhickey said: How about some sample case that demonstrates the problem? |
| Comment by Assembla Importer [ 24/Aug/10 3:12 PM ] |
|
hiredman said: Related association with ticket #126 was added |
[CLJ-252] Support typed non-primitive fields in deftype Created: 29/Jan/10 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Right now hints are accepted but not used as field type. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:07 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/252 |
[CLJ-250] debug builds Created: 27/Jan/10 Updated: 14/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stuart Halloway | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Incomplete |
| Waiting On: | Rich Hickey |
| Description |
|
This ticket includes two patches:
Things to consider before approving these patches:
|
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:05 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/250 |
| Comment by Stuart Halloway [ 07/Dec/10 8:23 PM ] |
|
Ignore the old patches. Considering the following implementation, please review and then move ticket to waiting on Stu:
|
| Comment by Rich Hickey [ 08/Dec/10 11:00 AM ] |
|
#3 - root bound only #6 - my biggest reservation is that this isn't yet informed by maven best practices |
| Comment by Stuart Sierra [ 08/Dec/10 2:09 PM ] |
|
System properties can be passed through Maven, so I do not anticipate this being a problem. However, I would prefer *assert* to remain true by default. |
| Comment by Chas Emerick [ 09/Dec/10 7:19 AM ] |
|
SS is correct about this approach not posing any issue for Maven. In addition, the build could easily be set up to always emit two jars, one "normal", one "debug". I'd suggest that, while clojure.debug might have broad effect, additional properties should be available to provide fine-grained control over each of the additional "debug"-related parameterizations that might become available in the future. I'd like to raise a couple of potentially tangential concerns (after now thinking about assertions for a bit in the above context), some or all of which may simply be a result of my lack of understanding in various areas. Looking at where assert is used in core.clj (only two places AFAICT: validating arguments to derive and checking pre- and post-conditions in fn), it would seem unwise to make it false by default. i.e. non-Named values would be able to get into hierarchies, and pre- and post-conditions would simply be ignored. It's my understanding that assertions (talking here of the JVM construct, from which Clojure reuses AssertionError) should not be used to validate arguments to public API functions, or used to validate any aspect of a function's normal operation (i.e. "where not to use assertions"). That would imply that derive should throw IllegalArugmentException when necessary, and fn pre- and post-conditions should perhaps throw IllegalStateException – or, in any case, something other than AssertionError via assert. This would match up far better with most functions in core using assert-args rather than assert, the former throwing IllegalArgumentException rather than AssertionError. That leads me to the question: is assert (and *assert*) intended to be a Clojure construct, or a quasi-interop form? If the former, then it can roughly have whatever semantics we want, but then it seems like it should not be throwing AssertionError. If the latter, then AssertionError is appropriate on the JVM, but then we need to take care that assertions can be enabled and disabled at runtime (without having to switch around different builds of Clojure), ideally using the host-defined switches (e.g. -ea and friends) and likely not anything like *assert*. I don't know if this is possible or practical at this point (I presume this would require nontrivial compiler changes). Hopefully the above is not water under the bridge at this point. Thank you in advance for your forbearance. |
| Comment by Rich Hickey [ 09/Dec/10 8:08 AM ] |
|
Thanks for the useful input Chas. Nothing is concluded yet. I think we should step back and look at the objective here, before moving forward with a solution. Being a dynamic language, there are many things we might want to validate about our programs, where the cost of checking is something we are unwilling to pay in production. Being a macro, assert has the nice property that, should *assert* not be true during compilation, it generates nil, no conditional test at all. Thus right now it is more like static conditional compilation. Java assert does have runtime toggle-ability, via -ea as you say. I haven't looked at the bytecode generated for Java asserts, but it might be possible for Clojure assert to do something similar, if the runtime overhead is negligible. It is quite likely that HotSpot has special code for eliding the assertion bytecode given a single check of some flag. I'm just not sure that flag is Class.desiredAssertionStatus. Whether this turns into changes in assert or pre/post conditions, best practices etc is orthogonal and derived. Currently we don't have a facility to run without the checks. We need to choose between making them disappear during compilation (debug build) or runtime (track -ea) or both. Then we can look at how that is reflected in assert/pre-post and re-examine existing use of both. The "where not to use assertions" doc deals with them categorically, but in not considering their cost, seems unrealistic IMO. I'd appreciate it if someone could look into how assert is generated and optimized by Java itself. |
| Comment by Chas Emerick [ 09/Dec/10 5:04 PM ] |
|
Bytecode issues continue to be above my pay grade, unfortunately… A few additional thoughts in response that you may or may not be juggling already: assert being a macro makes total sense for what it's doing. Trouble is, "compile-time" is a tricky concept in Clojure: there's code-loading-time, AOT-compile-time, and transitively-AOT-compile-time. Given that, it's entirely possible for an application deployed to a production environment that contains a patchwork of code or no code produced by assert usages in various libraries and namespaces depending upon when those libs and ns' were loaded, AOT-compiled, or their dependents AOT-compiled, and the value of *assert* at each of those times. Of course, this is the case for all such macros whose results are dependent upon context-dependent state (I think this was a big issue with clojure.contrib.logging, making it only usable with log4j for a while). What's really attractive about the JVM assertion mechanism is that it can be parameterized for a given runtime on a per-package basis, if desired. Reimplementing that concept so that assert can be *ns*-sensitive seems like it'd be straightforward, but the compile-time complexity already mentioned remains, and the idea of having two independently-controlled assertion facilities doesn't sound fun. I know nearly nothing about the CLR, but it would appear that it doesn't provide for anything like runtime-controllable assertions. |
| Comment by Stuart Halloway [ 29/Dec/10 3:17 PM ] |
|
The best (dated) evidence I could find says that the compiler sets a special class static final field $assertionsDisabled based on the return of desiredAssertionStatus. HotSpot doesn't do anything special with this, dead code elimination simply makes it go away. The code indeed compiles this way: 11: getstatic #6; //Field $assertionsDisabled:Z Even if we were 100% sure that assertion removal was total, I would still vote for a separate Clojure-level switch, for the following reasons:
Rich: awaiting your blessing to move forward on this. |
| Comment by Rich Hickey [ 07/Jan/11 9:42 AM ] |
|
The compiler sets $assertionsDisabled when, in static init code? Is there special support in the classloader for it? Is there a link to the best dated evidence you found? |
| Comment by Stuart Halloway [ 07/Jan/11 9:51 AM ] |
|
| Comment by Stuart Halloway [ 07/Jan/11 9:57 AM ] |
|
Link: Google "java assert shirazi". (Not posting link because I can't tell in 10 secs whether it includes my session information.) |
| Comment by Alexander Kiel [ 14/Mar/13 1:28 PM ] |
|
Is there anything new on this issue? I also look for a convenient way to disable assertions in production. |
[CLJ-233] better error reporting of nonexistent var Created: 31/Dec/09 Updated: 29/Sep/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
simple improvement to error message when referencing a var that doesn't exist. |
| Comments |
| Comment by Assembla Importer [ 29/Sep/10 5:29 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/233 |
| Comment by Assembla Importer [ 29/Sep/10 5:29 AM ] |
|
chouser@n01se.net said: Stuart, I don't see a patch attached. |
[CLJ-213] Invariants and the STM Created: 01/Dec/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
(ticket requested here http://groups.google.com/group/clojure/browse_thread/thread/119311e89fa46806/4903ce25ff6deaa6#4903ce25ff6deaa6) The general idea is to declare invariants inside a transaction and, when at commit time an invariant doesn't hold anymore, the transaction retries. See the attached file for quick prototype. User code would looks like: (invariant (@world :key)) (commute world update-in [:key] val-transform-fn) This means the commute will occur only if (@world :key) returns the same value in-transaction and at commit point. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 7:23 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/213 |
[CLJ-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-190] enhance with-open to be extensible with a new close multimethod Created: 13/Sep/09 Updated: 23/Dec/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
Discussion: http://groups.google.com/group/clojure/browse_thread/thread/8e4e56f6fc65cc8e/618a893a5b2a5410 Currently, with-open calls .close when it's finished. I'd like it to have a (defmulti close type) so it's behavior is extensible. A standard method could be defined for java.io.Closeable and a :default method with no type hint. I've come across a few cases where some external library defines what is essentially a close method but names it shutdown or disable, etc., and adding my own "defmethod close" would be much easier than rewriting with-open. This would also allow people to eliminate reflection for classes like sql Connection that were created before Closeable. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 4:30 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/190 |
| Comment by Assembla Importer [ 24/Aug/10 4:30 AM ] |
|
mikehinchey said: [file:ca27R6Ojur3PQ0eJe5afGb]: fix adds close method and tests |
| Comment by Assembla Importer [ 24/Aug/10 4:30 AM ] |
|
mikehinchey said: Note, I only defined methods for :default (reflection of .close) and Closeable, not sql or the numerous other classes in java that should be Closeable but are not. Maybe clojure.contrib.sql and other such libraries should define related close methods. |
| Comment by Assembla Importer [ 24/Aug/10 4:30 AM ] |
|
richhickey said: I want to hold off on this until scopes are in |
| Comment by Tassilo Horn [ 23/Dec/11 6:50 AM ] |
|
Probably better implemented using a protocol. See http://dev.clojure.org/jira/browse/CLJ-308 |
[CLJ-163] Enhance = and == docs Created: 30/Jul/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Laurent Petit |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
Enhance = and == docs as far as numbers handling is concerned (make them self referenced, make clear what == offers beyond = -except that it will only work for numbers) |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 1:04 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/163 |
| Comment by Assembla Importer [ 24/Aug/10 1:04 PM ] |
|
laurentpetit said: [file:bH0XMCFjur3PLMeJe5aVNr] |
| Comment by Assembla Importer [ 24/Aug/10 1:04 PM ] |
|
richhickey said: I don't want to recommend, in = doc, that people should prefer == for any case. People should always prefer =. If there is a perf, difference we can make that go away. Then the only difference with == is that it will fail on non-numbers, and that should be the only reason to choose it. |
| Comment by Assembla Importer [ 24/Aug/10 1:04 PM ] |
|
richhickey said: Updating tickets (#94, #96, #104, #119, #163) |
| Comment by Assembla Importer [ 24/Aug/10 1:04 PM ] |
|
laurentpetit said: Richn, by "will fail on non-numbers", do you mean "should throw an exception" (and thus the patch must change the code), or just as it works today : (== :a :a) ? |
| Comment by Assembla Importer [ 24/Aug/10 1:04 PM ] |
|
richhickey said: I've fixed the code so == on non-numbers throws |
[CLJ-153] Suggest adding set-precision! API to accompany with-precision |