ExceptionInInitializerError in eval with user defined functions

7 views
Skip to first unread message

gun43

unread,
Nov 14, 2009, 1:08:49 PM11/14/09
to Clojure
Using r1366 under Win XP.

A user defined function:
1:27 user=> (defn plus2 [x] (+ x 2))
#'user/plus2
1:28 user=> (plus2 5)
7

can only be eval'd
1:29 user=> (list plus2 5)
(#<user$plus2__217 user$plus2__217@4d76b4> 5)
1:30 user=> (eval (list plus2 5))
java.lang.ExceptionInInitializerError (repl-1:30)

when passed with #'
1:31 user=> (list #'plus2 5)
(#'user/plus2 5)
1:32 user=> (eval (list #'plus2 5))
7

in contrast to a core function
1:33 user=> (inc 5)
6

which works without
1:34 user=> (list inc 5)
(#<core$inc__3416 clojure.core$inc__3416@ded0f0> 5)
1:35 user=> (eval (list inc 5))
6

and with #'.
1:36 user=> (list #'inc 5)
(#'clojure.core/inc 5)
1:37 user=> (eval (list #'inc 5))
6

This is a real problem for anonymous functions.
1:38 user=> (#(+ % 2) 5)
7
1:54 user=> (list #(+ % 2) 5)
(#<user$eval__277$fn__279 user$eval__277$fn__279@1f99eea> 5)
1:55 user=> (eval (list #(+ % 2) 5))
java.lang.ExceptionInInitializerError (repl-1:55)

Is this a bug or am I doing something wrong.
This stuff all worked under r1338.

Jarkko Oranen

unread,
Nov 14, 2009, 2:18:52 PM11/14/09
to Clojure


On Nov 14, 8:08 pm, gun43 <bg-561...@versanet.de> wrote:
> Using r1366 under Win XP.
r1366? From Subversion? That's ancient. Clojure moved to git ages ago;
see
http://github.com/richhickey/clojure
I had no idea that this worked at all. Usually eval evaluates lists of
symbols and other primitives, eg.
(eval (list 'user2 2 3)). Hm. Anyway, try upgrading your Clojure. :)

--
Jarkko

gun43

unread,
Nov 16, 2009, 6:32:26 AM11/16/09
to Clojure
r1366 was also known as Clojure 1.0.0 It turns out that these problems
only occur with the clojure.jar distributed with clojuredev 0.0.37
(now Counterclockwise) which also claims to be Clojure 1.0.0

On Nov 14, 8:18 pm, Jarkko Oranen <chous...@gmail.com> wrote:
> On Nov 14, 8:08 pm, gun43 <bg-561...@versanet.de> wrote:> Using r1366 under Win XP.
>
> r1366? From Subversion? That's ancient. Clojure moved to git ages ago;
> seehttp://github.com/richhickey/clojure
Reply all
Reply to author
Forward
0 new messages