load-string string length limitation

122 views
Skip to first unread message

Alexander Kjeldaas

unread,
Oct 18, 2008, 11:42:00 AM10/18/08
to Clojure
The following fails for me:

(load-string
(format "(quote (%s))"
(nth (iterate #(format "%s%s" % %) "(1 2 3 4)") 13)))
java.lang.ClassFormatError: Unknown constant tag 32 in class file user/
eval__2485 (NO_SOURCE_FILE:0)

With 12 as the argument to nth, it works.

Alexander

Rich Hickey

unread,
Oct 18, 2008, 12:01:49 PM10/18/08
to Clojure


On Oct 18, 11:42 am, Alexander Kjeldaas <alexander.kjeld...@gmail.com>
wrote:
In moving to ahead-of-time compilation there are now limits to the
size of data structures that can be embedded in code, since they have
to be included in the class files. In most cases, large data
structures can be saved separately and then read, with read. For the
case above, which is just the representation of a data literal as a
string, I've also added read-string:

(read-string
(format "(%s)"
(nth (iterate #(format "%s%s" % %) "(1 2 3 4)") 13)))

The reader is a fine and sufficient tool for reading data structures -
there's no need to involve the compiler. load should be reserved for
for code from now on.

Rich

Alexander Kjeldaas

unread,
Oct 20, 2008, 4:56:21 AM10/20/08
to clo...@googlegroups.com

Thanks for the updates!

Alexander

2008/10/18 Rich Hickey <richh...@gmail.com>
Reply all
Reply to author
Forward
0 new messages