svn r1370 appears to have broken binding

3 views
Skip to first unread message

Stephen C. Gilardi

unread,
May 25, 2009, 5:35:28 AM5/25/09
to clo...@googlegroups.com
With svn r1370, I get this:

% java -cp clojure.jar clojure.main
Clojure 1.1.0-alpha-SNAPSHOT
user=> (def a)
#'user/a
user=> (binding [a 4] a)
java.lang.IllegalStateException: Var user/a is unbound.
(NO_SOURCE_FILE:0)
user=>

With svn r1369, I get this:

% java -cp clojure.jar clojure.main
Clojure 1.1.0-alpha-SNAPSHOT
user=> (def a)
#'user/a
user=> (binding [a 4] a)
4
user=>

I expected the r1369 behavior.

--Steve

Frantisek Sodomka

unread,
May 25, 2009, 7:11:34 AM5/25/09
to Clojure
Hello Steve!

When I write a test for binding for this case (using deftest) and run
test_clojure, it doesn't error out. I wonder why is that?

(def a)
(deftest test-binding
(are (= _1 _2)
(binding [a 4] a) 4 ; regression in Clojure SVN r1370
))

Frantisek

PS: Rich, have you seen my bug report?
Minor bug in int-array, long-array, float-array and double-array
http://groups.google.com/group/clojure/browse_frm/thread/0f4e5090770d8a5a#
>  smime.p7s
> 3KViewDownload

Rich Hickey

unread,
May 25, 2009, 8:05:08 AM5/25/09
to clo...@googlegroups.com

Fixed in 1373 - thanks for the report!

Rich

Stephen C. Gilardi

unread,
May 26, 2009, 3:27:28 PM5/26/09
to clo...@googlegroups.com
Hi Frantisek!

On May 25, 2009, at 7:11 AM, Frantisek Sodomka wrote:

> (def a)
> (deftest test-binding
> (are (= _1 _2)
> (binding [a 4] a) 4 ; regression in Clojure SVN r1370
> ))


I see those tests going in over time... Thanks so much for making them!

The checkin notes for this change mention "top level". I suspect
that's related to why the test you posted gave a false pass.

We can use eval to bring the test up to the top level:

(def a)
(deftest test-binding
(are (= _1 _2)

(eval `(binding [a 4] a)) 4 ; regression in Clojure SVN r1370
))

This passes with r1375 and fails with r1370.

Will this be our first test in clojure-contrib.test-clojure.vars?

Feel free to check this in or let me know if you'd like me to.

Thanks,

--Steve

Frantisek Sodomka

unread,
May 27, 2009, 7:59:13 AM5/27/09
to Clojure
Thanks for the help and your feedback, Steve!

Clojure needs some unit tests and I like writing them, so it is a win-
win situation :-)

Yes, this is our first test in clojure-contrib.test-clojure.vars. I
checked it in together with other changes as revision 846.

Frantisek
>  smime.p7s
> 3KViewDownload

Rich Hickey

unread,
May 27, 2009, 10:43:22 AM5/27/09
to Clojure


On May 27, 7:59 am, Frantisek Sodomka <fsodo...@gmail.com> wrote:
> Thanks for the help and your feedback, Steve!
>
> Clojure needs some unit tests and I like writing them, so it is a win-
> win situation :-)
>

Let me add my thanks as well - this is a great (and otherwise
thankless :) contribution.

I also wanted to let you know: I'm running your tests, so your work is
not in vain.

Many thanks,

Rich
Reply all
Reply to author
Forward
0 new messages