Welcome! Please see the About page for a little more info on how this works.

+1 vote
ago in tools.reader by

In a thread for the clojure source editing library rewrite-clj, we've been discussing the possibility to allow for paring/reading technically invalid clojure data (symbols with multiple forward slashes, numbers with underscores or letters, unbalanced maps, etc).

Given that tools.reader is a foundational library for rewrite-clj and many other clojure source-focused libraries and tools, it seems worthwhile for all of us to share functionality instead of splitting off or all forking/reimplementing large parts of tools.reader to achieve the same goals.

Would there be interest in supporting reading technically invalid clojure code behind a config option or feature flag?

1 Answer

0 votes
ago by

What would that mean? What would it return when reading invalid code?

ago by
Well, that's part of the discussion. Right now, `tools.reader` (and edamame) returns a clojure object (symbol, keyword, map, etc) or throws. there are a number of ways we could potentially expand `tools.reader` to return invalid code in a way that still works for users, such as an InvalidToken record or java object holding the invalid tokens or objects. but i'm only going to put in that work if you think it's worthwhile. otherwise, i'll solve it in the other libraries.
ago by
not opposed to doing it in tools.reader, especially if that avoids duplicating a lot of work
...