So to answer my own question, this is in 1.4.0.
Here is an example:
(binding [*data-readers* {'user/f (fn [x] (java.io.File. (first x)))}]
(read-string "#user/f [\"hello\"]"))
returns
#<File hello>
On the best way to pass types around, though, I still think this is an open
question.
The problem is that, currently, the default print behavior of java objects
is an unreadable form like
#<java.class.name args>
I think there should be discussion about defaulting this to
#java.class.name [args*]
this form is still unreadable by default, but with tagged literals, allows
users to define custom reader behavior per class.
Either that or is there a way to alter the printing behavior of java
objects locally, instead of globally as when defining a print-method for
that type?
On Saturday, March 17, 2012 5:05:40 PM UTC-4, Brent Millare wrote:
>
> So I just watched the Clojure conj keynote 2011 and I am particularly
> interested in the extensible reader component. Is there anything of this
> available for testing in master or 1.4.0-beta*? What's the best way to pass
> around java types in the reader like <java.io.File>s?
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en