<< Back to previous view

[TRDR-13] Better documentation wrt interaction between reader-types and java readers Created: 11/Apr/14  Updated: 11/Apr/14

Status: Open
Project: tools.reader
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Nicola Mometto Assignee: Nicola Mometto
Resolution: Unresolved Votes: 0
Labels: None

[TRDR-14] Feature Expressions Created: 15/May/14  Updated: 21/Jan/15

Status: Open
Project: tools.reader
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Major
Reporter: Ghadi Shayban Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Attachments: File tools.reader-feature-expressions-2.diff     File tools.reader-feature-expressions-3.diff     File tools.reader-feature-expressions.diff     File trdr-14-4.diff    
Patch: Code and Test


Feature expressions based directly on Common Lisp.

Implementation based on Roman's patch for CLJS-27. #+ #- and or not are supported. Unreadable tagged literals are suppressed through *suppress-read*.

For example, reading the following with features set to #{:clj} returns :baz

#+bad/platform #foo bar :baz

Initial feature names for each platform will be clj, cljs, and cljr.

CLJ-1424 is the accompanying patch for Clojure.

Patch: trdr-14-4.diff

Comment by Nicola Mometto [ 19/May/14 6:56 PM ]

I looked over the patch and it mostly looks good, a few comments:

  • does *suppress-read* need to be exposed?
  • can you add a docstring for *features*?
  • should *suppress-read* affect read-eval?

That said, has it been decided that this is how feature expressions will be implemented in 1.7?
If not, I'm going to wait to merge this in until a decision is taken, this is a major design point and I don't want to diverge from the official clojure take on this even for a single release: people might start using it, especially since t.r is now the default reader for cljs.

Comment by Ghadi Shayban [ 19/May/14 7:23 PM ]

Yes thank you for not merging. This is WIP and just one approach for feature expressions. There seem to be at least two couple diverging approaches emerging from the various discussion (Brandon Bloom's idea of read-time splicing being the other.) I would definitely not merge until the community and Rich weighs in.

In any case having all Clojure platforms be ready for the change is probably essential. Also backwards compatibility of feature expr code to Clojure 1.6 and below is also not trivial.

1) *suppress-read* probably doesn't need to be exposed
2) *suppress-read* should probably imply *read-eval* false. You wouldn't want read-ctor to load any classes or call any code or constructors

Comment by Alex Miller [ 04/Aug/14 12:56 PM ]

Updated patch to reflect clj and cljs as initial feature names.

Comment by Alex Miller [ 21/Jan/15 4: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.

Generated at Fri Mar 27 17:15:54 CDT 2015 using JIRA 4.4#649-r158309.