edn-format / edn

Extensible Data Notation
2.61k stars 96 forks source link

Make the tag output capable of be consumed by another tag or specify it can't #36

Closed nahuel closed 10 years ago

nahuel commented 12 years ago

Suppose you have defined the #x/table tag which takes a list with a header and rows to increase a little the readability and diminish the data length:

 #x/table ((:name   :surname  :age)
           ("bob"   "smith"   33)
           ("miles" "davis"   83)
          )

This tag will yield the list ({:name "bob" :surname "smith" :age 33}, {:name "miles" :surname "davis" :age 83}). My question is: can you give this output value as an input to another tag handler? Like by doing:

#x/othertag #x/table ((:name   :surname  :age)
                      ("bob"   "smith"   33)
                      ("miles" "davis"   83)
                     )

By reading the EDN spec I think is not clear if you can compose tags or not, maybe the phrase "This value is the value to be returned to the program and is not further interpreted as edn data by the reader." prohibits it.

So, will the reader pass the value returned by the #x/table handler as the input of the #x/othertag handler? That will be nice, in any case needs to be clear in the spec if is permitted or not.

nahuel commented 12 years ago

Note, I saw today you can chain tags in the clojure 1.4 reader exactly this way. So it's only matter of adding a note about the chaining behaviour to the EDN spec :)