The empty map literal is read as a different map each time

Description

As reported here (https://groups.google.com/forum/?hl=en#!topic/clojure-dev/n83hlRFsfHg), the empty map literal is read as a different map each time.

Making the reader return the same empty map when it reads an empty map is expected to improve some memory efficiency, and also lead to consistency with the way other collection literals are read in.

Cause: LispReader calls RT.map() with an empty array when it reads an empty map, and RT.map() in turn makes a new map unless its argument given is null.

Approach: make RT.map() return the same empty map when the argument is an empty array as well, not only when null

Patch: 0002-make-the-reader-return-the-same-empty-map-when-it-re.patch

Screened by: Alex Miller

Environment

None

Activity

Show:
Shogo Ohta
March 1, 2014, 8:59 AM

Sorry, the patch 0001-make-the-reader-return-the-same-empty-map-when-it-re.patch didn't work.

The updated patch 0002-make-the-reader-return-the-same-empty-map-when-it-re.patch works, but I'm afraid it'd be beyond the scope of this ticket since it modifies RT.map() behavior a bit.

Completed

Assignee

Unassigned

Reporter

Shogo Ohta

Labels

Approval

Ok

Patch

Code

Fix versions

Affects versions

Priority

Major
Configure