Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not sure if you would be interested in this many more patches. I removed sneaky throw patch and updated SHA tag for Clojure to the latest, since the Clojure team committed that one. #1

Merged
merged 14 commits into from Mar 30, 2012
Merged
17 changes: 17 additions & 0 deletions README.md
@@ -0,0 +1,17 @@
build.sh is a script that downloads the latest version of Clojure
core as of the day you run it.

It then "backs up" to a particular version that has been tested for
the process described below to complete successfully. See early
in the file build.sh for the SHA1 hash and date of that version.

After backing up, build.sh applies patches that attempt to address
some tickets filed against Clojure. See the file patches/patch-order.txt
for the current list. A few patches address more than one ticket,
and a few tickets are addressed by more than one patch. All patches
are from the Clojure Jira bug tracker at:

http://dev.clojure.org/jira/browse/CLJ

In some cases small modifications have been made to the patches
there, so the combination of patches will apply cleanly.
15 changes: 9 additions & 6 deletions build.sh
@@ -1,6 +1,10 @@
#!/bin/sh
#!/bin/bash

CLOJURE_SHA="b62df08fc3567d17cca68acfaa96adba2880126d"
set -e

# Latest as of March 23, 2012, after several commits were made that
# day.
CLOJURE_SHA="ba3fa7537da5c896d5d31be7ac22ab7f3e9c9a23"

[ ! -e clojure ] && git clone http://github.com/clojure/clojure

Expand All @@ -14,10 +18,9 @@ for i in `git status --porcelain|cut -d \ -f 2`; do rm -rf $i; done

git reset --hard $CLOJURE_SHA

for i in `ls ../patches`; do
echo "applying" $i
patch --strip 1 < ../patches/$i > /dev/null
[ ! 0 -eq $? ] && echo "$i failed to apply"
for i in `cat ../patches/patch-order.txt`; do
echo " applying" $i
git am --keep-cr -s < ../patches/$i
done

MAVEN_OPTS="-Djava.awt.headless=true"
Expand Down
@@ -1,14 +1,14 @@
From 0c04654bdb13e7651c571311b8909b43a7c858b5 Mon Sep 17 00:00:00 2001
From 463fadd33eb655d3acc12afff15f0f9f7875c03f Mon Sep 17 00:00:00 2001
From: Tassilo Horn <tassilo@member.fsf.org>
Date: Mon, 23 Jan 2012 14:52:00 +0100
Subject: [PATCH 10/10] Add docstring to definterface.
Date: Thu, 8 Mar 2012 10:50:39 +0100
Subject: [PATCH] Add docstring and :added metadata to definterface.

