cljfmt
cljfmt copied to clipboard
Support for collapsing multiple metadata expressions
Forms such as ^:foo ^:bar ^:baz qux are legitimate, as are forms which mix multiple reader metadata ala ^{:foo 3 :bar 6} ^:baz ^{:qux 7} zork. However reading such forms is nontrivial because of the left-to-right merge behavior of the reader as well as simple lexical volume.
I propose that the format of two or more nested meta expressions should be by convention the ^{} equivalent, with special exception made for ^foo type tags.
So:
^:a ^:b ...->^{:a true :b true} ...^{:a 3} ^:b ...->{:a 3 :b true} ...^:b ^{:a 3} ...->{:a 3 :b true} ...
But:
^String ^:a foounchanged^String ^:a ^:b foo->^{:a true :b true} ^String foo^{:a true :b true :tag String} foo->^{:a true :b true} ^String foo
I don't mind having this as an option, but I don't think it should be the default.