Reader conditionals

Description

Reader conditionals

See: http://dev.clojure.org/display/design/Reader+Conditionals

is the accompanying patch for Clojure.

Patch: trdr-14-5.patch

Environment

None

Activity

Show:
Alex Miller
January 21, 2015, 10:34 PM

Attached new patch trdr-14-4.diff that uses an explicit options map with a :features key to a set of features. These changes match the latest changes in clj-1424, which are patterned after a similar implementation in the Clojure edn reader.

Alex Miller
April 8, 2015, 8:10 PM

trdr-14-5 patch is a port of the reader conditional patch at CLJ-1424. It was no fun.

Alex Miller
April 8, 2015, 8:22 PM

two things I'm uncomfortable with:
1) use of LinkedList. it matches the Clojure version but relying on that stateful Java class is gross.
2) the READ_EOF and READ_FINISHED definitions - it's probably better to use (Object.) and identical? than what I'm doing now.

Alex Miller
April 8, 2015, 9:22 PM

From Nicola: return-on-value is always READ_FINISHED - can we hard-code and remove from the signature?

Nicola Mometto
April 8, 2015, 11:11 PM

WIP in the reader-conditionals branch https://github.com/clojure/tools.reader/tree/reader-conditionals
The additional commits on top of 7db11b110770d7c3925194a89baa8b8a773bf431 address the concerns reported by Alex in previous comments (except the use of LinkedList) and make tools.reader use the existing ReaderConditional and TaggedLiteral when available, fallbacking to a custom version when not.

This is the same approach tools.reader uses for ExceptionInfo on clojure 1.3.0 and seems to me a better approach than using different types than clojure itself (when they are available) but I'd like some feedback on this (commit 2c3adbe4c4f0fab8087380ff0dbb1ad44c8739e1)

The additional commits also fix a couple of bugs wrt handling of eof

Completed

Assignee

Unassigned

Reporter

Ghadi Shayban

Labels

None

Approval

Vetted

Patch

Code and Test

Priority

Major