---
src/clj/clojure/core_deftype.clj | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/clj/clojure/core_deftype.clj b/src/clj/clojure/core_deftype.clj
index 72b37cf..1ab5180 100644
index 042c242..132e3b5 100644
--- a/src/clj/clojure/core_deftype.clj
+++ b/src/clj/clojure/core_deftype.clj
@@ -17,7 +17,16 @@
Expand All @@ -30,5 +30,5 @@ index 72b37cf..1ab5180 100644
(let [tag (fn [x] (or (:tag (meta x)) Object))
psig (fn [[name [& args]]]
--
1.7.8.4
1.7.8.5

48 changes: 48 additions & 0 deletions patches/0001-Implement-CLJ-207-let-as-first-for-binding-form.patch
@@ -0,0 +1,48 @@
From 67bb2c4acffd6092b78ed0164e33ddc7c15dd78c Mon Sep 17 00:00:00 2001
From: Tassilo Horn <tassilo@member.fsf.org>
Date: Thu, 22 Mar 2012 17:15:13 +0100
Subject: [PATCH] Implement CLJ-207: :let as first for binding form.

---
src/clj/clojure/core.clj | 7 +++++++
test/clojure/test_clojure/for.clj | 6 ++++++
2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
index 9cf45e6..cecbee0 100644
--- a/src/clj/clojure/core.clj
+++ b/src/clj/clojure/core.clj
@@ -4096,6 +4096,13 @@
(conj (pop groups) (conj (peek groups) [k v]))
(conj groups [k v])))
[] (partition 2 seq-exprs)))
+ ;; Special case :let as first item: Transform [:let [a x, b y] more] to
+ ;; [a [x], b [y] more].
+ seq-exprs (if (= :let (first seq-exprs))
+ (vec (concat (mapcat (fn [[lv le]] [lv [le]])
+ (partition 2 (second seq-exprs)))
+ (next (next seq-exprs))))
+ seq-exprs)
err (fn [& msg] (throw (IllegalArgumentException. ^String (apply str msg))))
emit-bind (fn emit-bind [[[bind expr & mod-pairs]
& [[_ next-expr] :as next-groups]]]
diff --git a/test/clojure/test_clojure/for.clj b/test/clojure/test_clojure/for.clj
index 6d9dc59..291ad31 100644
--- a/test/clojure/test_clojure/for.clj
+++ b/test/clojure/test_clojure/for.clj
@@ -122,6 +122,12 @@
(is (= (for [x (range 6) :let [y (rem x 2)] :when (even? y) z [8 9]] [x z])
'([0 8] [0 9] [2 8] [2 9] [4 8] [4 9]))))

+(deftest-both Let-in-Front-Position
+ (is (= (for [:let [a 1, b 2], c [3 4]] [a b c])
+ '([1 2 3] [1 2 4])))
+ (is (= (for [:let [a [1 2]], b [3 4 5]] (conj a b))
+ '([1 2 3] [1 2 4] [1 2 5]))))
+
; :while must skip all subsequent chunks as well as the remainder of
; the current chunk:
(deftest-both Chunked-While
--
1.7.8.5

32 changes: 32 additions & 0 deletions patches/0001-Print-metadata-and-anonymous-classes-better.patch
@@ -0,0 +1,32 @@
From 20dc6c25d014813da3f6662acceca26465fbe02e Mon Sep 17 00:00:00 2001
From: Alan Malloy <alan@malloys.org>
Date: Tue, 10 Jan 2012 15:15:26 -0800
Subject: [PATCH] Print metadata and anonymous classes better

---
src/clj/clojure/core_print.clj | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/clj/clojure/core_print.clj b/src/clj/clojure/core_print.clj
index 641c707..31efd35 100644
--- a/src/clj/clojure/core_print.clj
+++ b/src/clj/clojure/core_print.clj
@@ -88,9 +88,13 @@
(.write w ")"))

(defmethod print-method Object [o, ^Writer w]
+ (when (instance? clojure.lang.IMeta o)
+ (print-meta o w))
(.write w "#<")
- (.write w (.getSimpleName (class o)))
- (.write w " ")
+ (let [name (.getSimpleName (class o))]
+ (when (seq name) ;; anonymous classes have a simple name of ""
+ (.write w name)
+ (.write w " ")))
(.write w (str o))
(.write w ">"))

--
1.7.4.1

28 changes: 28 additions & 0 deletions patches/0002-report-load-exceptions-with-file-and-line.diff
@@ -0,0 +1,28 @@
From 4f0b299d2ae2e9346a47dda25dfc3ee74d00e65f Mon Sep 17 00:00:00 2001
From: Hugo Duncan <hugo@hugoduncan.org>
Date: Fri, 24 Feb 2012 13:00:23 -0500
Subject: [PATCH] Report Exceptions thrown in load with file and line number

Fixes #15
---
src/jvm/clojure/lang/Compiler.java | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java
index d41624d..f7d624f 100644
--- a/src/jvm/clojure/lang/Compiler.java
+++ b/src/jvm/clojure/lang/Compiler.java
@@ -6907,6 +6907,10 @@ public static Object load(Reader rdr, String sourcePath, String sourceName) {
{
throw new CompilerException(sourcePath, e.line, e.getCause());
}
+ catch(Exception e)
+ {
+ throw new CompilerException(sourcePath, (Integer)LINE_BEFORE.deref(), e);
+ }
finally
{
Var.popThreadBindings();
--
1.7.7.3