[CLJ-827] unsigned-bit-shift-right Created: 09/Aug/11 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Joe Gallo | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 12 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
Add a clojure equivalent of >>>. A simple version of this is implemented here (https://github.com/joegallo/clojure/tree/unsigned-bit-shift-right), and just follows the example set by shift-right. The downside of this implementation is that it treats all integer types as longs, and shifts them accordingly, which yields different results than you would get in java. A previous version of this did not have the same problem, when BitOps was its own thing. I'm not sure if this limitation is acceptable and appropriate, or needs to be worked around (my inclination is the latter). |
| Comments |
| Comment by Joe Gallo [ 11/Nov/11 12:58 PM ] |
|
I just realized (with the asssistance of Paul Stadig) that just doing only longs is probably sufficient, as you can get the integer version if you really want it: > (int (bit-and Integer/MAX_VALUE (unsigned-bit-shift-right -5 1))) Of course, that's less efficient than just doing it directly with java, but it's enough that I think my concern from the previous comment is addressed. |
| Comment by Tim McCormack [ 16/Jan/12 6:01 PM ] |
|
I have attached "0001-CLJ-827-Add-bit-shift-right-logical.patch", which implements a logical bit-shift-right using the same JVM bytecode as >>>. The patch mimics the implementations of << and >>. |
| Comment by Stuart Halloway [ 02/Feb/13 5:09 PM ] |
|
For context, this feature appears to be needed for Clojure-in-Clojure data structures: https://groups.google.com/d/msg/clojure-dev/iAwH7CLSFzE/6wzDH4RS1YQJ |
| Comment by Michał Marczyk [ 08/Feb/13 5:31 AM ] |
|
Just wanted to note that I've introduced this operation to ClojureScript when implementing PersistentHashMap. The name over there is bit-shift-right-zero-fill. Would it be alright for Clojure to use that name? Failing that, ClojureScript would probably have to change to match. |
[CLJ-322] Enhance AOT compilation process to emit classfiles only for explicitly-specified namespaces Created: 29/Apr/10 Updated: 12/Apr/13 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 12 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Waiting On: | Chas Emerick |
| Description |
|
This was originally/erroneously reported by Howard Lewis Ship in the clojure-contrib assembla: My build file specifies the namespaces to AOT compile but if I include another namespace (even from a JAR dependency) that is not AOT compiled, the other namespace will be compiled as well. In my case, I was using clojure-contrib's clojure.contrib.str-utils2 namespace, and I got a bunch of clojure/contrib/str_utils2 classes in my output directory. I think that the AOT compiler should NOT precompile any namespaces that are transitively reached, only namespaces in the set specified by the command line are appropriate. As currently coded, you will frequently find unwanted third-party dependencies in your output JARs; further, if multiple parties depend on the same JARs, this could cause bloating and duplication in the eventual runtime classpath. Having the option of shipping either all AOT-compiled classfiles or mixed source/AOT depending upon one's distribution requirements would make that phase of work with a clojure codebase significantly easier and less error-prone. The only question in my mind is what the default should be. We're all used to the current behaviour, but I'd guess that any nontrivial project where the form of the distributable matters (i.e. the source/AOT mix), providing as much control as possible by default makes the most sense. Given the tooling that most people are using, it's trivial (and common practice, IIUC) to provide a comprehensive list of namespaces one wishes to compile, so making that the default shouldn't be a hurdle to anyone. If an escape hatch is desired, a --transitive switch to clojure.lang.Compile could be added. |
| Comments |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/322 |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
hlship said: I'd like to reinforce this. I've been doing research on Clojure build tools for an upcoming talk and all of them (Maven, Leiningen, Gradle) have the same problem: the AOT compile extends from the desired namespaces (such as one containing a :gen-class) to every reached namespace. This is going to cause a real ugliness when application A uses libraries B and C that both depend on library D (such as clojure-contrib) and B and C are thus both bloated with duplicate, unwanted AOT compiled classes from the library D. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: This behaviour is an implementation detail of Clojure's AOT compilation process, and is orthogonal to any particular build tooling. I am working on a patch that would provide a mechanism for such tooling to disable this default behaviour. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: A first cut of a change to address this issue is here (caution, work in progress!): http://github.com/cemerick/clojure/commit/6f14e0790c0d283a7e44056adf1bb3f36bb16e0e This makes available a new recognized system property, clojure.compiler.transitive, which defaults to true. When set/bound to false (i.e. -Dclojure.compiler.transitive=false when using clojure.lang.Compile), only the first loaded file (either the ns named in the call to compile or each of the namespaces named as arguments to clojure.lang.Compile) will have classfiles written to disk. This means that this compilation invocation: java -cp <your classpath> -Dclojure.compiler.transitive=false clojure.lang.Compile com.bar com.baz
will generate classfiles only for com.bar and com.baz, but not for any of the namespaces or other files they load, require, or use. The only shortcoming of this WIP patch is that classfiles are still generated for proxy and gen-class classes defined outside of the explicitly-named namespaces. What I thought was a solution for this ended up breaking the loading of generated interfaces (as produced by defprotocol, etc). I'll take a second look at this before the end of the week, but wanted to get this out there so as to get any comments people might have. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
technomancy said: Looks good, but I'm having trouble getting it to work. I tried compiling from master of Chas's fork on github, but I still got the all the .class files generated with -Dclojure.compiler.transitive=false. It could be a quirk of the way I'm using ant to fork off processes though. Is it possible to set it using System/setProperty, or must it be given as a property on the command-line? |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: Bah, that's just bad documentation. :-/ The system property is only provided by clojure.lang.Compile; the value of it drives the binding of clojure.core/transitive-compile, which has a root binding of true. You should be able to configure the transitivity the same way you configure compile-path (system prop to clojure.lang.Compile or a direct binding when at the REPL, etc). If not, ping me in irc or elsewhere. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
meikelbrandmeyer said: I think, excluding parts 'load'ed is a little strong. I have some namespaces which load several parts from different files, but which belong to the same namespace. The most prominent example of such a case is clojure.core itself. I'm find with stopping require and use, but load is a bit too much, I'd say. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
technomancy said: Chas: Thanks; will give that a go. Meikel: Do people actually use load outside of clojure.core? I thought it was only used there because clojure.core is a "special" namespace where you want more vars to be available than can reasonably fit in a single file. Splitting up a namespace into several files is quite unadvisable otherwise. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
technomancy said: I can confirm that this works for me modulo the proxy/gen-class issue that Chas mentioned. I would love to see this in Clojure 1.2; it would really clean up a lot of build-related issues. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
meikelbrandmeyer said: I used it several times and this is the first time, I hear that it is unadvisable to do so. Even with a lower number of Vars in the namespace (c.c is here certainly exceptional) and might be of use to split several "sections" of code which belong to the same namespace but have different functionality. Whether to use a big comment in the source to indicate the section or split things into subfiles is a matter of taste. But it's a perfectly reasonable thing todo. Another use case, where I use this (and c.c.lazy-xml, IIRC) is to conditionally load code depending on whether a dependency is available or not. Eg. vimclojure uses c.c.pprint and c.c.stacktrace/clj-stacktrace transparently depending on their availability. There are perfectly legal uses of load. I don't see any "unadvisable" here. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: Thanks, Meikel; I had forgotten about that use case, as I don't use load directly myself at all. I probably wouldn't say it's inadvisable, just mostly unnecessary. In any case, that's a good catch. It complicates things a bit, but we'll see what happens. I'm going to take another whack at resolving the proxy/gen-class case and narrowing the impact of nontransitivity to use and require later tonight. I agree wholeheartedly that this should be in 1.2, assuming the technical bits work out. This has been an irritant for quite a long time. I actually believe that nontransitivity should be the default – no one wants or expects to have classfiles show up for dependencies show up when a project is AOT-compiled. I think the only negative impact would be whoever still fiddles with compilation at the REPL, and doesn't use maven or lein – and even then, it's just a matter of binding another var. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
meikelbrandmeyer said: Then the var should be added to the default bindings in the clojure.main repl. Then it's set!-able like the other vars ��� warn-on-reflection and friends. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: This is looking pretty good (still WIP): http://github.com/cemerick/clojure/commit/fedfb022ecef420a932b3d69c182ec7a8e5960a6 Thank you again for mentioning load, Meikel: it was very helpful in resolving the proxy/gen-class issue as well. Just a single data point: the jar produced by the medium-sized project I've been using for testing the changes has shrunk from 1.8MB to less than 1MB. That's not the only reason this is a good change, but it's certainly a nice side-effect. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: [file:aIWFiWHeGr35ImeJe5cbLA] |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: [file:aI7Eu-HeGr35ImeJe5cbLA] |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: Patched attached. The The user impact of changing the default would be:
|
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
hlship said: Just had a brain-storm: How about an option to support transitive compilation, but only if the Clojure source file being compiled as a file: URL (i.e., its a local file on the file system, not a file stored in a JAR). That would make it easier to use compilation on the local project without transitively compiling imported libraries, such as clojure-contrib. So transitive-compile should be a keyword, not a boolean, with values :all (for 1.1 behavior), :none (to compile only the exact specified namespaces) or :local (to compile transitively, but only for local files, not source files from JARs). |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
cemerick said: (Crossposted to the clojure-dev list) I thought about this some, and I don't think that's a good idea, at least for now. I'm uncomfortable with semantics changing depending upon where code is being loaded from – which, depending upon a tool's implementation, might be undefined. E.g. if the com.foo.bar ns is available in source form in one directory, but as classes from a jar, and classpaths aren't being constructed in a stable fashion, then the results of compilation will change. If we decide that special treatment depending upon the source of code is warranted in the future, that's a fairly straightforward thing to do w.r.t. the API – we could have :all and :local as you suggest, with nil representing :none. |
| Comment by Assembla Importer [ 28/Sep/10 12:18 AM ] |
|
stu said: Rich is not comfortable enough with the implementation complexity of this patch (e.g. the guard clause for proxies and gen-class) to slide this in as a minor fix under the wire for 1.2. Better to live with the pain we know a little longer than ship something we don't have enough experience with to be confident. |
| Comment by Chas Emerick [ 19/Nov/10 9:28 PM ] |
|
Updated patch to cleanly apply to HEAD and address issues raised by screening done by Cosmin Stejerean. Also includes proper tests. Note: this patch's tests require the fix for |
| Comment by Stuart Halloway [ 29/Nov/10 7:18 AM ] |
|
the "-resolved" patch resolves a conflict in main.clj |
| Comment by Stuart Halloway [ 29/Nov/10 7:25 AM ] |
|
Several questions:
|
| Comment by Stuart Sierra [ 10/Dec/10 3:34 PM ] |
|
An alternative approach: patch write-classes-1.diff.gz From my forked branch What this patch does:
This approach was prompted by the following observations:
|
| Comment by Chas Emerick [ 10/Dec/10 4:04 PM ] |
|
S. Halloway: My apologies, I didn't know you had commented. I thought that, having assigned this issue to myself, I'd be notified of updates. FWIW, I aim to review your comments and SS' approach over the weekend. |
| Comment by Chas Emerick [ 16/Dec/10 7:36 AM ] |
|
S. Halloway: 1. Certainly shouldn't happen. AFAIK, others have screened the patch, presumably with a successful build. |
| Comment by Chas Emerick [ 16/Dec/10 9:00 AM ] |
|
I think S. Sierra's approach is fundamentally superior what I offered. I have two suggestions: one slight perspective change (which implies no change in the actual implementation), and an idea for an even simpler approach (at least from a user perspective), in that order. While interop is the driving requirement behind AOT, I absolutely do not want to have to keep an updated enumeration of all of the classes resulting from each and every defrecord et al. usages in my pom.xml/project.clj (and I wouldn't wish the task of ferreting those usages and their resulting classnames on any build tool author). Right now, *compile-write-classes* is documented to be a set of classname strings, but could just as easily be any other function. *compile-write-classes* should be documented to accept any predicate function (renamed to e.g. *compile-write-class?*?). There's no reason why it shouldn't be bound to, e.g. #(re-matches #"foo\.bar\.[\w_]+$" %) if I know that all my records are defined in the foo.bar namespace. To go along with that, I think some package/classname-globbing utilities along with corresponding options to clojure.lang.Compile would be most welcome. Classname munging rules are not exactly obvious, and it'd be good to make things a little easier for users in this regard. Another alternativeIf there's a closed set of forms that generate classes that one might reasonably be interested in having in a build result (outside of use cases for pervasive AOT), then why not have a simple option that only those forms utilize? gen-class and gen-interface already do this, but reusing the all-or-nothing *compile-files* binding; if they keyed off of a binding that implied a diminished scope (e.g. *compile-interop-forms* – which would be true if *compile-files* were true), then they'd do exactly what we wanted. Extending this approach to deftype (and therefore defrecord) should be straightforward. An implementation of this would probably be somewhat more complicated than S. Sierra's patch, though not as complex as my original stab at the problem (i.e. no *load-level*). On the plus side: 1. No additional configuration for users or implementation work for build tool authors, aside from the addition of the boolean diminished-scope AOT option I can see wanting to further restrict AOT to specific classnames in certain circumstances, in which case the above and S. Sierra's patch might be complimentary. |
| Comment by Stuart Sierra [ 16/Dec/10 11:49 AM ] |
|
I like the idea of *compile-interop-forms*. But is it always possible to determine what an "interop form" is? I think it is, I'm just not sure. |
| Comment by Allen Rohner [ 09/Oct/11 12:50 PM ] |
|
I'm also in favor of compile-interop-forms. As far as determining, how about sticking metadata on the var? (defmacro ^{:interop-form true} deftype ...) |
| Comment by Stuart Sierra [ 21/Oct/11 8:38 AM ] |
|
Summary and design discussion on wiki at http://dev.clojure.org/display/design/Transitive+AOT+Compilation |
| Comment by Stuart Sierra [ 29/Nov/11 6:54 PM ] |
|
New attachment compile-interop-1.patch has new approach: Add a third possible value for *compile-files*. True and false keep their original meanings, but :interop causes only interop-related forms to be written out as .class files. "Interop forms" are gen-class, gen-interface, deftype, defrecord, defprotocol, and definterface. Pros:
Cons:
|
| Comment by Stuart Sierra [ 02/Dec/11 8:12 AM ] |
|
Just realized my patch doesn't solve the transitive compilation problem. If library A loads library B, then compiling interop forms in A will also emit interop .class files in B. |
| Comment by Paudi Moriarty [ 01/Jan/13 3:55 AM ] |
|
It's disappointing to see an important issue like this still unresolved after 2.5 years. This is a real pain for us. We have a large closed source project where shipping source is not an option. This forces us to manage the AOT'ing of dependencies due to the hard dependency on protocol interfaces introduced by transitive AOT compilation (see https://groups.google.com/forum/?fromgroups=#!topic/clojure-dev/r3A1JOIiwVU). |
| Comment by Andy Fingerhut [ 01/Jan/13 4:27 PM ] |
|
Paul, do you have a suggestion for which of the approaches described in comments here, or on the wiki page http://dev.clojure.org/display/design/Transitive+AOT+Compilation would be preferable solution for you? Or perhaps even a patch that implements your preferred approach? |
| Comment by Howard Lewis Ship [ 04/Jan/13 4:18 PM ] |
|
Andy, I'm now consulting with Paudi's organization, so I think I can speak for him (I'm now the default buildmeister). I like Stuart's :interop idea, but that is somewhat orthogonal to our needs. I return to what I would like; compilation would compile specific namespaces; dependencies of those namespaces would not be compiled. To be honest, I'm still a little hung up on the interop forms: especially defprotocol and friends; from a cursory glance, it appears that todays AOT compilation will compile the protocol into a Java class, then compile the namespace that references the protocol with the assumption that the protocol's Java class is available. When we use build rules to only package our namespace's class files into the output JAR, the code fails with a NoClassDefFoundError because the protocol really needs to be recompiled, at runtime compilation, into an in-memory Java class. Obviously, supporting this correctly will be a challenge; the compiled bytecode for our namespace would ideally: I can imagine any number of ways to juggle things to make this work, so I won't suggest a specific implementation. In the meantime, our workaround is to create a "stub" module as part of our build; it simply requires in the necessary namespaces (for example, org.clojure:core.cache); this forces an AOT compile of the dependencies and we have a special rule to package such dependencies in the stub module's output JAR. This may not be a scalable problem, and it is expensive to identify what 3rd party dependencies require this treatment. |
[CLJ-1125] Clojure can leak memory when used in a servlet container Created: 11/Dec/12 Updated: 13/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Toby Crawley | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 8 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
When used within a servlet container The issue comes from threads living beyond the lifetime of a I've attached a patch that does the following:
There is still the opportunity for memory leaks if agents or futures This patch has a small performance impact: its use of a try/finally Providing an automated test for this patch is difficult - I've tested The above is a condensation of: I'm happy to provide whatever feedback/work is needed to get this |
| Comments |
| Comment by Colin Jones [ 13/May/13 7:30 PM ] |
|
This patch works great for me to avoid OOM/PermGen crashes from classloaders being retained [mine is a non-servlet use case]. |
[CLJ-866] Provide a clojure.test function to run a single test case with fixtures Created: 27/Oct/11 Updated: 04/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Hugo Duncan | Assignee: | Anthony Grimes |
| Resolution: | Unresolved | Votes: | 8 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Incomplete |
| Description |
|
At present, clojure.test test cases are functions and can be invoked directly. However, in the case that the test relies on fixtures, this does not work. Please provide a function that can run a single test case with all fixtures applied. |
| Comments |
| Comment by Anthony Grimes [ 22/Oct/12 6:17 PM ] |
|
I just added clj-866-test-vars.patch (22/Oct/12 6:09PM). I had to implement this hackishly in Leiningen a few days ago, so I'm very excited to get this functionality in clojure.test itself. This patch adds a test-vars function that solves this problem (and is more general). You can test as many vars as you want with it, with fixtures. It works by grouping vars passed by their namespace and then running them all with appropriate fixtures applied. Being able to run a single test isn't the problem here, being able to run only specific tests is. If we wrote a function to run one test with fixtures but we actually needed to run several, just not all tests, we'd end up having to run once-fixtures more than once which is wasteful. I think test-vars is a good solution that solves both this problem and the one I just mentioned. |
| Comment by Alex Miller [ 04/May/13 9:36 AM ] |
|
This is highly useful. Could you add a test to the patch? |
[CLJ-865] Macroexpansion discards &form metadata Created: 26/Oct/11 Updated: 06/Jun/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 7 |
| Labels: | Compiler | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
As discussed in http://groups.google.com/group/clojure/browse_thread/thread/2690cb6ca0e8beb8 there is a "surprise factor" when type-hinting an expression that represents a macro, such as with (.length ^String (doto (identity "x") prn)). Here the doto macro discards the metadata on &form, causing a reflective lookup. This has the effect that while expressions representing function calls can be type-hinted, expressions representing macros in general cannot. The doto macro could be rewritten to respect its &form metadata, but doing this for every macro in existence would be tedious and error-prone. Instead, I propose a change to the compiler, to cause macroexpansion to hang onto the metadata automatically. The first patch attached adds a test for the behavior I propose: this test fails. After applying the second patch, the test passes. There are a couple points that merit further consideration before accepting my patch:
|
| Comments |
| Comment by Alan Malloy [ 28/Oct/11 1:12 AM ] |
|
So I went ahead and did the work of making this change in clojure.core/defmacro instead of clojure.lang.Compiler/macroexpand1. It was even worse than I expected: I didn't realize we don't yet have syntax-quote or apply at this stage in bootstrapping, so writing a non-trivial macroexpansion requires a huge amount of (list `foo (list `bar 'local-name)) and so forth. I'm sure the version I wrote is not optimal, but it seemed simpler to piggyback on defn, and then use alter-var-root to shim the metadata management in, than it would have been to expand to the correct thing in the first place. Anyway, attached patch #3 could be applied instead of #2 to resolve the issue in clojure.core instead of clojure.lang. The tests added in patch #1 pass either way. |
| Comment by Alan Malloy [ 13/Nov/11 8:29 PM ] |
|
I realized I can do this with a named private function instead of an anonymous function, reducing the amount of mess defmacro itself has to generate. Patch 4 is, I think, strictly better than Patch 3, if a Clojure implementation is preferred to one in Java. |
| Comment by Chouser [ 20/Nov/11 10:43 PM ] |
|
I prefer patch 0002 in Java over either 0003 or 0004. Patch 0002 keeps the knowledge of how to invoke macro fns (specifically the extra &form and &env args) in one place, macroexpand1 rather than duplicating that knowledge in core.clj as well. Note patch 0001 is just tests. The proposed default macroexpansion behavior is more useful than what we currently have, but there are two details I'd like to think about a bit more: 1) In exchange for a more useful default, macro writers lose the ability to consume their &form metadata and have control over the resulting form metadata without the &form metadata overridding it. That is, macros are no longer in complete control of their output form. 2) Rule (1) above has hardcoded exceptions for :line and :file, where &form metadata is unable to override the results returned by the macro. |
| Comment by Alan Malloy [ 01/Jun/12 2:04 PM ] |
|
This patch incorporates all previous patches to this issue. On the clj-dev mailing list, Andy Fingerhut suggested a new metadata key for allowing the macro author to specify "I've looked at their &form metadata, and this form is exactly what I want to expand to, please don't change the metadata any further." I've implemented this, and I think it addresses Chouser's concern about needing a way to "break out" of the improved-default behavior. One open question is, is :explicit-meta the right key to use? I spent some time tracking down a bug caused by my forgetting the keyword and using :explicit-metadata in my test; perhaps something more difficult to get confused by is available. |
[CLJ-873] Allow the function / to be referred to in namespaces other than clojure.core Created: 10/Nov/11 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.1, Release 1.2, Release 1.3, Release 1.4 |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Chris Gray | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 7 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Ok |
| Description |
|
The attached patch gives the programmer the option of referring to the division function in namespaces other than just clojure.core. For example, (ns foo The above lines do not compile without this patch. |
| Comments |
| Comment by Chris Gray [ 10/Nov/11 9:50 AM ] |
|
I have signed the CA and it is in the mail. |
| Comment by Chris Gray [ 20/Nov/11 6:21 PM ] |
|
My CA has now been applied. This patch is quite simple – can someone have a look at it please? |
| Comment by Alex Miller [ 09/Dec/11 9:34 AM ] |
|
FYI, I have run into this in actual code as well (implementing a query language function library). |
| Comment by Andy Fingerhut [ 24/Feb/12 8:00 PM ] |
|
clj-873-namespace-divides-patch.txt is same as Chris's, just updated to apply cleanly to latest master as of Feb 24, 2012. The test he added does fail without the code fix, and passes with it. He is now on the list of contributors. |
| Comment by Chris Gray [ 30/Mar/12 1:11 PM ] |
|
A short further discussion of this patch appeared here: http://groups.google.com/group/clojure-dev/browse_thread/thread/f095980802a82747/b723726c77c1ec64 Also, I assume this bug is what is referred to in Clojurescript's core.cljs, where it says ";; FIXME: waiting on cljs.core//" |
| Comment by Stuart Halloway [ 22/Oct/12 7:12 PM ] |
|
Thanks all. It is nice to have supporting real-world stories such as Alex's in the comments. |
| Comment by Andy Fingerhut [ 22/Oct/12 7:19 PM ] |
|
I should have added a comment here a while back if it would have helped, but David Nolen's |
| Comment by Brandon Bloom [ 02/Jan/13 12:49 AM ] |
|
This also affects a two of my libraries: 1) CSS generation library I'm working on, which wants to be able to do division with pixels and other units. 2) Factjor which defines binary math operators against a stack. |
[CLJ-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-863] interleave should accept 1 or 0 arguments Created: 24/Oct/11 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Joe Gallo | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 5 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Ok |
| Description |
|
interleave should handle 0 and 1 arguments in the same way that concat does (i.e., 0 args --> empty seq, 1 args --> identity). |
| Comments |
| Comment by Rich Hickey [ 15/Jun/12 9:31 AM ] |
|
(lazy-seq nil) should be () |
| Comment by Joe Gallo [ 15/Jun/12 10:13 AM ] |
|
Hey Rich, if you're talking about the first line of the diff: + ([] (lazy-seq nil)) Then that's the implementation, not the tests – given an empty vector of arguments, return (lazy-seq nil), which I just copied from the existing definition of concat. Cheers, |
| Comment by Marc Dzaebel [ 03/Oct/12 1:19 PM ] |
|
(defn interleave [& s] (apply mapcat list s)) |
| Comment by Matthew O. Smith [ 03/Oct/12 8:47 PM ] |
|
Marc's definition doesn't work for no arguments. Maybe: (defn interleave |
| Comment by Marc Dzaebel [ 05/Oct/12 1:07 PM ] |
|
Yes, but my solution is too slow, as it uses "apply". |
| Comment by Andy Fingerhut [ 01/Jan/13 11:54 AM ] |
|
Patch clj-863-make-interleave-handle-odd-args-like-concat-patch-v1.txt dated Jan 1 2013 is identical to Joe Gallo's 0001-make-interleave-handle-odd-arugments-in-the-same-man.patch patch dated Oct 24 2011, except it returns () instead of (lazy-seq nil) as per Rich's comment. If concat should also return () instead of (lazy-seq nil), perhaps another ticket should be created to fix that. Also presumptuously changing ticket state from Incomplete back to Vetted, since the reason it was marked Incomplete should now be addressed, and it was Screened before. |
[CLJ-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-1121] -> and ->> have unexpected behavior when combined with unusual macros Created: 06/Dec/12 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Gary Fredericks | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 4 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
|
My intuitive understanding of the classic threading macros is that the meaning of forms like (-> a b c) can be understood syntactically independent of the meaning of the symbols involved or the fact that the two threading macros are defined recursively. However the recursive definition breaks that expectation. After (macroexpand-1 (macroexpand-1 '(-> a b c))) => (c (-> a b)) c is now in control if it is a macro, and is now seeing the argument (-> a b) rather than (b a) as would be the case if we had written (c (b a)) originally. Admittedly I do not know of a realistic example where this is an important distinction (I noticed this when playing with a rather perverse use of ->> with macros from korma), but at the very least it means that the behavior of the threading macros isn't quite as easy to accurately explain as I thought it was. |
| Comments |
| Comment by Gary Fredericks [ 07/Dec/12 9:19 AM ] |
|
I just realized that my patch also implements CLJ-1086. |
| Comment by Stuart Halloway [ 22/Dec/12 9:48 AM ] |
|
Would be nice if tests also demonstrated that metadata is preserved correctly. |
| Comment by Gary Fredericks [ 26/Dec/12 8:16 PM ] |
|
New patch in response to stuarthalloway feedback. |
| Comment by Tim McCormack [ 09/Jan/13 6:47 PM ] |
|
This patch also prevents an infinite loop in the macroexpander when fed the following expression: (->> a b (->> c d)) Edit: Far simpler example. |
[CLJ-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-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-700] contains? broken for TransientMaps Created: 01/Jan/11 Updated: 28/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | Approved Backlog |
| Type: | Defect | Priority: | Major |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
(contains? (transient {:x "fine"}) :x)
also (contains? (transient (hash-map :x "fine")) :x)
|
| Comments |
| Comment by Herwig Hochleitner [ 01/Jan/11 8:01 PM ] |
|
the same is also true for TransientVectors {{(contains? (transient [1 2 3]) 0)}}
|
| Comment by Herwig Hochleitner [ 01/Jan/11 8:25 PM ] |
|
As expected, TransientSets have the same issue; plus an additional, probably related one. (:x (transient #{:x}))
(get (transient #{:x}) :x)
|
| Comment by Alexander Redington [ 07/Jan/11 2:07 PM ] |
|
This is caused by expectations in clojure.lang.RT regarding the type of collections for some methods, e.g. contains() and getFrom(). Checking for contains looks to see if the instance passed in is Associative (a subinterface of PersistentCollection), or IPersistentSet. This patch refactors several of the Clojure interfaces so that logic abstract from the issue of immutability is pulled out to a general interface (e.g. ISet, IAssociative), but preserves the contract specified (e.g. Associatives only return Associatives when calling assoc()). With more general interfaces in place the contains() and getFrom() methods were then altered to conditionally use the general interfaces which are agnostic of persistence vs. transience. Includes tests in transients.clj to verify the changes fix this problem. |
| Comment by Stuart Halloway [ 28/Jan/11 10:35 AM ] |
|
Rich: Patch doesn't currently apply, but I would like to get your take on approach here. In particular:
|
| Comment by Alexander Redington [ 25/Mar/11 7:44 AM ] |
|
Rebased the patch off the latest pull of master as of 3/25/2011, it should apply cleanly now. |
| Comment by Stuart Sierra [ 17/Feb/12 2:59 PM ] |
|
Latest patch does not apply as of f5bcf647 |
| Comment by Andy Fingerhut [ 17/Feb/12 5:59 PM ] |
|
clj-700-patch2.txt does patch cleanly to latest Clojure head as of a few mins ago. No changes to patch except in context around changed lines. |
| Comment by Andy Fingerhut [ 07/Mar/12 3:23 AM ] |
|
Sigh. Git patches applied via 'git am' are fragile beasts indeed. Look at them the wrong way and they fail to apply. clj-700-patch3.txt applies cleanly to latest master as of Mar 7, 2012, but not if you use this command: git am -s < clj-700-patch3.txt I am pretty sure this is because of DOS CR/LF line endings in the file src/jvm/clojure/lang/Associative.java. The patch does apply cleanly if you use this command: git am --keep-cr -s < clj-700-patch3.txt |
| Comment by Andy Fingerhut [ 23/Mar/12 6:34 PM ] |
|
This ticket was changed to Incomplete and waiting on Rich when Stuart Halloway asked for feedback on the approach on 28/Jan/2011. Stuart Sierra changed it to not waiting on Rich on 17/Feb/2012 when he noted the patch didn't apply cleanly. Latest patch clj-700-patch3.txt does apply cleanly, but doesn't change the approach used since the time Stuart Halloway's concern was raised. Should it be marked as waiting on Rich again? Something else? |
| Comment by Stuart Halloway [ 08/Jun/12 12:44 PM ] |
|
Patch 4 incorporates patch 3, and brings it up to date on hashing (i.e. uses hasheq). |
| Comment by Andy Fingerhut [ 08/Jun/12 12:52 PM ] |
|
Removed clj-700-patch3.txt in favor of Stuart Halloway's improved clj-700-patch4.txt dated June 8, 2012. |
| Comment by Andy Fingerhut [ 18/Jun/12 3:06 PM ] |
|
clj-700-patch5.txt dated June 18, 2012 is the same as Stuart Halloway's clj-700-patch4.txt, except for context lines that have changed in Clojure master since Stuart's patch was created. clj-700-patch4.txt no longer applies cleanly. |
| Comment by Andy Fingerhut [ 19/Aug/12 4:47 AM ] |
|
Adding clj-700-patch6.txt, which is identical to Stuart Halloway's clj-700-patch4.txt, except that it applies cleanly to latest master as of Aug 19, 2012. Note that as described above, you must use the --keep-cr option to 'git am' when applying this patch for it to succeed. Removing clj-700-patch5.txt, since it no longer applies cleanly. |
| Comment by Stuart Sierra [ 24/Aug/12 1:08 PM ] |
|
Patch fails as of commit 1c8eb16a14ce5daefef1df68d2f6b1f143003140 |
| Comment by Andy Fingerhut [ 24/Aug/12 1:53 PM ] |
|
Which patch did you try, and what command did you use? I tried applying clj-700-patch6.txt to the same commit, using the following command, and it applied, albeit with the warning messages shown: % git am --keep-cr -s < clj-700-patch6.txt Note the --keep-cr option, which is necessary for this patch to succeed. It is recommended in the "Screening Tickets" section of the JIRA workflow wiki page here: http://dev.clojure.org/display/design/JIRA+workflow |
| Comment by Andy Fingerhut [ 28/Aug/12 5:48 PM ] |
|
Presumptuously changing Approval from Incomplete back to None, since the latest patch does apply cleanly if the --keep-cr option is used. It was in Screened state recently, but I'm not so presumptuous as to change it to Screened |
[CLJ-124] GC Issue 120: Determine mechanism for controlling automatic shutdown of Agents, with a default policy and mechanism for changing that policy as needed Created: 17/Jun/09 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Chas Emerick |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Approval: | Vetted |
| Waiting On: | Rich Hickey |
| Description |
Reported by cemer...@snowtide.com, Jun 01, 2009 There has been intermittent chatter over the past months from a couple of people on the group (e.g. http://groups.google.com/group/clojure/browse_thread/thread/409054e3542adc1f) and in #clojure about some clojure scripts hanging, either for a constant time (usually reported as a minute or so with no CPU util) or seemingly forever (or until someone kills the process). I just hit a similar situation in our compilation process, which invokes clojure.lang.Compile from ant. The build process for this particular project had taken 15 second or so, but after adding a couple of pmap calls, that build time jumped to ~1:15, with roughly zero CPU utilization over the course of that last minute. Adding a call to Agent.shutdown() in the finally block in clojure.lang.Compile/main resolved the problem; a patch including this change is attached. I wouldn't suspect anyone would have any issues with such a change. ----- In general, it doesn't seem like everyone should keep tripping over this problem in different directions. It's a very difficult thing to debug if you're not attuned to how clojure's concurrency primitives work under the hood, and I would bet that newer users would be particularly affected. After discussion in #clojure, rhickey suggested adding a *auto-shutdown-agents* var, which: - if true when exiting one of the main entry points (clojure.main, or the legacy script/repl entry points), Agent.shutdown() would be called, allowing for the clean exit of the application - would be bound by default to true - could be easily set to false for anyone with an advanced use-case that requires agents to remain active after the main thread of the application exits. This would obviously not help anyone initializing clojure from a different entry point, but this may represent the best compromise between least-surprise and maximal functionality for advanced users. ------ In addition to the above, it perhaps might be worthwhile to change the keepalive values used to create the Threadpools used by c.l.Actor's Executors. Currently, Actor uses a default thread pool executor, which results in a 60s keepalive. Lowering this to something much smaller (1s? 5s?) would additionally minimize the impact of Agent's threadpools on Java applications that embed clojure directly (and would therefore not benefit from *auto-shutdown-agents* as currently conceived, leading to puzzling 'hanging' behaviour). I'm not in a position to determine what impact this would have on performance due to thread churn, but it would at least minimize what would be perceived as undesirable behaviour by users that are less familiar with the implementation details of Agent and code that depends on it. Comment 1 by cemer...@snowtide.com, Jun 01, 2009 Just FYI, I'd be happy to provide patches for either of the suggestions mentioned above... |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/124 |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
oranenj said: [file:a56S2ow4ur3O2PeJe5afGb] |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
richhickey said: Updating tickets (#8, #19, #30, #31, #126, #17, #42, #47, #50, #61, #64, #69, #71, #77, #79, #84, #87, #89, #96, #99, #103, #107, #112, #113, #114, #115, #118, #119, #121, #122, #124) |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
cemerick said: (In [[r:fa3d24973fc415b35ae6ec8d84b61ace76bd4133]]) Add a call to Agent.shutdown() at the end of clojure.lang.Compile/main Refs #124 Signed-off-by: Chouser <chouser@n01se.net> Branch: master |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: I'm closing this ticket to because the attached patch solves a specific problem. I agree that the idea of an auto-shutdown-agents var sounds like a positive compromise. If Rich wants a ticket to track that issue, I think it'd be best to open a new ticket (and perhaps mention this one there) rather than use this ticket to track further changes. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
scgilardi said: With both Java 5 and Java 6 on Mac OS X 10.5 Leopard I'm getting an error when compiling with this change present. Java 1.5.0_19 For example, when building clojure using "ant" from within my clone of the clojure repo: [java] java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThread) I reproduced this on two Mac OS X 10.5 machines. I'm not aware of having any enhanced security policies along these lines on my machines. The compile goes fine for me with Java 1.6.0_0 on an Ubuntu box. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: I had only tested it on my ubuntu box – looks like that was openjdk 1.6.0_0. I'll test again with sun-java5 and sun-java6. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: 1.6.0_13 worked fine for me on ubuntu, but 1.5.0_18 generated an the exception Steve pasted. Any suggestions? Should this patch be backed out until someone has a fix? |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
achimpassen said: [file:aqn0IGxZSr3RUGeJe5aVNr] |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: With Achim's patch, clojure compiles for me on ubuntu using java 1.5.0_18 from sun, and still works on 1.6.0_13 sun and 1.6.0_0 openjdk. I don't know anything about ant or the security error, but this is looking good to me. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
achimpassen said: It works for me on 1.6.0_13 and 1.5.0_19 (32 and 64 bit) on OS X 10.5.7. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: (In [[r:895b39dabc17b3fd766fdbac3b0757edb0d4b60d]]) Rev fa3d2497 causes compile to fail on some VMs – back it out. Refs #124 Branch: master |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
mikehinchey said: I got the same compile error on both 1.5.0_11 and 1.6.0_14 on Windows. Achim's patch fixes both. See the note for "permissions" on http://ant.apache.org/manual/CoreTasks/java.html . I assume ThreadPoolExecutor.shutdown is the problem, it would shutdown the main Ant thread, so Ant disallows that. Forking avoids the permissions limitation. In addition, since the build error still resulted in "BUILD SUCCESSFUL", I think failonerror="true" should also be added to the java call so the build would totally fail for such an error. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
chouser@n01se.net said: I don't know if the <java fork=true> patch is a good idea or not, or if there's a better way to solve the original problem. Chas, I'm kicking back to you, but I guess if you don't want it you can reassign to "nobody". |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
richhickey said: Updating tickets (#8, #42, #113, #2, #20, #94, #96, #104, #119, #124, #127, #149, #162) |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
shoover said: I'd like to suggest an alternate approach. There are already well-defined and intuitive ways to block on agents and futures. Why not deprecate shutdown-agents and force users to call await and deref if they really want to block? In the pmap situation one would have to evaluate the pmap form. The System.exit problem goes away if you configure the threadpools to use daemon threads (call new ThreadPoolExecutor and pass a thread factory that creates threads and sets daemon to true). That way the user has an explicit means of blocking and System.exit won't hang. |
| Comment by Assembla Importer [ 24/Aug/10 12:45 AM ] |
|
alexdmiller said: I blogged about these issues at: I think that:
|
| Comment by Alexander Taggart [ 11/Jul/11 9:33 PM ] |
|
Rich, what is the intention behind using non-daemon threads in the agent pools? If it is because daemon threads could terminate before their work is complete, would it be acceptable to add a shutdown hook to ensure against such premature termination? Such a shutdown hook could call Agent.shutdown(), then awaitTermination() on the pools. |
| Comment by Christopher Redinger [ 27/Nov/12 3:47 PM ] |
|
Moving this ticket out of approval "OK" status, and dropping the priority. These were Assembla import defaults. Also, Chas gets to be the Reporter now. |
| Comment by Chas Emerick [ 27/Nov/12 5:56 PM ] |
|
Heh, blast from the past. The comment import appears to have set their timestamps to the date of the import, so the conversation is pretty hard to follow, and obviously doesn't benefit from the intervening years of experience. In addition, there have been plenty of changes to agents, including some recent enhancements that address some of the pain points that Alex Miller mentioned above. I propose closing this as 'invalid' or whatever, and opening one or more new issues to track whatever issues still persist (presumably based on fresh ML discussion, etc). |
| Comment by Andy Fingerhut [ 27/Nov/12 6:11 PM ] |
|
Rereading the original description of this ticket, without reading all of the comments that follow, that description is still right on target for the behavior of latest Clojure master today. People send messages to the Clojure Google group every couple of months hitting this issue, and one even filed CLJ-959 because of hitting it. I have updated the examples on ClojureDocs.org for future, and also for pmap and clojure.java.shell/sh which use future in their implementations, to warn people about this and explain that they should call (shutdown-agents), but making it unnecessary to call shutdown-agents would be even better, at least as the default behavior. It sounds fine to me to provide a way for experts on thread behavior to change that default behavior if they need to. |
[CLJ-1200] RestFn & ArraySeq performance Created: 14/Apr/13 Updated: 18/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | patch | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
I was profiling one of my projects and noticed a hotspot inside functions using rest arguments. Most overloads of RestFn.invoke will construct an ArraySeq object. The ArraySeq constructor calls java.lang.Class.getComponentType, which seems to be pretty slow. The array's component type is cached in a field on the ArraySeq object for the sole purpose of passing it to Reflector.prepRet. I'm not entirely sure of the total utility of prepRet, but it's clearly a no-op when passed Object.class, such as the case with the non-specialized base class of ArraySeq: the component type of object[] is Object.class. The attached patch eliminates the component type field from ArraySeq and passes Object.class to prepRet directly. It may be possible to eliminate calls to prepRet all together, but I'll assume that's a different ticket. With this patch, ArraySeq initialization no longer shows up as a hotspot when profiling. Before the patch: user=> (dotimes [n 10] (time (dotimes [i 5000000] ((fn [& args]) 1 2 3 4)))) "Elapsed time: 874.742 msecs" "Elapsed time: 900.277 msecs" "Elapsed time: 911.164 msecs" "Elapsed time: 872.132 msecs" "Elapsed time: 885.495 msecs" "Elapsed time: 897.537 msecs" "Elapsed time: 879.691 msecs" "Elapsed time: 888.52 msecs" "Elapsed time: 871.556 msecs" "Elapsed time: 1088.682 msecs" After the patch: user=> (dotimes [n 10] (time (dotimes [i 5000000] ((fn [& args]) 1 2 3 4)))) "Elapsed time: 628.144 msecs" "Elapsed time: 634.163 msecs" "Elapsed time: 617.397 msecs" "Elapsed time: 622.714 msecs" "Elapsed time: 646.743 msecs" "Elapsed time: 648.708 msecs" "Elapsed time: 629.223 msecs" "Elapsed time: 638.058 msecs" "Elapsed time: 725.473 msecs" "Elapsed time: 636.909 msecs" That's about a 30% reduction in execution time. Granted it only represents a change of 52 nanoseconds per RestFn invoke (181 ns to 129 ns), but this actually was a pretty decent win for a library that makes makes almost exclusively variadic function calls in a tight loop. |
[CLJ-1175] NPE in clojure.lang.Delay/deref Created: 06/Mar/13 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
|
If a Delay wraps a function which throws an exception, then forcing that delay multiple times causes behavior which is, to me at least, surprising and unexpected: the first time it is forced, the expected exception is thrown; but after that it will behave as if all locals the expression refers to are nil. This can manifest in multiple ways, depending on the expression being delayed: ;; calling a local as a function causes an NPE inside clojure.lang.Delay (let [f #(/ 1 0) d (delay (f))] [(try (force d) (catch Exception e e)) (try (force d) (catch Exception e e))]) [#<ArithmeticException java.lang.ArithmeticException: Divide by zero> #<NullPointerException java.lang.NullPointerException>] ;; if nil is a valid value, this can cause subsequent forces to "succeed" ;; even though the first fails as it should (let [x (java.util.Date.) d (delay (seq x))] [(try (force d) (catch Exception e e)) (try (force d) (catch Exception e e))]) [#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.util.Date> nil] The reason for this is that clojure.core/delay creates a ^:once function, promising to call it only once, so that the compiler can do locals-clearing on its lexical closure. However, when an exception is thrown the Delay object is left thinking it has never called the function, so when it is forced again it calls the function again, breaking its promise to the compiler and causing the function to run after its locals have been cleared. In fact, once we realize that locals-clearing is involved, we can make the delay behave differently the first N times it is forced, instead of only the first time, by constructing an expression which throws an exception before using all of its locals: (let [x (java.util.Date.)
y (Long. 1)
d (delay (let [y (seq y)]
(cons (seq x) y)))]
[(try (force d)
(catch Exception e e))
(try (force d)
(catch Exception e e))
(try (force d)
(catch Exception e e))])
[#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.util.Date>
(nil)]
I'm not sure what the right fix for this issue is: perhaps the best choice is even to leave it alone, and just document that delay's behavior is undefined if the expression throws an exception. However, I propose making the Delay remember the first exception that was thrown, and rethrow it on subsequent force attempts. This makes sense, in a way: the "result" of the expression was this exception e being thrown, and so this should happen every time. It might be preferable to have the Delay retry the expression until it succeeds, but I don't believe this is possible without abandoning locals-clearing, which would cause perfectly-valid delays to now run out of memory, holding onto no-longer-needed locals just in case the expression needs to retry at some later date. So I've attached a patch that causes Delay to rethrow the original exception, and a test for that behavior, which of course fails if the change to Delay is not made. |
[CLJ-896] Make browse-url aware of xdg-open Created: 13/Dec/11 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Jasper Lievisse Adriaanse | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Environment: |
All platforms that provide xdg-open (as part of freedesktop.org) benefit from this. Fix was tested on OpenBSD. |
||
| Attachments: |
|
| Patch: | Code |
| Approval: | Ok |
| Waiting On: | Rich Hickey |
| Description |
|
clojure.java.browse/browse-url tests to see if it's running on Mac OS to fall back to "/usr/bin/open" in order |
| Comments |
| Comment by Andy Fingerhut [ 28/Feb/12 6:19 PM ] |
|
|
| Comment by Andy Fingerhut [ 29/Feb/12 1:18 PM ] |
|
clj-896-browse-url-uses-xdg-open-patch2.txt is based more on the patch attached to I think this patch improves on both of the previous patches for CLJ-896 and Tested on: Mac OS X 10.6.8 It would be great if someone could test it on a BSD system. The only possible issue I can think of is whether the output of the "which" command is different there than on the Linux system I tested. If someone wants to make a patch that doesn't use "which", but instead checks the PATH, I'd recommend they also test on Windows in cmd.exe to make sure it works correctly there. |
| Comment by Stuart Sierra [ 09/Nov/12 9:04 AM ] |
|
Screened. Verified on Mac OS X. |
| Comment by Jasper Lievisse Adriaanse [ 09/Nov/12 9:41 AM ] |
|
And I've tested it on OpenBSD. |
[CLJ-891] make (symbol foo "bar") work with foo being a namespace Created: 05/Dec/11 Updated: 02/Mar/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Reviewed Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Joe Gallo | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
I've run across the need to do (symbol ns "bar") a few times, and the existing approach (symbol (name (ns-name ns)) "bar") just doesn't seem like it ought to be the only way to do the job. Includes a patch to make this work, by adding a new arity to Symbol.intern(). Some discussion on this idea, here: https://groups.google.com/forum/#!topic/clojure/n25aZ5HA7hc/discussion |
| Comments |
| Comment by Stuart Halloway [ 09/Dec/11 9:39 AM ] |
|
I am not sure I like this, but I would like a rethink of names and namespaces. Doing a lot of cross language work, it would be great to have protocols for "I have a name" and for "I have a namespace". With such protocols in place, it would also be possible to separately consider implementing symbol et al in terms of them. |
| Comment by Kevin Downey [ 09/Dec/11 12:24 PM ] |
|
Named being a protocol or an interface seems orthogonal to being able to create a symbol qualified with a namespace when you have a namespace in hand. I don't think the patch goes far enough, not only should (symbol ns "foo") be supported, but also (symbol ns 'foo), given that (symbol 'foo) works and (symbol "foo") works, (symbol 'bar 'foo) should also work, but doesn't. if Named is a protocol, and if you extend it to String, and if you make the symbol function create symbols from one or two Named things you still end up having to do (symbol (ns-name ns) 'foo) or (symbol (ns-name ns) "foo") |
| Comment by Joe Gallo [ 16/Dec/11 4:18 PM ] |
|
Stuart, I'm not opposed to the idea of separate protocols for Named and Namespaced. Where should I go about creating a proposal to create those protocols and get them into clojure? I'm interested in doing the leg-work, or being a part of it. But as an outsider, I don't know what to do next – creating a ticket in Jira exhausted my knowledge of the process. |
| Comment by Frank Siebenlist [ 02/Mar/12 4:53 PM ] |
|
The same enhancement that joe suggests for symbol, would also apply to keyword. See: http://groups.google.com/group/clojure/browse_thread/thread/222e4abc16df8b20 Probably same/similar solution applies to both issues. -FrankS. |
[CLJ-766] Implicit casting behaviour of into-array differs from <primitive>-array Created: 01/Apr/11 Updated: 03/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Alexander Taggart | Assignee: | Karsten Schmidt |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Incomplete |
| Description |
|
Current patch: byte-short-array-ctors.diff The behavior of byte-array and short-array is inconsistent with the other <type>-array functions and with the into-array function when invoked with types other than byte or short. All of the other cases upcast to Number, then extract the primitive value, allowing this operation to succeed (assuming the value is in range). byte-array and short-array throw a ClassCastException. Example: base64v3a=> (into-array Byte/TYPE [1 2 3 4]) ;; int to byte ok #<byte[] [B@5ee04fd> base64v3a=> (byte-array [1 2 3 4]) ;; int to byte NOT ok!! ClassCastException java.lang.Long cannot be cast to java.lang.Byte clojure.lang.Numbers.byte_array (Numbers.java:1418) base64v3a=> (long-array [1 2 3 4]) ;; int to long ok #<long[] [J@3f9f4d1d> into-array (via RT.seqToTypedArray) and the other <type>-array functions all upcast to Number (via Numbers.<type>_array}}), then obtain the proper primitive value. Numbers.byte-array and Numbers.short-array do casts directly to Byte and Short (yielding the ClassCastException). The attached patch makes the Byte and Short cases match the other types and the into-array behavior. Tests are included. The submitter is a contributor. |
| Comments |
| Comment by Alexander Taggart [ 02/Apr/11 2:04 PM ] |
|
See |
| Comment by Andy Fingerhut [ 28/May/12 6:45 PM ] |
|
Some more details from Alexandar Taggart: This is not a duplicate of |
| Comment by Karsten Schmidt [ 02/Mar/13 5:11 PM ] |
|
I'd like to bump up this issue, since it'd be great if all the (xxx-array) factory functions have the same expected behavior (i.e. not throw an exception, especially not if the values are in range). The attached patch is changing the behaviour for byte-array & short-array to the same pattern used as for int/long/float/double and therefore will not throw an exception for valid (even if overflown) numbers. You can find more discussion in this thread on: https://groups.google.com/forum/?hl=en&fromgroups=#!topic/clojure/KyQrbph-zqo |
| Comment by Andy Fingerhut [ 03/Mar/13 8:11 AM ] |
|
Voting on a ticket (click the "Vote" link under the "People" heading while viewing the ticket on JIRA) may help draw attention to it, too. |
| Comment by Andy Fingerhut [ 04/Mar/13 1:08 PM ] |
|
Karsten, patches should be in the format created by the "git format-patch" command as described in the instructions under the heading "Development" on this page: http://dev.clojure.org/display/design/JIRA+workflow |
| Comment by Karsten Schmidt [ 04/Mar/13 2:05 PM ] |
|
Sorry Andy, I used Atlassian SourceTree to create the patch and assumed it's in standard git format... I've removed the old one and attach a (hopefully) properly formatted one. Apologies, contributing-beginners-luck! |
| Comment by Stuart Halloway [ 30/Mar/13 8:52 AM ] |
|
While investigating this, I noticed that long-array coerces across type, e.g. (seq (long-array [1.0])) => (1) Is this what we want? I don't think so. |
| Comment by Stuart Halloway [ 30/Mar/13 8:53 AM ] |
|
I agree that all the numeric array constructors should work the same way, but I am not sue we should adopt long-array's approach, which allows coercion from float to integer types. |
| Comment by Alex Miller [ 03/May/13 8:31 PM ] |
|
I think the patch approach is valid. However, the patch does not cover the same problem in the 2-arity version of byte_array and short_array (when a size is supplied). Please update the patch to include a fix in the 2-arity version of byte_array and short_array and tests for the same. Ex: (byte-array 1 [1]). Also, there is a whitespace issue in the patch - please just use spaces! /Users/alex/work/code/clojure/.git/rebase-apply/patch:24: space before tab in indent. ret[i] = ((Number)s.first()).byteValue(); warning: 1 line adds whitespace errors. Re Stuart's comments, I don't think that's in the scope of this ticket or solution. |
| Comment by Alex Miller [ 03/May/13 8:32 PM ] |
|
Sending back to Karsten for the requested patch updates. |
[CLJ-308] protocol-ize with-open Created: 21/Apr/10 Updated: 13/Apr/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Good use (and documentation example) of protocols: make with-open aware of a Closable protocol for APIs that use a different close convention. See http://groups.google.com/group/clojure/browse_thread/thread/86c87e1fc4b1347c |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 4:39 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/308 |
| Comment by Tassilo Horn [ 23/Dec/11 5:11 AM ] |
|
Added a CloseableResource protocol and extended it on java.io.Closeable (implemented by all Readers, Writers, Streams, Channels, Sockets). Use it in with-open. All tests pass. |
| Comment by Tassilo Horn [ 23/Dec/11 7:14 AM ] |
|
Seems to be related to Scopes (http://dev.clojure.org/jira/browse/CLJ-2). |
| Comment by Tassilo Horn [ 08/Mar/12 3:59 AM ] |
|
Updated patch. |
| Comment by Andy Fingerhut [ 02/Apr/12 12:11 PM ] |
|
Patch 0001-Added-ClosableResource-protocol-for-with-open.patch dated 08/Mar/12 applies, builds, and tests cleanly on latest master as of Apr 2 2012. Tassilo has signed a CA. |
| Comment by Tassilo Horn [ 13/Apr/12 11:23 AM ] |
|
Updated patch to apply cleanly against master again. |
[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-1093] Empty record literals gets incorrectly evaluated to array-maps Created: 24/Oct/12 Updated: 13/Mar/13 |
|
| Status: | Reopened |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Nicola Mometto | Assignee: | Timothy Baldridge |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
before patch: after patch: |
| Comments |
| Comment by Timothy Baldridge [ 27/Nov/12 11:41 AM ] |
|
Unable to reproduce this bug on latest version of master. Most likely fixed by some of the recent changes to data literal readers. Marking Not-Approved. |
| Comment by Timothy Baldridge [ 27/Nov/12 11:41 AM ] |
|
Could not reproduce in master. |
| Comment by Nicola Mometto [ 01/Mar/13 1:23 PM ] |
|
I just checked, and the problem still exists for records with no arguments: Clojure 1.6.0-master-SNAPSHOT Admittedly it's an edge case and I see little usage for no-arguments records, but I think it should be addressed aswell since the current behaviour is not what one would expect |
| Comment by Herwig Hochleitner [ 02/Mar/13 8:14 AM ] |
|
Got the following REPL interaction: % java -jar ~/.m2/repository/org/clojure/clojure/1.5.0/clojure-1.5.0.jar
user=> (defrecord a [])
user.a
user=> (a.)
#user.a{}
user=> #user.a{}
{}
#user.a[]
{}
This should be reopened or declined for another reason than reproducability. |
| Comment by Nicola Mometto [ 10/Mar/13 2:18 PM ] |
|
I'm reopening this since the bug is still there. |
| Comment by Andy Fingerhut [ 13/Mar/13 2:04 PM ] |
|
Patch clj-1093-fix-empty-record-literal-patch-v2.txt dated Mar 13, 2013 is identical to Bronsa's patch 001-fix-empty-record-literal.patch dated Oct 24, 2012, except that it applies cleanly to latest master. I'm not sure why the older patch doesn't but git doesn't like something about it. |
[CLJ-944] (.containsKey {:one 1} :one) throws Exception Created: 04/Mar/12 Updated: 13/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3, Release 1.4, Release 1.5 |
| Fix Version/s: | Release 1.5, Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Alf Kristian Støyle | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
Clojure 1.3 om Mac OS 10.7, Clojure 1.5.0 alpha1 on Linux x86_64 (OpenJDK 1.7.0 b147) |
||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
Patch clj944-plus-tests does three things:
Hi guys, I am getting the following exception: (.containsKey {:one 1} :one)
;=> ClassCastException clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.PersistentHashMap
The map is a clojure.lang.PersistentArrayMap, which obviously has a containsKey method (https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentArrayMap.java#L95). Casting it works fine though: (.containsKey ^clojure.lang.PersistentArrayMap {:one 1} :one)
;=> true
The mailing list suggest that the compiler injects an incorrect cast to clojure.lang.PersistentHashMap. In this case it should probably be cast to a clojure.lang.Associative, the highest common interface having the .containsKey method. The problem is not present in Clojure 1.2.1. |
| Comments |
| Comment by Nicola Mometto [ 30/Oct/12 5:02 PM ] |
|
The attached patch fixes the issue, by emitting IPersistentMap instead of Persistent{Hash|Array}Map as class type for maps literals |
| Comment by Nicola Mometto [ 01/Nov/12 3:48 PM ] |
|
I uploaded another patch fixing the same problem in a different way. This approach is more consistent, making the type of the compiler's internal representation of a map literal equal to the one of the reader. Note that this second approach while being more consistent, breaks some tests that assume some operations on maps (specifically `seq` and `print`) to be order dependent, and written with the hash-map return order implementation in mind. That should not be the case and if the second patch is preferred over the first one, I'll gladly fix those tests. |
| Comment by Stuart Halloway [ 01/Mar/13 12:09 PM ] |
|
Approach #2, relying on consistent choice of concrete map class by size throughout, feels quite fragile. Approach #1 seems to abuse the method name getJavaClass(), now having it return "get the base type I would need for cast". Maybe there needs to be a different thing entirely? |
| Comment by Nicola Mometto [ 01/Mar/13 2:17 PM ] |
|
Patch #2 should get merged (IMHO) regardless of the fragility of its approach to fixing this ticket's bug, since it fixes another bug: prior to the patch: user=> (class {:a 1}) after the patch: user=> (class {:a 1}) This should also lead to some minor performance enhancement since prior to this moment, every map def'ed would be a HashMap instead of an ArrayMap So, I think patch #2 should be applied if not for this ticket's bug, at least for the reason stated above. |
| Comment by Rich Hickey [ 13/Apr/13 9:41 AM ] |
|
This should not have passed screening. There are two issues, should be separate. I have no idea what has been screened nor what will be applied should it be approved. There's contention in the discussion but no resolution. |
| Comment by Nicola Mometto [ 13/Apr/13 12:06 PM ] |
|
I don't think that there are two issues here. The underlying cause of those two symtoms is fixed by the patch 002 that i submitted (incorporated in Stu's clj944-plus-tests patch. Stuart said that this approach feels fragile but the bug is caused by the fact that everywhere else clojure returns a PersistentArrayMap when the element count is <= than the PersistentHashMap threshold, and when emitting maps, it doesn't. Making clojure emit maps consistently with how clojure does internally everywhere else looks to me like the only solution, and I don't really see how making clojure consistent is a fragile approach. But again, if somebody can suggest a better solution to this problem, I'll gladly submit another patch. |
[CLJ-850] Hinting the arg vector of a primitive-taking fn with a non-primitive type results in AbstractMethodError when invoked Created: 09/Oct/11 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Major |
| Reporter: | Alexander Taggart | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Vetted |
| Description |
|
See the following examples: user=> (defn f1 ^String [^String s] s) #'user/f1 user=> (f1 "foo") "foo" user=> (defn f2 ^long [^String s ^long i] i) #'user/f2 user=> (f2 "foo" 1) 1 user=> (defn f3 ^String [^String s ^long i] s) #'user/f3 user=> (f3 "foo" 1) AbstractMethodError user$f3.invokePrim(Ljava/lang/Object;J)Ljava/lang/Object; user/eval8 (NO_SOURCE_FILE:6) |
| Comments |
| Comment by Ben Smith-Mannschott [ 15/Oct/11 11:54 AM ] |
|
CLJ-850-test.patch added. |
| Comment by Ben Smith-Mannschott [ 16/Oct/11 7:32 AM ] |
|
XXX this is where I got myself confused. The invokePrim overload it's trying to invoke is the correct one. But, that apparently is no the one that's being generated. Sorry for the noise. |
| Comment by Ben Smith-Mannschott [ 16/Oct/11 10:17 AM ] |
|
|
| Comment by Ben Smith-Mannschott [ 18/Oct/11 12:29 AM ] |
|
There are two things going on here. I'm not sure which is the error. It looks like the return type of the generated invokePrim method is too specific. It's generated as returning String, though the IFn$LO interface specifies returning Object. The caller attempts to call invokePrim returning Object, which is what the interface IFn$LO specifies, but this doesn't work because methodSL doesn't actually implement that method. Instead it implements an overload returning String.
(defn methodSL ^String [^long i] (str i)) <<1>> public final java.lang.String invokePrim(long); <<1>>
Code:
0: getstatic #25;
//Field const__0:Lclojure/lang/Var;
3: invokevirtual #34;
//Method clojure/lang/Var.getRawRoot:()Ljava/lang/Object;
6: checkcast #36;
//class clojure/lang/IFn
9: lload_1
10: invokestatic #42;
//Method clojure/lang/Numbers.num:(J)Ljava/lang/Number;
13: invokeinterface #46, 2;
//InterfaceMethod clojure/lang/IFn.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
18: checkcast #48;
//class java/lang/String
21: areturn
public java.lang.Object invoke(java.lang.Object);
Code:
0: aload_0
1: aload_1
2: checkcast #54;
//class java/lang/Number
5: invokestatic #58;
//Method clojure/lang/RT.longCast:(Ljava/lang/Object;)J
<<2>> 8: invokeinterface #60, 3;
//InterfaceMethod clojure/lang/IFn$LO.invokePrim:(J)Ljava/lang/String;
13: areturn
(defn callSL ^String [] (methodSL 42)) public java.lang.Object invoke();
Code:
0: getstatic #25;
//Field const__0:Lclojure/lang/Var;
3: invokevirtual #43;
//Method clojure/lang/Var.getRawRoot:()Ljava/lang/Object;
6: checkcast #45;
//class clojure/lang/IFn$LO
9: ldc2_w #26;
//long 42l
<<3>> 12: invokeinterface #49, 3;
//InterfaceMethod clojure/lang/IFn$LO.invokePrim:(J)Ljava/lang/Object;
17: areturn
|
| Comment by Ben Smith-Mannschott [ 18/Oct/11 1:40 AM ] |
|
Given P is some primitive type, O is type Object, and R some subclass of Object: When Clojure generates a R invokePrim(P x), it also generates a Object invoke(Object x), which delegates to R invokePrim(P x). R invokePrim(P x) overloads, but does not override the method of the corresponding Fn$PO interface. If Clojure were to generate an additional O invokePrim(P x) which delegates to R invokePrim(P x), it would satisfy the requirements of the Fn$PO interface, and should fix this issue. |
| Comment by Ben Smith-Mannschott [ 18/Oct/11 2:54 PM ] |
|
CLJ-850.patch fixes the issue. I consider this patch to be pretty hackish and hope that there's a cleaner way of addressing CLJ-850. This is the first time I've tried to understand (much less change) the Clojure compiler, so don't expect genius. |
| Comment by Ben Smith-Mannschott [ 19/Oct/11 5:06 AM ] |
|
The patch lies slightly:
It turns out that what I'm actually doing is generating a R invokePrim(P x) which is a copy of O invokePrim(P x), instead of delgating to O invokePrim(P x). This works, but the resulting class file would be smaller if the patch actually did what it says it does. |
| Comment by Andy Fingerhut [ 28/Feb/12 12:49 AM ] |
|
clj-850-type-hinted-fn-abstractmethoderror-patch2.txt is identical to Ben's two patches combined into one, with the small modification that the new tests are added to metadata.clj instead of creating a new test file. The patch applies cleanly to latest master as of Feb 27, 2012. One of the new tests does fail without the change to the compiler, and succeeds with it. I can't vouch for the correctness of the change myself, not knowing enough about the compiler internals to judge. |
| Comment by Andy Fingerhut [ 23/Mar/12 7:50 PM ] |
|
Same comments as made on Feb 27, 2012, except the patch clj-850-type-hinted-fn-abstractmethoderror-patch3.txt applies cleanly to latest master as of Mar 23, 2012. Updated because previous patch (now removed) no longer applied cleanly. git patches often fail to apply if context lines near changes are modified. |
| Comment by Rich Hickey [ 13/Apr/12 9:35 AM ] |
|
We don't support sigs taking prims and returning anything other than prim or Object. Overloading on return value only is a bad idea (and forbidden in Java). The return type of the generated method should be Object, and the String return hint should be used only as a hint. |
| Comment by Andy Fingerhut [ 01/Nov/12 7:22 PM ] |
|
clj-850-type-hinted-fn-abstractmethoderror-patch4.txt dated Nov 1 2012 is same as Ben Smith-Mannschott's CLJ-850.patch and CLJ-850-test.patch, except it has been combined into one patch and does not create a new test source file. |
| Comment by Mike Anderson [ 09/Dec/12 3:42 PM ] |
|
+10 for solving this issue: it keeps biting me in 1.4 and wouuld love to see in 1.5 I'm not familiar with the Clojure compiler internals, but looking at the approach, shouldn't we produce a primitive method with a different name (since Java doesn't support overloading on return types as Rich correctly points out). Also I think there should be 4 methods: R invokePrimExact(P x) - the actual method, used when compiler can infer I think this solves all the important cases? |
| Comment by Rich Hickey [ 19/Dec/12 8:03 AM ] |
|
Still no patch incorporating my feedback, afaict. Pushing to next release. |
| Comment by Ghadi Shayban [ 19/Dec/12 3:41 PM ] |
|
Does this new patch address the issue and concerns? (This incorporates Ben's tests from the previous patch, wasn't sure how to attribute him on that hunk) CLJ-850-conform-to-invokePrim.diff |
| Comment by Andy Fingerhut [ 21/Dec/12 10:53 PM ] |
|
Presumptuously changing state from Incomplete back to Vetted after Ghadi Shayban added the patch CLJ-850-conform-to-invokePrim.diff dated Dec 19 2012 after the status was changed to Incomplete. |
[CLJ-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-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-1086] Support arity-1 for ->> Created: 12/Oct/12 Updated: 12/Jan/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.1, Release 1.2, Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Shantanu Kumar | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
Clojure and ClojureScript |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Currently (as of Clojure 1.4) ->> doesn't support arity-1, though -> does. Arity-1 for ->> would be useful to let somebody comment out forms as follows: (->> foo #_(bar baz) #_quux) Discussion: https://groups.google.com/forum/?fromgroups=#!topic/clojure/_IVl0Tb7Au4 My name on contributor list page http://clojure.org/contributing is: Shantanu Kumar |
| Comments |
| Comment by Andy Fingerhut [ 08/Nov/12 1:37 PM ] |
|
Shantanu, you give your name on the contributing page, but I don't see it there. Is your CA in transit, perhaps? |
| Comment by Shantanu Kumar [ 08/Nov/12 1:43 PM ] |
|
@Andy I can see my name on the contributors page when I search for the text "Shantanu". My CA was submitted more than a year ago. |
| Comment by Andy Fingerhut [ 08/Nov/12 1:53 PM ] |
|
Right you are. I somehow accidentally got my browser to enable case matching, and was expecting it to search case insensitively. Sorry for the noise. |
| Comment by Víctor M. Valenzuela [ 12/Jan/13 6:48 PM ] |
|
Just for the record, the patch provided at http://dev.clojure.org/jira/browse/CLJ-1121 addresses this issue. |
[CLJ-1083] Incorrect ArityException message for function names containing -> Created: 09/Oct/12 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2, Release 1.3, Release 1.4, Release 1.5 |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Alex Nixon | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Vetted |
| Description |
|
user=> (defn a->b []) Note that the reported function name in the stack trace is "user$a", where it should be "user$a->b" (or some mangled variant thereof?) See discussion here: https://groups.google.com/d/msg/clojure/PVNoLclhhB0/_NWqyE0cPAUJ |
| Comments |
| Comment by Timothy Baldridge [ 26/Nov/12 10:27 AM ] |
|
Fix for this defect. |
| Comment by Timothy Baldridge [ 26/Nov/12 10:30 AM ] |
|
The throwArity now attempts to locate and call clojure.main/demunge. If it finds the function it invokes it and uses the returned string in the error. Otherwise it just throws the actual class name. This results in the following behaviour: user=> (defn a->b []) |
[CLJ-1074] Read/print round-trip for +/-Infinity and NaN Created: 21/Sep/12 Updated: 03/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Colin Jones | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | patch | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
A few float-related forms (namely, Double/POSITIVE_INFINITY, Double/NEGATIVE_INFINITY, Double/NaN) are not eval-able after a round-trip via (read-string (binding [*print-dup* true] (pr-str f))
The two options I see are to provide print-method implementations for these and their Float cousins, or to make Infinity, -Infinity, +Infinity, and NaN readable values. Since it sounds like edn may want to provide a spec for these values (see https://groups.google.com/d/topic/clojure-dev/LeJpOhHxESs/discussion and https://github.com/edn-format/edn/issues/2), I think making these values directly readable as already printed is preferable. Something like Double/POSITIVE_INFINITY seems too low-level from edn's perspective, as it would refer to a Java class and constant. I'm attaching a patch implementing reader support for Infinity, -Infinity, +Infinity, and NaN. |
| Comments |
| Comment by Timothy Baldridge [ 03/Dec/12 11:34 AM ] |
|
Please bring this up on clojure-dev. We'll be able to vet this ticket after that. |
| Comment by Colin Jones [ 03/Dec/12 1:18 PM ] |
|
Should I respond to my original clojure-dev post about this (linked in the issue description above), or start a new one? |
[CLJ-1026] Mixed end-of-line endings in the source code Created: 17/Jul/12 Updated: 30/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | John Szakmeister | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
While examining some of the Clojure source code, I discovered that some files had mixed line endings, or CRLF line endings on a non-Windows box. Using .gitattributes, we can correct that so that files have the right endings for the platform that it's on. |
| Comments |
| Comment by John Szakmeister [ 17/Jul/12 2:26 PM ] |
|
Patch to fix line endings and introduce .gitattributes. |
| Comment by Stuart Halloway [ 20/Jul/12 4:47 PM ] |
|
This looks like a change to every line in the world, which makes it hard to vet. Also: will it render incompatible all other outstanding patches at the time it is applied? |
| Comment by John Szakmeister [ 21/Jul/12 6:52 AM ] |
|
You can use git diff -w $(git merge-base HEAD master) to see the actual diff minus the line ending change. Here it is inline: :: git diff -w $(git merge-base HEAD master) diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7b89cfa --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +*.txt text +*.clj text +*.html text +*.js text +*.css text +*.java text diff=java Also, no, it won't render all the outstanding patches incompatible. For one, it seems like the files that have the eols mixed or in CRLF aren't touched much. I also went through the majority of outstanding patches and couldn't fix one that conflicts. Secondly, format-patch emits the patch inline and is intended to be sent via email. SMTP says that all lines must end with CRLF, so line endings are effectively lost. So git will convert it to the right line ending on application. It can conflict with any outstanding branches that you may have. Supplying the renormalization option on merge can help: git merge -X renormalize <branch-name> Or, you can enable this by default for your repository: git config --local merge.renormalize true
If you think it's too much trouble, let's just drop it though. |
| Comment by Stuart Halloway [ 10/Aug/12 1:15 PM ] |
|
Patch does not apply on my working copy of Clojure. I am using git am -s ...
/Users/stu/repos/clojure/.git/rebase-apply/patch:344: trailing whitespace.
p {
/Users/stu/repos/clojure/.git/rebase-apply/patch:350: space before tab in indent.
margin-left: 0.5in;
error: patch failed: epl-v10.html:1
error: epl-v10.html: patch does not apply
error: patch failed: src/jvm/clojure/asm/AnnotationVisitor.java:1
error: src/jvm/clojure/asm/AnnotationVisitor.java: patch does not apply
error: patch failed: src/jvm/clojure/asm/AnnotationWriter.java:1
error: src/jvm/clojure/asm/AnnotationWriter.java: patch does not apply
I am willing to do this, just inept. |
| Comment by Andy Fingerhut [ 10/Aug/12 1:21 PM ] |
|
Stuart, I updated this page http://dev.clojure.org/display/design/JIRA+workflow a while back when I had trouble applying some patches involving files with carriage return line endings. I did some Googling on git docs and found the option '--keep-cr' that seems to help in such cases. Try that out. |
[CLJ-858] Improve speed of STM by removing System.currentTimeMillis Created: 17/Oct/11 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stefan Kamphausen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
Tested on Ubuntu and OSX |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Original post: https://groups.google.com/d/topic/clojure/kc99LcUK8Tk/discussion This patch removes the milliseconds from inner class TVal in LockingTransaction.java and Ref.java. Using a little test suite[1] a increase of performance by up to 25% could be measured. If necessary I can recreate the patch against current MASTER. References: |
[CLJ-735] Improve error message when a protocol method is not found Created: 04/Feb/11 Updated: 09/Dec/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Alex Miller | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
If you call a protocol function but pass the wrong arity (forget an argument for example), you currently a message that says "No single method ... of interface ... found for function ... of protocol ...". The code in question is getting matching methods from the Reflector and creates this message if the number of matches != 1. There are really two cases there:
I propose that the == 0 case instead should have slightly different text at the beginning and a hint as to the intended arity within it: "No method: ... of interface ... with arity ... found for function ... of protocol ...". The >1 case should have similar changes: "Multiple methods: ... of interface ... with arity ... found for function ... of protocol ...". Patch is attached. I used case which presumably should have better performance than a nested if/else. I was not sure whether the reported arity should match the actual Java method arity or Clojure protocol function arity (including the target). I did the former. I did not add a test as I wasn't sure whether checking error messages in tests was appropriate or not. Happy to add that if requested. |
| Comments |
| Comment by Chas Emerick [ 14/Jul/11 6:39 AM ] |
I think it should be the latter. The message is emitted when the protocol methods are being invoked through the corresponding function, so it should be consistent with the errors emitted by regular functions. +1 for some tests, too. There certainly are tests for reflection warnings and such. FWIW, I'm happy to take this on if Alex is otherwise occupied. |
[CLJ-706] make use of deprecated namespaces/vars easier to spot Created: 05/Jan/11 Updated: 13/Feb/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stuart Halloway | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
From the mailing list http://groups.google.com/group/clojure/msg/c41d909bd58e4534. It is easy to use deprecated namespaces without knowing you are doing so. The documentation warnings are small, and there is no compiler warning. Some possibilities include:
I don't love the idea of stderr warnings on all the time. Rich: is there an approach to this that you would like to see a patch for? |
| Comments |
| Comment by Rich Hickey [ 07/Jan/11 9:38 AM ] |
|
I don't mind warning to stderr |
| Comment by Luke VanderHart [ 26/Oct/12 1:37 PM ] |
|
706-deprecated-var-warning.diff adds warnings when using deprecated vars. The other three patches clean up deprecation warnings. |
| Comment by Andy Fingerhut [ 26/Oct/12 2:23 PM ] |
|
Great stuff. I looked through the first patch, and didn't see anything in there that lets someone disable deprecation warnings from the command line, the way that warn-on-reflection can today be set to true with a command line option. Is that something important to have for deprecation warnings? |
| Comment by Andy Fingerhut [ 28/Oct/12 4:57 PM ] |
|
I was hoping it would be quick and easy to add source file, line, and column info to the deprecation warning messages. It isn't as easy as adding them to the format() call, because the method analyzeSymbol doesn't receive these values as args. Is this deprecation check being done in a place where it is not easy to relate it to the source file, line, and column? Could it be done in a place where that info is easily available? |
| Comment by Ghadi Shayban [ 29/Oct/12 1:02 AM ] |
|
Another patch - this time to warn on loading deprecated namespaces, instead of vars. This patch requires the first one. Re: line/column, I'll figure out how to thread the compile context through if it's desired. Re: Compile flag. I have a patch for this also, but I'm still verifying how to invoke. How is warn-on-reflection set by command line? |
| Comment by Andy Fingerhut [ 29/Oct/12 1:43 AM ] |
|
Re: Compile flag. Don't hold off on implementing a flag if you want to, but it might be worth hearing from others whether such a command line option is even desired. I was asking in hopes of eliciting such a response. For the way that it is handled in the Clojure compiler, search for REFLECTION_WARNING_PROP and related code in Compile.java. If you invoke the Clojure compiler directly via a Java command line, use -Dclojure.compile.warn-on-reflection=true (default is false). See the recent email thread sent to Clojure Dev Google group if you want to know how to do it via ant or Maven. Link: https://mail.google.com/mail/?shva=1#label/clojure-dev/13aa0e34530196c3 There is also a separate command-line flag called compiler-options (see Compile.java) that is implemented as a map inside the compiler. It was added more recently than warn-on-reflection, and might be the preferred method to add more such options, to avoid having to continue to add more arguments to the pushThreadBindings calls done in several places. |
| Comment by Ghadi Shayban [ 29/Oct/12 10:36 AM ] |
|
Thanks, Andy. Alternately for the last ns patch, it is equivalent to call (print-method msg err), rather than binding out to err, may be more readable. I'll be glad to send that in if it's preferable. |
| Comment by Andy Fingerhut [ 13/Feb/13 12:38 AM ] |
|
706-deprecated-var-warning-patch-v2.txt dated Feb 12 2013 is identical to 706-deprecated-var-warning.diff dated Oct 26 2012, except it applies cleanly to latest master. |
[CLJ-428] subseq, rsubseq enhancements to support priority maps? Created: 20/Aug/10 Updated: 01/May/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
See dev thread at http://groups.google.com/group/clojure-dev/browse_thread/thread/fdb000cae4f66a95. Note: subseq currently returns () instead of nil in some situations. If the rest of this idea dies we might still want to fix that. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 10:10 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/428 |
| Comment by Andy Fingerhut [ 28/Apr/13 2:14 AM ] |
|
Patch clj-428-change-Sorted-seqFrom-to-take-inclusive-patch-v1.txt dated Apr 28 2013 was written by Mark Engelberg in July 2010, and was attached to a message he sent to the dev thread linked in the description. The approach he takes is described by him in that thread, copied here: ---------------------------------------- In this patch, I do not address one issue I raised before, which is whether subseq implies by its name that it should return a seq rather than a sequence (in other words nil rather than ()). If seq behavior is desired, it would be necessary to wrap a call to seq around the calls to take-while. But for now, I'm just making the behavior match the current behavior. Although I think this is the cleanest way to address the extensibility issue with subseq, the change to seqFrom will break anyone who currently is overriding that method. I didn't see any such classes in clojure.contrib, so I don't think it's an issue, but if this is a concern, my other idea is to fix the problem entirely within subseq by changing the calls to next into calls to drop-while. I have coded this to confirm that it works, and can provide that alternative patch if desired. I can also supply a patch that uses drop-while in clojure.core/subseq and rsubseq if such an approach is preferred to the one in this patch. |
| Comment by Andy Fingerhut [ 28/Apr/13 12:12 PM ] |
|
clj-428-change-Sorted-seqFrom-to-take-inclusive-patch-v2.txt dated Apr 28 2013 is same as clj-428-change-Sorted-seqFrom-to-take-inclusive-patch-v1.txt (soon to be deleted), except it adds tests for subseq and rsubseq, and corrects a bug in that patch. The approach is the same as described above for that patch. |
| Comment by Andy Fingerhut [ 01/May/13 2:44 AM ] |
|
Patch clj-428-change-Sorted-seqFrom-to-take-inclusive-patch-v3.txt dated May 1 2013 is the same as clj-428-change-Sorted-seqFrom-to-take-inclusive-patch-v1.txt, still with the bug fix mentioned for -v2, but with some unnecessary changes removed from the patch. The comments for -v1.txt on the approach still apply. |
[CLJ-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-196] *file* returns "NO_SOURCE_PATH", but the doc says it should be nil Created: 10/Oct/09 Updated: 12/Apr/13 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Approved Backlog |
| Fix Version/s: | Release 1.6 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Alexander Redington | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Approval: | Ok |
| Waiting On: | Rich Hickey |
| Description |
|
According to http://clojure.org/api, *file* should return nil in the repl, but it returns "NO_SOURCE_PATH". This has been true for a long time. Latest patch changes only the docstring of *file* to accurately reflect current behavior. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 4:47 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/196 |
| Comment by Colin Jones [ 31/Dec/10 2:41 PM ] |
|
I think this is a pretty trivial docstring fix - "NO_SOURCE_PATH" has been the default value of file since 3dd4c1cf18ea8456b5b4aec607cd54ecfdd85eea (April 2009). |
| Comment by Andy Fingerhut [ 24/Feb/12 4:36 PM ] |
|
Colin's patch still applies cleanly to latest master as of Feb 24, 2012. |
| Comment by Stuart Sierra [ 23/Mar/12 8:32 AM ] |
|
Docstring only. Screened. |
| Comment by Stuart Sierra [ 24/Aug/12 8:44 AM ] |
|
Rescreened. Still applies on latest master. |
| Comment by Rich Hickey [ 19/Oct/12 5:47 PM ] |
|
I'd rather promise nothing than promise this forever. |
| Comment by Colin Jones [ 19/Oct/12 7:15 PM ] |
|
The second patch avoids promising the return value. For clarity, it does mention the lack of guarantee instead of omitting any mention. |
| Comment by Christopher Redinger [ 27/Nov/12 5:33 PM ] |
|
Patch applies cleanly and makes documentation more correct. |
[CLJ-1078] Added queue, queue* and queue? to clojure.core Created: 26/Sep/12 Updated: 06/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Timothy Baldridge | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | data-structures, queue | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
This patch adds functions for PersistentQueue. queue, queue? and queue* match the list functions of the same naming conventions. Patches include updates to tests. |
| Comments |
| Comment by Andy Fingerhut [ 28/Sep/12 8:43 AM ] |
|
Timothy, I tried applying both of these Sep 26, 2012 patches to latest Clojure master as of that date. I had to apply 0001-make-PersistentQueue-ctor-public.patch by hand since it failed to apply using git or patch. It built fine, but failed to pass several of the Clojure tests. Have you looked into those test failures to see if you can find the cause and fix them? I tested on Ubuntu 11.10 with Oracle JDK 1.6 and 1.7, and saw similar failures with both. |
| Comment by Timothy Baldridge [ 26/Oct/12 5:23 PM ] |
|
Fixed the patch. Tests pass, created the patch, applied it to a different copy of the source and the tests still pass. So this new patch should be good to go. |
| Comment by Andy Fingerhut [ 26/Oct/12 5:43 PM ] |
|
Timothy, I'm not sure how you are getting successful results when applying this patch. Can you try the steps below and see what happens for you? I get errors trying to apply the patch with latest Clojure master as of Oct 26, 2012. Also please use the steps on the JIRA workflow page to create a git format patch (http://dev.clojure.org/display/design/JIRA+workflow under "Development" heading). % git clone git://github.com/clojure/clojure.git |
| Comment by Timothy Baldridge [ 26/Oct/12 6:08 PM ] |
|
I was using git apply. I tried the method you show above, and now I'm seeing the same issues you show above. |
| Comment by Andy Fingerhut [ 26/Oct/12 6:26 PM ] |
|
Just so you know, the preferred way to create and apply patches are the "git format-patch master --stdout > patch.txt" to create a patch (after doing the branching commands described on the JIRA workflow page to create a branch for your changes), and the "git am --keep-cr -s < patch.txt" to apply a patch. If a patch was created that way and applies cleanly with that command, then you are definitely good to go. The "patch -p1 < patch.txt" command is just a secondary method sometimes used to try to apply patches that aren't in the format produced above, or have errors when applying using that method. |
| Comment by Timothy Baldridge [ 26/Oct/12 9:15 PM ] |
|
Just so you know, the preferred way to create and apply patches are the "git format-patch master --stdout > patch.txt" to create a patch (after doing the branching commands described on the JIRA workflow page to create a branch for your changes), and the "git am --keep-cr -s < patch.txt" to apply a patch. If a patch was created that way and applies cleanly with that command, then you are definitely good to go. The "patch -p1 < patch.txt" command is just a secondary method sometimes used to try to apply patches that aren't in the format produced above, or have errors when applying using that method. |
| Comment by Timothy Baldridge [ 26/Oct/12 9:16 PM ] |
|
added patch |
| Comment by Andy Fingerhut [ 26/Oct/12 9:37 PM ] |
|
That one applies cleanly and passes all tests. It should show up on the next list of prescreened patches. Thanks. |
| Comment by Rich Hickey [ 29/Nov/12 9:54 AM ] |
|
we don't use the queue* convention elsewhere, e.g. vec and vector. I think queue should take a collection like vec and set. (queue [1 2 3]) could be made to 'adopt' the collection as front. |
| Comment by Andy Fingerhut [ 11/Dec/12 1:00 PM ] |
|
Patch queue.patch dated Oct 26 2012 no longer applies cleanly after recent |
| Comment by Steve Miner [ 06/Apr/13 8:06 AM ] |
|
See also CLJ-976 (tagged literal support for PersistentQueue) |
[CLJ-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-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-148] Poor reporting of symbol conflicts when using (ns) Created: 10/Jul/09 Updated: 28/Jun/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
I have a module that includes pprint and my own utils. When com.howard.lewisship.cascade.dom/write was changed from private to public I get the following error: java.lang.IllegalStateException: write already refers to: #'clojure.contrib.pprint/write in namespace: com.howardlewisship.cascade.test-views (test_views.clj:0) (ns com.howardlewisship.cascade.test-views ; line 15 That line number is wrong but better yet, identifying the true conflict (com.howard.lewisship.cascade.dom/write) would be even more important. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:54 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/148 |
| Comment by Assembla Importer [ 24/Aug/10 3:54 AM ] |
|
scgilardi said: It's saying that the symbol com.howardlewisship.cascade.test-views/write already resolves to #���clojure.contrib.pprint/write, so you can't def a new write in com.howardlewisship.cascade.test-views. What do you propose for an alternate wording of the error message here? |
| Comment by Jeff Rose [ 12/May/11 9:49 AM ] |
|
I think the issue is that only one side of the conflict is reported in the error, so if you get this kind of error in the middle of a large project it can be hard to figure out which namespace is conflicting. Take a toy example: user=> (ns foo) In this case it would be best if the error said something like: "Conflict referring to #'bar/foobar in #<Namespace problem> because foobar already refers to: #'foo/foobar." This way the error message clearly identifies the location of the conflict, and the locations of the two conflicting vars. Hopefully this helps clarify. I think I see where to fix it in warnOrFailOnReplace on line 88 of src/jvm/clojure/lang/Namespace.java, and this reminds me I need to send in a CA so I can pitch in next time... |
| Comment by Aaron Bedra [ 28/Jun/11 6:42 PM ] |
|
It looks like the true conflict is in test-views, not in dom. A small example of the line number breakage showing the problem on master (1.3) would be very helpful. |
[CLJ-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-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-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-1079] Don't squash explicit :line and :column metadata in the MetaReader Created: 29/Sep/12 Updated: 07/Feb/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Chas Emerick | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
I have been experimenting with using cljx to produce Clojure and ClojureScript source from a single file. This has gone well so far, with the exception that, due to the way the source transformation works, all of the linebreaks and other formatting is gone from the output. There is an option to include the original :line metadata in the output though, like so: ;;This file autogenerated from
;;
;; src/cljx/com/foo/hosty.cljx
;;
^{:line 1} (ns com.foo.hosty)
^{:line 3} (defn ^{:clj true} system-hash [x] ^{:line 5} (System/identityHashCode x))
(Hopefully, such hackery won't be necessary in the future with sjacket or something like it...) Unfortunately, when read in using a LineNumberingPushbackReader, code like this has its :line metadata squashed by the line numbers coming from that. A REPL-friendly example would be: => (meta (read (clojure.lang.LineNumberingPushbackReader.
(java.io.StringReader. "^{:line 66} ()"))))
{:line 1}
=> (meta (read (java.io.PushbackReader.
(java.io.StringReader. "^{:line 66} ()"))))
{:line 66}
The latter seems more correct to me (and is equivalent to read-string). |
| Comments |
| Comment by Chas Emerick [ 29/Sep/12 7:07 PM ] |
|
{{CLJ-1097.diff}} contains a fix for this issue, as well as a separate commit that eliminates a series of casts in order to improve readability in the area. |
| Comment by Andy Fingerhut [ 05/Oct/12 8:23 AM ] |
|
Chas, your patch doesn't apply cleanly to latest Clojure master as of Oct 5 2012. I'm not sure, but I think some recent commits to Clojure on Oct 4 2012 caused that. I also take it as evidence of your awesomeness that you can write patches for tickets that haven't been filed yet |
| Comment by Chas Emerick [ 05/Oct/12 9:24 AM ] |
|
"patches for tickets that haven't been filed yet?" Anyway, tweaking up this patch is a small price to pay for having column meta. New {{CLJ-1097.diff}} patch attached, applies clean on master as of now. Otherwise same contents as in the original patch, except:
|
| Comment by Nicola Mometto [ 05/Oct/12 9:39 AM ] |
|
"patches for tickets that haven't been filed yet?" He was referring to the fact that you uploaded "CLJ-1097.diff" while the ticket is #1079 |
| Comment by Chas Emerick [ 05/Oct/12 9:42 AM ] |
|
Oh, hah! Twice now, even! One more data point recommending my having slight dyslexia or somesuch. :-P I've replaced the attached patch with one that is named properly to avoid any later confusion. |
| Comment by Chas Emerick [ 07/Oct/12 3:57 PM ] |
|
Refreshed patch to apply cleanly to master after the recent off by one patch for :column metadata. |
| Comment by Stuart Halloway [ 19/Oct/12 3:12 PM ] |
|
This feels backwards to me. If a special purpose tool wants to convey information via metadata, why does it use names that collide with those used by LispReader? |
| Comment by Chas Emerick [ 19/Oct/12 7:36 PM ] |
|
The information being conveyed is the same :line and :column metadata conveyed by LispReader — in fact, that's where it comes from in the first place. Kibit (and cljx) is essentially an out-of-band source transformation tool. Given an input like this: (ns com.foo.hosty)
(defn ^:clj system-hash
[x]
(System/identityHashCode x))
(defn ^:cljs system-hash
[x]
(goog/getUid x))
…it produces two files, a .clj for Clojure, and a .cljs for ClojureScript. (The first code listing in the ticket description is the former.) However, because there's no way to transform Clojure code/data without losing formatting, anything that depends on line/column numbers (stack traces, stepping debuggers) is significantly degraded. If LispReader were to defer to :line and :column metadata already available on the loaded forms (there when the two generated files are spit out with *print-meta* on), this would not be the case. |
| Comment by Andy Fingerhut [ 07/Feb/13 8:47 AM ] |
|
clj-1079-patch-v2.txt dated Feb 7 2013 is identical to Chas's CLJ-1079.diff dated Oct 7 2012, except it applies cleanly to latest master. I believe the only difference is that some white space in the context lines is updated. |
| Comment by Andy Fingerhut [ 07/Feb/13 12:35 PM ] |
|
Sorry for the noise. I've removed clj-1079-patch-v2.txt mentioned in the previous comment, because I learned that CLJ-1079.diff dated Oct 7 2012 applies cleanly to latest master and passes all tests if you use this command to apply it. % git am --keep-cr -s --ignore-whitespace < CLJ-1079.diff I will update the JIRA workflow page instructions for applying patches to mention this, too, because there are multiple patches that fail without --ignore-whitespace, but apply cleanly with that option. That will eliminate the need to update patches merely for whitespace changes. |
[CLJ-1077] thread-bound? returns true (implying set! should succeed) even for non-binding thread Created: 26/Sep/12 Updated: 01/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Paul Stadig | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
thread-bound? returns true for a non-binding thread, this result (according to the docstring) implies that set! should succeed. However, thread-bound? does not check that any binding that might exist was created by the current thread, and calling set! fails with an exception when it is called from a non-binding thread, even though thread-bound? returns true. thread-bound? should return false if there is a binding, and that binding was not established by the current thread. |
| Comments |
| Comment by Paul Stadig [ 01/Oct/12 10:07 AM ] |
|
I have attached a patch that changes clojure.lang.Var and clojure.core/thread-bound? to only return true if a Var is set!-able. |
[CLJ-1076] pprint tests fail on Windows, expecting \n Created: 26/Sep/12 Updated: 02/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Ivan Kozik | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Windows 7 |
||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
New pprint tests were committed recently, but they fail on Windows because the tests check for \n, while pprint seems to output \r\n. A log with the test failures is attached. The first failing commit is https://github.com/clojure/clojure/commit/4ca0f7ea17888ba7ed56d2fde0bc2d6397e8e1c0 |
| Comments |
| Comment by Andy Fingerhut [ 29/Sep/12 2:27 PM ] |
|
Patch clj-1076-fix-tests-on-windows-patch-v1.txt dated Sep 29 2012 when applied to the particular commit that Ivan mentions causes the tests to pass when I run "ant" on a Windows 7 machine for me, and it continues to pass all tests on Mac OS X 10.6.8, too. I may be doing something wrong, but when I try to run "ant" to build and test on Windows 7 with latest Clojure master, with or without this patch, it fails right at the beginning of the tests because it can't find clojure.test.generative. I'm probably doing something wrong somewhere. Ivan, would you be able to test this patch on Windows with the latest Clojure master to see if all tests pass for you now? |
| Comment by Ivan Kozik [ 29/Sep/12 2:59 PM ] |
|
All tests pass on Windows 7 here with the patch. Ant can't find my test.generative either because it isn't in my "${maven.test.classpath}". I put it in CLASSPATH and modified my build.xml like this: |
| Comment by Andy Fingerhut [ 10/Dec/12 1:33 PM ] |
|
Just as a rough idea of how often people are hitting this issue, |
| Comment by Mike Anderson [ 18/Jan/13 7:44 PM ] |
|
Hi there is this likely to get fixed soon? I'd like to help contribute some more patches to Clojure but it's tricky to do when I can't get the build to work |
| Comment by Andy Fingerhut [ 18/Jan/13 8:39 PM ] |
|
I do not know if or when this patch will be committed to Clojure. I can tell you that you can apply the patch to your own local copy of the Clojure source code, and then develop new Clojure patches based upon that version. The patch that fixes this problem only affects one test file, so it is unlikely to conflict with any changes you develop and submit. |
| Comment by Mike Anderson [ 21/Jan/13 6:36 AM ] |
|
I can confirm this patch works fine for me on Windows with Maven/Eclipse Suggest this patch gets pushed through approval and applied ASAP? It's a pretty obvious fix that is breaking the build.... |
| Comment by Stuart Halloway [ 01/Mar/13 12:44 PM ] |
|
This patch is sloppy – it makes unnecessary whitespace changes in several places. Would it be better to make the tests trailing whitespace agnostic? Otherwise this feels like poking and prodding until the build box is happy. |
| Comment by Andy Fingerhut [ 02/Mar/13 2:50 PM ] |
|
Patch clj-1076-fix-tests-on-windows-patch-v2.txt dated Mar 2, 2013 fixes pprint tests on Windows in a different way: Removing all occurrences of carriage return (\r) characters in the output of pprint before comparing it to the expected string. I tried simply doing str/trim-newline to remove newlines and carriage returns at the end of the string, but that does not make the tests pass. They still fail due to carriage returns in the middle of the string. |
| Comment by Andy Fingerhut [ 02/Mar/13 2:51 PM ] |
|
Presumptuously changing Approval from Incomplete back to None, since there is a new patch attached that should address the reason it was marked Incomplete. |
[CLJ-994] repeat reducer Created: 11/May/12 Updated: 14/Sep/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Jason Jackson | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
i'm working on clojure.core/repeat reducer. |
| Comments |
| Comment by Andy Fingerhut [ 17/May/12 6:18 PM ] |
|
Jason, have you tried to build this using JDK 1.6.0? I've tried on Mac OS X 10.6.8 + Oracle/Apple JDK 1.6.0 and Ubuntu 11.10 + IBM JDK 1.6.0, and on both it compiles, but during the tests fails with a ClassNotFoundException for class jsr166y.ForkJoinTask. It builds and tests cleanly on Ubuntu 11.10 + Oracle JDK 1.7.0 for me. |
| Comment by Jason Jackson [ 17/May/12 6:41 PM ] |
|
That's an issue that applies to all of core.reducers. Alan Malloy experienced it as well. I tried fixing it, but eventually just upgraded to JDK 1.7. I don't understand why it's happening. |
| Comment by Jason Jackson [ 19/May/12 2:55 PM ] |
|
This issue is isolated to mvn test afaik. When I include clojure inside a leiningen project, and add jsr166y.jar to lib directory, core.reducers works fine with java 1.6. |
| Comment by Andy Fingerhut [ 20/May/12 3:00 AM ] |
|
Jason, you say it applies to all of core.reducers in your May 17, 2012 comment. I don't understand. Without your patch applied, I can run "./antsetup.sh ; ant" in a freshly-pulled Clojure git repo on either of the JDK 1.6.0 versions mentioned in my earlier comment, and do not get any errors during the tests. Are you saying perhaps that core.reducers currently has no tests that exercise the problem now, but your patch adds such tests that fail, even with no other changes to the code? |
| Comment by Jason Jackson [ 20/May/12 11:55 AM ] |
|
Yah that's right. Now that you mention it, my patch is the first unit test to call r/fold (the existing tests do non-parallel reductions). |
| Comment by Andy Fingerhut [ 08/Jun/12 7:11 PM ] |
|
With Stuart Halloway's commit to Clojure master on June 8, 2012 titled "let reducers tests work under ant", patch 0001-repeat-for-clojure.core.reducers.patch dated May 11, 2012 now runs correctly even the new unit tests requiring class jsr166y.ForkJoinTask with Oracle/Apple JDK 1.6 and Linux IBM JDK 1.6. |
| Comment by Jason Jackson [ 14/Aug/12 1:17 AM ] |
|
I'm on the contributors list. Is this patch still needed? |
| Comment by Jason Jackson [ 14/Sep/12 2:37 PM ] |
|
This patch should wait until http://dev.clojure.org/jira/browse/CLJ-993 is committed. I think there's a some shared code. |
[CLJ-993] `range` reducer Created: 10/May/12 Updated: 18/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alan Malloy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Rich mentioned in IRC today he'd welcome a reducer implementation of clojure.core/range. Now that I've figured out how to do iterate, I figure I'll knock out range as well by the end of the night. Just opening the issue early to announce my intentions to anyone else interested in doing it. |
| Comments |
| Comment by Alan Malloy [ 10/May/12 10:45 PM ] |
|
Implemented range. A separate commit is attached, making iterate and range also Seqable, since I'm not sure if that's desired. Apply it or not, as you prefer. |
| Comment by Jason Jackson [ 11/May/12 11:20 AM ] |
|
Range should be foldable |
| Comment by Alan Malloy [ 11/May/12 12:53 PM ] |
|
Yep, so it should. Time for me to dig into the folding implementations! |
| Comment by Alan Malloy [ 11/May/12 2:42 PM ] |
|
Should I fold (har har) all of these commits into one? I don't know what is preferred on JIRA, and I also don't know whether range/iterate should be seqable or if I should just drop the second commit. |
| Comment by Rich Hickey [ 11/May/12 3:21 PM ] |
|
Yes, please merge these together, it's hard to see otherwise (I can barely read diffs as is |
| Comment by Alan Malloy [ 11/May/12 3:30 PM ] |
|
So you want clojure.core/range to return some object (a Range), which implements Counted and Seqable (but isn't just a lazy-seq), and then inside of clojure.core.reducers I extend CollReduce and CollFold to that type? Okay, I can do that. I don't quite follow what you mean by an allocating protocol. I see your point that my fold-by-halves which takes a function in is analogous to a protocol with a single function, but it doesn't allocate anything more than foldvec already does - I just pulled that logic out so that the fork/join fiddly work doesn't need to be repeated in everything foldable. Do you have an alternative recommendation, or is it just something that makes you uneasy and you're still thinking about? |
| Comment by Rich Hickey [ 11/May/12 3:52 PM ] |
|
While vector-fold allocs subvecs, the halving-fn must return a new vector, for all implementations. It's ok, I don't think it's likely to dominate (since fj needs new closures anyway). Please proceed, but keep range and iterate in core. They are sources, not transformers, and only transformers (which must be different from their seq-based counterparts) must reside in reducers. Thanks! |
| Comment by Stuart Sierra [ 11/May/12 5:01 PM ] |
|
One big patch file is preferred, although that file may contain multiple commits if that makes the intent clearer. When adding a patch, update the description of the ticket to indicate which file is the most recent. Leave old patch files around for historical reference. |
| Comment by Alan Malloy [ 11/May/12 9:00 PM ] |
|
It's looking harder than I expected to move iterate and range into core.clj. My plan was to just have them implement Seqable, which is easy enough, but currently they are actually instances of ISeq, because they inherit from LazySeq. A bunch of code all over the place (eg, to print them in the repl) depends on them being ISeq, so I can't just ignore it. To implement all of these methods (around thirty) would take a large amount of code, which can't easily be shared between Iteration, Range, and any future reducible sources that are added to core.clj. I could write a macro like (defseq Range [start end step] Counted (count [this] ...) ...) which takes normal deftype args and also adds in implementations for ISeq, Collection, and so forth in terms of (.seq this), which will be a LazySeq. However, this seems like a somewhat awkward approach that I would be a little embarrassed to clutter up core.clj with. If anyone has a better alternative I will be pleased to hear it. In the mean time, I will go ahead with this macro implementation, in case it turns out to be the best choice. |
| Comment by Alan Malloy [ 11/May/12 11:52 PM ] |
|
– This patch subsumes all previous patches to this issue and to CLJ-992 – In order to create an object which is both a lazy sequence and a If we wanted, we could use this macro to implement lazy-seq in clojure instead of in java, but that's unrelated so I didn't do that in this patch. As noted in a previous comment, defseq may not be the right approach, but this works until something better is suggested. |
| Comment by Alan Malloy [ 11/May/12 11:58 PM ] |
|
I accidentally included an implementation of drop-while in this patch, which I was playing around with to make sure I understood how this all works. I guess I'll leave it in for the moment, since it works and is useful, but I can remove it, or move it to a new JIRA ticket, if it's not wanted at this time. |
| Comment by Rich Hickey [ 12/May/12 10:52 AM ] |
|
Ok, I think this patch is officially off the rails. There must be a better way. Let's start with: touching core/deftype and reimplementing lazy-seq as a macro are off the table. The return value of range doesn't have to be a LazySeq, it has to be a lazy seq, .e.g. implement ISeq (7 methods, not 30) which it can do by farming out to its existing impl. It can also implement some new interface for use by the reducer logic. There is also still clojure.lang.Range still there, which is another approach. Please take an extremely conservative approach in these things. |
| Comment by Alan Malloy [ 12/May/12 5:53 PM ] |
|
Okay, thanks for the feedback - I'm glad I went into that last patch knowing it was probably wrong It's still an unpleasant chunk of boilerplate for each new source, though; would you welcome a macro like defseq if I didn't put it in core_deftype? If so, it seems like it might as well implement the interop interfaces; if not, I can skip them and implement the 7 (isn't it more like 9?) methods in ISeq, IPersistentCollection, and Seqable for each new source type. Thanks for pointing out clojure.lang.Range to me - I didn't realize we had it there. Of course with implementation inheritance it would be easy to make Range, Iteration, etc inherit from LazySeq and just extend protocols from them. But that means moving functionality out of clojure and into java, which I didn't think we'd want to do. I'll put together a patch that just implements ISeq by hand for both of these new types, and attach it probably later today. |
| Comment by Alan Malloy [ 12/May/12 7:49 PM ] |
|
So I've written a patch that implements ISeq, but not the java Collections interfaces, and it mostly works but there are definitely assumptions in some parts of clojure.core and clojure.lang that assume seqs are Collections. The most obvious to me (ie, it shows up when running mvn test) is RT/toArray - it tests for Collection, but never for ISeq, implying that it's not willing to handle an ISeq that is not also a collection. Functions which rely on toArray (eg to-array and vec) now fail. This patch subsumes all previous patches on this issue, but is not suitable for application because it leaves some failing tests behind - it is intended only for intermediate feedback. |
| Comment by Rich Hickey [ 13/May/12 8:50 AM ] |
|
It would be a great help if, time permitting, you could please write up the issues, challenges and options you've discovered somewhere on the dev wiki (even a simple table would be fantastic). I realize this has been a challenging task, and at this point perhaps we should opt for the more modest reducers/range and reducers/iterate and leave the two worlds separate. I'd like at some point to unify range, as there are many extant ranges it would be nice to be able to fold, as we can extant vectors. |
| Comment by Jason Jackson [ 13/May/12 9:24 AM ] |
|
Should r/range return something Seqable and Counted? If so, I'll do the same for r/repeat. |
| Comment by Alan Malloy [ 13/May/12 1:59 PM ] |
|
I've sketched out a description of the issues and options. I'm not very familiar with the dev wiki and couldn't figure out where was the right place to put this. "release.next" seems to still be about 1.4 issues, and I don't know if it's "appropriate" to create a whole new category for this. It's available as a gist until a better home can be found for it. |
| Comment by Alan Malloy [ 23/May/12 7:54 PM ] |
|
Here's a single patch summing up the state Rich suggested "rolling back" to: separate r/range and r/iterate functions. I haven't heard any feedback since doing the writeup Rich asked for, so am not making any further progress at the moment; if something other than this patch is desired just let me know. |
| Comment by Rich Hickey [ 14/Aug/12 2:07 PM ] |
|
I prefer not to see the use of extend like this for new types. Perhaps this code is too DRY? Also, it does a lot in one patch which makes it hard to parse and accept. This adds Range, switches impl of vector folds etc. Can it be broken up into separate tickets that do each step that builds on the previous, e.g. one ticket could be: capture vector fold impl for reuse by similar things. |
| Comment by Alan Malloy [ 18/Aug/12 6:19 PM ] |
|
Okay, I should be able to split it up over the weekend. I'll also see about converting fold-by-halves into a function that is used by Range/Vector, rather than a function that gets extended onto them. |
| Comment by Alan Malloy [ 18/Aug/12 7:18 PM ] |
|
As requested, I have split up the large patch on this issue into four smaller tickets. The other three are: CLJ-1045, CLJ-1046, and CLJ-992. CLJ-1045 contains the implementation of fold-by-halves, and as such this patch cannot be applied until CLJ-1045 is accepted. This ticket does not depend on the other two, but there will be minor merge conflicts if this is merged before them. |
[CLJ-978] bean unable to handle non-public classes Created: 30/Apr/12 Updated: 29/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Charles Duffy | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Take the following Java as an example: public interface IFoo { String getBar(); } class FooImpl { String getBar() { return "bar"; } } As presently implemented, (bean my-foo) tries to invoke the following: (. #<Method public java.lang.String FooImpl.getBar> (invoke my-foo nil)) However, as FooImpl is not public, this fails: java.lang.IllegalAccessException: Class clojure.core$bean$fn__1827$fn__1828 can not access a member of class FooImpl with modifiers "public" at sun.reflect.Reflection.ensureMemberAccess (Reflection.java:65) java.lang.reflect.Method.invoke (Method.java:588) clojure.core$bean$fn__1827$fn__1828.invoke (core_proxy.clj:382) clojure.core$bean$v__1832.invoke (core_proxy.clj:388) clojure.core$bean$fn__1838$thisfn__1839$fn__1840.invoke (core_proxy.clj:406) clojure.lang.LazySeq.sval (LazySeq.java:42) clojure.lang.LazySeq.seq (LazySeq.java:60) clojure.lang.RT.seq (RT.java:473) However, the same thing succeeds if we call #<Method public java.lang.String Foo.getBar> rather than #<Method public java.lang.String FooImpl.getBar>. |
| Comments |
| Comment by Charles Duffy [ 30/Apr/12 10:40 PM ] |
|
Fix inaccurate documentation string |
| Comment by Charles Duffy [ 01/May/12 9:41 AM ] |
|
Apache Commons Beanutils has their own implementation of this, at http://www.docjar.com/html/api/org/apache/commons/beanutils/MethodUtils.java.html#771 – notably, it tries to reflect a method with the given signature and catches the exception on failure, rather than iterating through the whole list. This may be a better approach – I'm unfamiliar with how the cost of exception handling compares with that of reflecting on the full method list of a class. |
| Comment by Charles Duffy [ 01/May/12 10:11 AM ] |
|
Prior version of patch were missing new test suite files. Corrected. |
| Comment by Andy Fingerhut [ 04/May/12 2:48 AM ] |
|
Thanks for the patches, Charles. Could you please create a patch in the desired format and attach that, and then remove the obsolete patches? Instructions for creating a patch are under the heading "Development" at this page: http://dev.clojure.org/display/design/JIRA+workflow Instructions for removing patches are under the heading "Removing patches" on that same page. |
| Comment by Charles Duffy [ 06/May/12 2:59 PM ] |
|
Added a patch created per documented process. |
| Comment by Gary Trakhman [ 04/Oct/12 6:44 PM ] |
|
I found in my code that it's possible to get a NPE if there is no read-method, for instance on the http://docs.cascading.org/cascading/2.0/javadoc/cascading/flow/hadoop/HadoopFlow.html object which has a setCascade method but no getter. I fixed this in our code by inlining the is-zero-args check into the public-method definition and and-ing the whole thing with 'method' like the original 'bean' code, like so: public-method (and method (zero? (alength (. method (getParameterTypes)))) |
| Comment by Rich Hickey [ 29/Nov/12 10:01 AM ] |
|
Charles, I think we should follow Apache BeanUtils on this. Exceptions not thrown are cheap. Ordinarily, exception for control flow are bad, but this is forced by bad design of reflection API. |
[CLJ-884] Reflector error messages can be improved when no matching method is found. Created: 27/Nov/11 Updated: 23/Mar/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Rahul Pilani | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
All |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
When accessing a java method with an arity mismatch or a mismatched parameter type, Reflector.java returns the following error on REPL: eventhough method xyz might exist on MyClass, but was being called with the wrong number of arguments. Attached is a patch that fixes that problem. |
| Comments |
| Comment by Andy Fingerhut [ 22/Mar/12 8:47 PM ] |
|
diff.patch of Nov 27, 2011 does not apply cleanly to latest master version of Clojure code (using "patch -p1 < diff.patch", at least). It is preferred by Clojure team that patches are in git format-patch format. Instructions for producing such a patch are given at http://clojure.org/patches Rahul, are you planning to sign a Clojure Contributor Agreement? Without that, this code cannot be included in Clojure, unless a contributor reimplements it on their own. |
| Comment by Andy Fingerhut [ 23/Mar/12 1:14 AM ] |
|
In private communication with the patch author today, he expressed an interest in submitting a signed CA so this patch can be considered for inclusion in Clojure. |
[CLJ-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-200] Extend cond to support inline let, much like for Created: 18/Oct/09 Updated: 02/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Anonymous | Assignee: | Mark Engelberg |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
I find it occasionally very useful to do a few tests in a cond, then introduce some new symbols (for both clarity and efficiency) that can be referenced in later tests (or matching expressions). This parallels similar functionality inside the for macro, where the :let keyword is matched against a vector of symbol bindings and forms an implicit let around the remainder of the comprehension. I'll be adding a patch for this shortly. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 1:51 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/200 |
| Comment by Assembla Importer [ 24/Aug/10 1:51 PM ] |
|
hlship said: Trickier than I thought because cond is really wired into other fundamentals, like let. |
| Comment by Assembla Importer [ 24/Aug/10 1:51 PM ] |
|
cgrand said: Howard, what do you think of http://gist.github.com/432712 ? |
| Comment by Mark Engelberg [ 23/Nov/12 2:33 AM ] |
|
Patch cond-let-clauses.diff on 23/Nov/12 adds inline :let clauses to cond, implementing CLJ-200. The code is based off of code by cgrand, with some tweaks so the implementation only relies on constructs defined earlier in core.clj, since when cond is defined, things aren't yet fully bootstrapped. Also added a test to control.clj. |
| Comment by Christophe Grand [ 23/Nov/12 3:06 AM ] |
|
Some comments: the docstring is missing, I believe you don't have to modify the original cond (except the docstring maybe), just redefine it later on once most of the language is defined – a bit like what is done for let for example. There is still the unlikely eventuality that some code uses :let as :else. What about shipping a cond which complains on keywords (in test position) other than :else? |
| Comment by Mark Engelberg [ 23/Nov/12 3:47 AM ] |
|
cond-let-clauses-with-docstring.diff contains the same patches as cond-let-clauses, but includes the original docstring for cond along with an additional sentence about the :let bindings. |
| Comment by Mark Engelberg [ 23/Nov/12 3:54 AM ] |
|
Cgrand, I did see your example of redefining cond after most of the language is defined, but since I was able to figure out how to do it in the proper place, that makes the :let bindings available for users of cond downstream and avoids any unforeseen complications that might come from rebinding. As for your other point, I think it is highly improbable that someone would have used :let in the :else position. However I can imagine someone intentionally using something like :true or :default. I think the idea of warning for other keywords is actually more likely to cause complications than the unlikely problem it is meant to solve. I did resubmit the patch with the docstring restored. Thanks for pointing out that problem. I'm excited about this patch – I use :let bindings within the cond in my own code all the time. Thanks again for the blog post that started me on that path. |
| Comment by Christophe Grand [ 23/Nov/12 4:13 AM ] |
|
True, it's :unlikely for :let to happen. |
| Comment by Andy Fingerhut [ 29/Nov/12 8:46 PM ] |
|
Mark, could you remove the obsolete earlier patch now that you have added the one with the doc string? Instructions for removing patches are under the heading "Removing Patches" on this page: http://dev.clojure.org/display/design/JIRA+workflow |
| Comment by Mark Engelberg [ 29/Nov/12 10:50 PM ] |
|
Done. |
| Comment by Andy Fingerhut [ 30/Nov/12 1:24 AM ] |
|
I haven't figured out what is going wrong yet. I can apply the patch cond-let-clauses-with-docstring.diff to the latest Clojure master just fine. I can do "ant jar" and it will build a jar. When I do "ant", it fails with the new test for cond with :let, throwing a StackOverflowException. I can enter that same form into the REPL and it evaluates just as the test says it should. I can comment out that new test and all of the rest pass. But the new test doesn't pass when inside of the control.clj file. Anyone know why? |
| Comment by Christophe Grand [ 30/Nov/12 4:54 AM ] |
|
It's because of the brutal replacement performed by test/are: the placeholders for this are form are x and y but in Mark's test there are used as local names and are tries to substitute them recursively... |
| Comment by Mark Engelberg [ 02/Dec/12 8:20 AM ] |
|
cond-let-clauses-fixed-test.diff on 02/Dec/12 contains the same patch, but with the x,y locals in the test case changed to a,b so that it works properly in the are clause which uses x and y. |
| Comment by Mark Engelberg [ 02/Dec/12 8:27 AM ] |
|
On Windows, I can't get Clojure's test suite task to work, either via ant or maven, which has made it difficult for me to verify the part of the patch that applies to the test suite works as expected; I had tested it as best I could in the REPL, using a version of Clojure built with the patch applied, but using this process, I missed the subtle interaction between are and the locals in the test case. Sorry about that. If someone can double-check that the test suite task now works with the newest patch, that would be great, and then I'll go ahead and remove the obsoleted patch. Thanks. |
| Comment by Andy Fingerhut [ 02/Dec/12 6:29 PM ] |
|
clj-200-cond-let-clauses-fixed-test-v2-patch.txt dated Dec 2 2012 is identical to Mark Engelberg's cond-let-clauses-fixed-test.diff of the same date, except it applies cleanly to the latest Clojure master. I've verified that it compiles and passes all tests with latest Clojure master as of this date. Mark, I've made sure to keep your name in the patch, since you wrote it. You should be able to remove your two attachments now, so the screener won't be confused which patch should be examined. |
| Comment by Andy Fingerhut [ 02/Dec/12 6:31 PM ] |
|
Mark, besides general issues with Windows not being used much (or maybe not at all?) by Clojure developers, there is the issue right now filed as CLJ-1076 that not all tests pass when run on Windows due to CR-LF line ending differences that cause several Clojure tests to fail, regardless of whether you use ant or maven to run them. |
[CLJ-2] Scopes Created: 15/Jun/09 Updated: 08/Mar/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: | Rich Hickey |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Add the scope system for dealing with resource lifetime management |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 11:43 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/2 |
| Comment by Assembla Importer [ 24/Aug/10 11:43 AM ] |
|
richhickey said: Updating tickets (#8, #42, #113, #2, #20, #94, #96, #104, #119, #124, #127, #149, #162) |
| Comment by Stuart Halloway [ 12/Jul/11 8:26 AM ] |
|
Patch demonstrates idea, not ready for prime time. |
| Comment by Tassilo Horn [ 23/Dec/11 7:37 AM ] |
|
I think the decision of having to specify either a Closeable resource or a close function for an existing non-Closeable resource in with-open is quite awkward, because they have completely different meaning. (let [foo (open-my-custom-resource "foo.bar")]
(with-open [r (reader "foo.txt")
foo #(.terminate foo)]
(do-stuff r foo)))
I think a CloseableResource protocol that can be extended to custom types as implemented in the patch to CLJ-308 is somewhat easier to use. Extend it once, and then you can use open-my-custom-resource in with-open just like reader/writer and friends... That said, Scopes can still be useful, but I'd vote for handling the "how should that resource be closed" question by a protocol. Then the with-open helper can simply add (swap! *scope* conj (fn [] (clojure.core.protocols/close ~(bindings 0)))) and cleanup-scope only needs to apply each fn without having to distinguish Closeables from fns. |
[CLJ-1191] Improve apropos to show some indication of namespace of symbols found Created: 04/Apr/13 Updated: 05/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5, Release 1.6 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Andy Fingerhut | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
apropos does find all symbols in all namespaces that match the argument, but the return value gives no clue as to which namespace the found symbols are in. It can even return multiple occurrences of the same symbol, which only gives a clue that the symbol exists in more than one namespace, but not which ones. For example: user=> (apropos "replace") It would be nice if the returned symbols could indicate the namespace, either always, or if the found symbol is not in the current namespace. |
| Comments |
| Comment by Andy Fingerhut [ 04/Apr/13 8:25 PM ] |
|
Path clj-1191-patch-v1.txt enhances apropos to put a namespace/ qualifier before every symbol found that is not in the current namespace ns. It also finds the shortest namespace alias if there is more than one. Examples of output with patch: user=> (apropos "replace") user=> (require '[clojure.string :as str]) user=> (in-ns 'clojure.string) |
| Comment by Colin Jones [ 05/Apr/13 1:34 PM ] |
|
+1 apropos as it already stands is quite helpful for already-referred vars, but not for vars that are only in other nses. This update includes the information someone would need to further investigate the output. |
[CLJ-1177] clojure.java.io/resource and non-ASCII characters Created: 07/Mar/13 Updated: 10/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Trevor Wennblom | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | bug, enhancement | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
clojure.java.io/resource corrupts path containing UTF-8 characters without issuing warning. user=> (System/getProperty "java.runtime.version") "1.8.0-ea-b79" user=> (clojure-version) "1.5.0" user=> (System/getProperty "user.dir") "/dir/déf" user=> (clojure.java.io/resource "myfile.txt") #<URL file:/dir/d%c3%a9f/resources/myfile.txt> user=> (slurp (clojure.java.io/resource "myfile.txt") :encoding "UTF-8") FileNotFoundException /dir/déf/resources/myfile.txt (No such file or directory) java.io.FileInputStream.open (FileInputStream.java:-2) |
| Comments |
| Comment by Andy Fingerhut [ 08/Mar/13 12:10 AM ] |
|
Below is a workaround, at least. I don't know, but perhaps the as-file method for URLs in io.clj of Clojure, the part that converts %hh sequences to a character with code point in the range 0 through 255, is at least partly at fault here. I don't know right now if it is possible to modify that code to handle the general case of whatever character encoding munging is going on here to when .getResource creates the URL object. clojure.java.io/resource is documented to return a Java object of type java.net.URL, which seems like it does %hh escaping of many characters. Reference [1] to a Java bug from 2001 where a Java user was surprised by the then-recent change in behavior of the getResource method [2]. Doing a little searching I found this StackOverflow question [3], which has what might be a workaround. I tried it on my Mac OS X 10.6 system running JDK 1.6 and it seemed to work: (slurp (.getContent (clojure.java.io/resource "abcíd/foo.txt"))) That getContent is a method for class java.net.URL [4] [1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4466485 |
| Comment by Trevor Wennblom [ 08/Mar/13 9:56 AM ] |
|
Hi Andy, Thanks for the background and suggestions, that's very helpful. I'm gradually learning Clojure with no Java experience. In this case I was searching for the preferred Clojure way to access items in directories declared under :resource-paths in a Leiningen project.clj file. Perhaps clojure.java.io/resource isn't the best way to do this as it's possibly too tied to the expectation for a URI instead of a more general IRI. You're suggested workaround did work for my use case: (slurp (.getContent (clojure.java.io/resource "abcíd/foo.txt"))) but hopefully there would be more native/direct Clojure way to accomplish the same eventually. I don't know if java.net.IDN would be useful internally as a fix in clojure.java.io/resource — I'm assuming not since it wasn't added until Java 6.[1] user=> (import 'java.net.IDN) java.net.IDN user=> (java.net.IDN/toASCII "/dir/déf") "xn--/dir/df-gya" user=> (java.net.IDN/toUnicode "xn--/dir/df-gya") "/dir/déf" [1]: http://docs.oracle.com/javase/6/docs/api/java/net/IDN.html |
| Comment by Andy Fingerhut [ 08/Mar/13 1:30 PM ] |
|
Patch clj-1177-patch-v1.txt dated Mar 8 2013 is an attempt to solve this issue, in what I think may be a correct way. As specified in RFC 3986, when taking a Unicode string and making a URL of it, it should be encoded in UTF-8 and then each individual byte is subject to the %HH hex encoding. This patch reverses that to turn URLs into file names. Tested on Mac OS X 10.6 with a command line like this (it doesn't work without the -Dfile.encoding=UTF-8 option on my Mac, probably because the default encoding is MacRoman): % java -cp clojure.jar:path/to/resource -Dfile.encoding=UTF-8 clojure.main |
[CLJ-1169] Add filename and line number to defn parameter declaration error Created: 22/Feb/13 Updated: 10/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Andrei Kleschinski | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Windows |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
When mistyping parameter list in defn declaration, e.g. (defn test error message shows name of parameter (without quotes), but not function name, filename or line number: Exception in thread "main" java.lang.IllegalArgumentException: Parameter declaration some-error should be a vector |
| Comments |
| Comment by Andrei Kleschinski [ 22/Feb/13 5:39 AM ] |
|
Proposed patch for issue Also patch adds quotes around invalid symbol name in error message to make them more distinguishable from rest of message. |
| Comment by Andy Fingerhut [ 01/Mar/13 9:32 AM ] |
|
Patch 0001-CLJ-1169-proposed-patch.patch dated Feb 22 2013 causes several tests to fail. Run "./antsetup.sh" then "ant" to see which ones (or "mvn package"). |
| Comment by Andrei Kleschinski [ 01/Mar/13 10:25 AM ] |
|
Fix for failed unit-tests |
[CLJ-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-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-1112] Var *loading-verbosely* should initialize from a JVM system property Created: 21/Nov/12 Updated: 22/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Howard Lewis Ship | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | patch | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
I often find myself adding :verbose to a (require) or (use) clause of my (ns) in order to debug problems (especially macros, or bad namespace declarations). It would be very nice if I could define a JVM system property (say -Dclojure.load-verbosely=true) to default loading-verbosely to true for a REPL session, or as part of a build. Sometimes I just like to see that namespaces load as a measure of progress, when starting an application, or when running a set of tests. |
| Comments |
| Comment by Tassilo Horn [ 22/Nov/12 2:12 AM ] |
|
This patch implements the suggested feature. The new system property is called clojure.core.loading-verbosely in analogy to the existing clojure.compile.warn-on-reflection. |
[CLJ-1107] 'get' should throw exception on non-Associative argument Created: 13/Nov/12 Updated: 13/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stuart Sierra | Assignee: | Stuart Sierra |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
The implementation of clojure.core/get returns null if its argument is not a valid associative collection. However, calling 'get' on something which is neither nil nor an Associative collection is almost certainly a bug, and should be indicated by an exception. This behavior can obscure common programmer errors such as: (def a (atom {:a 1 :b 2})
(:foo a) ; forgot to deref a
;;=> nil
Attached patch 0001 throws an IllegalArgumentException as the fall-through case of RT.getFrom. |
[CLJ-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-1094] Zero-arity versions of every-pred and some-fn Created: 25/Oct/12 Updated: 25/Oct/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Tassilo Horn | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | patch, test | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
This patch adds zero-arity versions of every-pred and some-fn with these semantics. (every-pred) === (constantly true) (some-fn) === (constantly nil) These variants are useful in situations like the following: ;; compute-preds-for may return zero or many predicate fns (let [preds (compute-preds-for something)] (filter (apply every-pred preds) some-coll)) |
| Comments |
| Comment by Tassilo Horn [ 25/Oct/12 7:12 AM ] |
|
This is the thread where Max Penet suggested to have 0-arity versions of the two fns: https://groups.google.com/forum/?fromgroups=#!topic/clojure/IRlN-4LH_U0 |
[CLJ-1029] ns defmacro allows arbitrary execution of clojure.core fns Created: 23/Jul/12 Updated: 05/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2, Release 1.3, Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Craig Brozefsky | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
all |
||
| Attachments: |
|
| Patch: | Code |
| Description |
|
The form: (ns foo (:print "I AM A ROBOT")) will print "I AM A ROBOT" This is because the defmacro takes the name of the first element of the reference, looks it up in the clojure.core namespace and invokes it on the rest of the args. This is minor, but it does mean that an otherwise declarative form is not executing code. |
| Comments |
| Comment by Alan Malloy [ 25/Jul/12 4:37 PM ] |
|
One apparent problem with this patch is that you throw an exception for :refer. You should add that, and make sure there aren't any others missing. Also, #{x y z} is better than (set [x y z]), and you should probably use pr-str rather than str, although I can't think of a case where it matters for the objects in question. |
| Comment by Andy Fingerhut [ 26/Jul/12 6:31 PM ] |
|
A more minor detail of patch formatting – please attach your patch in git format. See the instructions under the section heading "Development" on this web page: http://dev.clojure.org/display/design/JIRA+workflow |
| Comment by Craig Brozefsky [ 05/Aug/12 9:53 AM ] |
|
git format-patch version of the diff, with the edits suggested by other maintainers. |
| Comment by Craig Brozefsky [ 05/Aug/12 10:00 AM ] |
|
Alan: please note that :refer was not mentioned in the docstring for ns, or used in any of the unit tests for clojure. Are you sure that it is an expected argument, or just an arrangement that happens to work under the current ns macro? The docstring for 'refer itself says to use :use in ns macros instead of calling refer. I added "refer" to the set of accepted references all the same. |
[CLJ-970] extend/implement parameterized types (generics) Created: 10/Apr/12 Updated: 01/Mar/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Jim Blomo | Assignee: | Jim Blomo |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
When extending parameterized types, class files can track the original signatures of the superclass and super interfaces so that the original types can be obtained at run time. This runtime reflection is used in some Java frameworks, and implementing it in Clojure can enable interop. See http://groups.google.com/group/clojure/browse_thread/thread/5efd692804df3f47/1336e591c2eedfa1 for examples of this request. This proposal checks the :parameters keyword in type meta information. If a parameter is found, it is added to the class signature. |
| Comments |
| Comment by Jim Blomo [ 14/Apr/12 11:30 AM ] |
|
2012-04-14 extend-implement-parameterized-types.diff is the correctly formatted `git format-patch master` for this change. It supersedes clojure-parameterized-generics.diff from 2012-04-10. |
| Comment by Andy Fingerhut [ 19/Aug/12 5:00 AM ] |
|
Patch clj-970-extend-implement-parameterized-types-patch2.txt dated Aug 19 2012 is identical to Jim Blomo's patch extend-implement-parameterized-types.diff dated Apr 14 2012, except it has updated context lines so that it applies cleanly to latest master as of today. |
[CLJ-835] defmulti doc string doesn't mention needing to be passed a var for the value of :hierarchy Created: 02/Sep/11 Updated: 19/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.2 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Hugo Duncan | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
1.2, 1.3 beta3 |
||
| Attachments: |
|
| Patch: | Code |
| Approval: | Incomplete |
| Description |
|
The :hierarchy option for defmulti should be passed a var, but this is not mentioned in the doc string. The error message from passing the hierarchy directly is rather cryptic: Evaluation aborted on java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.IRef (SOURCE_FORM_44:19). |
| Comments |
| Comment by Meikel Brandmeyer [ 14/Sep/11 3:11 PM ] |
|
Modified doctoring to clarify the usage of :hierarchy. |
| Comment by Scott Lowe [ 10/May/12 5:16 PM ] |
|
New patch: '0001-CLJ-835-Refine-doc-string-for-defmulti-hierarchy-opt.patch' 10/May/12. I've attached a new doc string patch in response to Andy Fingerhut's request posted here: https://groups.google.com/forum/?fromgroups#!topic/clojure-dev/i7H82fJYL-U Andy's request stated "Attached patch seems to have spelling mistakes, and perhaps could be worded more clearly." I hope my new patch is an improvement upon what was there. This patch supersedes '0001-Clarify-docstring-for-defmulti.patch' from 14/Sep/11. |
| Comment by Fogus [ 16/Aug/12 2:49 PM ] |
|
This is a million times better than what was there before, but (who knew!?) it could be better. A couple points of contention:
|
| Comment by Rich Hickey [ 19/Dec/12 7:58 AM ] |
|
Please leave examples out of docs strings. Use precise language. |
[CLJ-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-803] IAtom interface Created: 27/May/11 Updated: 04/Jul/11 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Approved Backlog |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Pepijn de Vos | Assignee: | Aaron Bedra |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code |
| Description |
|
Atom and the other reference types do not have interfaces and are marked final. Use cases for interfaces for the reference types include database wrappers. CouchDB behaves exactly like compare-and-set! and is shared, synchronous, independent state, so it makes sense to use the Atom interface to update a CouchDB document. I talked to Rich about this, and he said "patch welcome for IAtom", complete conversation: http://clojure-log.n01se.net/date/2010-12-29.html#10:04c |
| Comments |
| Comment by Stuart Halloway [ 27/May/11 2:33 PM ] |
|
Please add a patch formatted by "git format-patch" so that attribution is included. |
| Comment by Pepijn de Vos [ 04/Jun/11 5:56 AM ] |
|
I added the formatted patch a few days ago. Does 'no news is good news' apply here? And, silly question, will it make it into 1.3? I can't figure out how to tell Jira to show me that. |
| Comment by Kevin Downey [ 04/Jul/11 9:06 PM ] |
|
I fail to see the need for an IAtom, if you want something atom like for couchdb the interfaces are already there. Maybe I ICompareAndSwap. Atoms and couchdb are different so making them appear the same is a bad idea. http://en.wikipedia.org/wiki/Fallacies_of_Distributed_Computing http://clojure.org/state one of the distinctions between agents and actors raised in the section titled "Message Passing and Actors" is local vs. distributed and the same distinction can be made between couchdb (regardless of compare and swap) and atoms |
| Comment by Aaron Bedra [ 04/Jul/11 9:18 PM ] |
|
This ticket has already been moved into approved backlog. It will be revisited again after the 1.3 release where we will take a closer look at things. For now, this will remain as is. |
[CLJ-783] clojure.inspector/inspect-tree doesn't work on sets --patch in the description by Jason Wolfe Created: 28/Apr/11 Updated: 12/Apr/13 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.6 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Armando Blancas | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Any |
||
| Attachments: |
|
| Patch: | Code |
| Approval: | Ok |
| Waiting On: | Rich Hickey |
| Description |
|
As reported by Jason Wolfe on March 19, 2009 in the clojure group: clojure.inspector/inspect-tree doesn't work on sets; patch attached I was debugging with inspect-tree and noticed that it errors when it I made a small patch (below) that makes inspect-tree work on Cheers, Index: src/clj/clojure/inspector.clj
(defmulti is-leaf collection-tag) -(defmethod is-leaf :map [m]
(defn tree-model [data] |
| Comments |
| Comment by Andy Fingerhut [ 14/Feb/12 12:54 PM ] |
|
Created a properly formatted patch, attached, for Jason's enhancement. I tested it with (inspect-tree (:members (clojure.reflect/reflect java.lang.Math))) and it worked, whereas it had many errors without Jason's changes. |
| Comment by Andy Fingerhut [ 23/Feb/12 11:58 PM ] |
|
Jason Wolfe has signed a CA. Patch applies cleanly with latest master as of Feb 14, 2012. No errors, warnings, or test failures with the patch applied. No doc strings need updating. |
| Comment by Stuart Sierra [ 09/Nov/12 4:12 PM ] |
|
Screened. |
[CLJ-373] update-in with empty key paths Created: 04/Jun/10 Updated: 08/Sep/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Assembla Importer | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Incomplete |
| Waiting On: | Chouser |
| Description |
|
To the topic of get-in and update-in. While I realize this is not a bug it is odd and in my eyes unexpected and unwanted behavior. get-in called with an empty path returns the hashmap it was given to walk through - this is as I expect and makes a lot of sense when dynamically (with generated pathes ) walking a hash map. update-in behaves differently and while from the implementation side, it's behavior too makes sense, it does not work as expected (at least not for me) update-in with an empty map creates a new key 'nil' so: (update-in {...} [] f) ist he same as (update-in {...} [nil] f) while (get-in {...} []) is not the same as (get-in {...} [nil]) and of cause differs from what update-in does. For automatically walking trees the behavior of get-in makes a lot more sense since the current behavior of update-in forces you to check for empty paths and if they are empty fall back to plain assoc and get (or get-in since this works): (if-let [r (butlast @path)] (do (alter m update-in r dissoc (last @path)) (alter m update-in r assoc {:name @sr} c)) (do (alter m dissoc (last @path)) (alter m assoc {:name @sr} c))) Next argument is that update-in with an empty map working on nil isn't easy to gasp, one needs to know the implementation details to realize that it works, I think 90% of the people reading update-in with [] will not instinctively know that it works on the key nil, so changing this would most likely not break any current code, and if it would the code would be bad anyway Chouser has, a very nice solution on the mailing list that would fix the problem I'm not sure if I'm entitled to post it here since I did not wrote it but it can be found in this thread: http://groups.google.com/group/clojure/browse_thread/thread/de5b20b8c3fe498b?hl=en Regards, |
| Comments |
| Comment by Assembla Importer [ 08/Oct/10 10:33 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/373 |
| Comment by Chouser [ 13/Nov/10 6:37 PM ] |
|
I've attached my code from the g.group thread in the form of a patch, in case it's sufficient. (Thanks to abedra for the gentle kick in the pants.) |
| Comment by Stuart Halloway [ 29/Nov/10 8:20 AM ] |
|
Looks to me like the patch is misusing if-let, e.g. (when-let [[k & mk] []] "Doh!")
=> Doh!
Please correct, and add tests for nil and [] keys (at least). |
| Comment by Scott Lowe [ 08/May/12 12:20 PM ] |
|
I will write some tests and correct this. |
| Comment by Scott Lowe [ 09/May/12 8:39 PM ] |
|
I'm sorry to report that my good intentions of wanting to help clear some of the project backlog has created more work by way of further questions. I'd also like to clarify the desired new behaviours for the test cases. Heinz proposed that an empty key sequence will not create a new nil key in the returned map.
(update-in {1 2} [] (constantly {2 3}))
{nil {2 3}, 1 2}
(update-in* {1 2} [] (constantly {2 3}))
{2 3}
(update-in {1 2} [] assoc 1 3)
{nil {1 3}, 1 2}
(update-in* {1 2} [] assoc 1 3)
{1 3}
Chouser also added that nil keys should be honoured, as before:
(update-in* {nil 2} [nil] (constantly 3))
{nil 3}
I've added a variety of tests to cover the existing behaviour and would like to confirm that the above is all that's required for new behaviour. The patch from November 2010 didn't work, but I tweaked it with a when-let as Stuart suggested and placed a check for an empty sequence of keys before the when-let block; because essentially, the primary behaviour change boils down to simply handling an empty sequence of keys, in addition to the existing behaviours. I'm not entirely convinced that these changes are a good thing, but at least there's now something concrete for discussion. Please have a look at what is there. The good news is that at least there are some tests covering update-in now. |
| Comment by Andy Fingerhut [ 24/May/12 10:35 PM ] |
|
clj-373-alter-behavior-of-update-in-with-empty-key-patch2.txt dated May 24, 2012 supersedes patch 0001-CLJ-373 |
| Comment by Fogus [ 15/Aug/12 11:21 AM ] |
|
This patch creates a new error mode highlighted by the following: (update-in {:a 1} [] inc)
; ClassCastException clojure.lang.PersistentArrayMap cannot be cast to java.lang.Number
The reason is that the code that executes in the event that the keys are empty (or nil) blindly assumes that the function given can be applied to the map itself. This is no problem in the case of assoc and the like, but clearly not for inc and many other useful functions. The old behavior was to throw an NPE and if any code relies on that fact is now broken. Maybe this is not a problem, but I'm kicking it back to get a little more discussion and to request that whatever the ultimate fix happens to be, its behavioral changes and error modes are noted in the docstring for update-in. |
| Comment by Gunnar Völkel [ 08/Sep/12 6:11 AM ] |
|
I vote for changing `update-in` to support empty key vectors. Because I think "(apply f m args)" in case of an empty vector is the natural continuation of the usual behavior of update-in:
Otherwise, you will always have to wrap update-in in something like the following when the keys vector is computed:
To Fogus' last post: (update-in {:a {:b 1}} [:a] inc) fails similar and is not handled with a special exception. |
[CLJ-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-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-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-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-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-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-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-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-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-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-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 Created: 12/Jul/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
Ticket #137 makes math-context</code> settable at the REPL. However, <code>math-context is not a public name in Clojure. The related public function is with-precision</code> which works by pushing a new binding for <code>math-context</code>. This ticket suggests adding <code>set-precision!</code> to Clojure's public API. Its effect would be the same as <code>with-precision</code>, but accomplished by using <code>set!</code> on the current <code>math-context binding rather than by pushing a new binding. Chouser suggests that we also add a doc string for math-context</code> noting that it is private and pointing the user to <code>with-precision</code> and <code>set-precision!. I agree. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 12:55 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/153 |
[CLJ-150] Doc for array-map should mention its characteristics/caveats Created: 10/Jul/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
Doc for array-map should mention its characteristics: preserves order of keys, linear O |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 4:54 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/150 |
[CLJ-140] Single :tag for type hints conflates value's type with type of return value from an invoke Created: 01/Jul/09 Updated: 24/Aug/10 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Enhancement | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
The value of a Var can be operated on directly, or, if it is a fn, it can be invoked and the resulting value operated on. :tag metadata on a Var is used to provide a type hint to the compiler to avoid reflection. Having a single metadata key for this two distinct uses makes it possible (even easy, if unlikely) to create a situation where type-hinting the value causes a ClassCastException on an operation on the invocation return value, or the reverse. The only obvious solution is two use different keys for the two uses. |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 3:51 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/140 |
[CLJ-130] Namespace metadata lost in AOT compile Created: 19/Jun/09 Updated: 03/Dec/10 |
|
| Status: | In Progress |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Backlog |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
For example, the namespace @clojure.contrib.def@ has metadata for doc and author. We see this when we load the file directly from source: But if we load the file from the jar where it's been compiled, the metadata is lost: Even if we use @load@, we don't see metadata on the item: The jar isn't the problem, for if we use the slim jar (without the AOT This seems to be true usually, but not always. For example the |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 6:45 AM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/130 |
| Comment by Assembla Importer [ 24/Aug/10 6:45 AM ] |
|
richhickey said: Updating tickets (#127, #128, #129, #130) |
| Comment by |