Is this intended behavior, perhaps due to some trickiness in implementing it correctly?
Or perhaps it is just something not implemented yet?
It seems that this behavior is the underlying reason for CLJ-916:
http://dev.clojure.org/jira/browse/CLJ-916
It also seems like there are several opportunities in the Clojure code for using transients where they are not today, but that doing so would cause metadata to be lost in those cases, too, unless this behavior were changed.
Thanks,
Andy
Clojure 1.3.0
user=> (def x ^{:foo 1 :bar "x"} [1 2 3])
#'user/x
user=> (meta x)
{:foo 1, :bar "x"}
user=> x
[1 2 3]
user=> (def y (transient x))
#'user/y
user=> y
#<TransientVector clojure.lang.PersistentVector$TransientVector@4c272961>
user=> (meta y)
nil
user=> (def z (persistent! y))
#'user/z
user=> (meta z)
nil
user=> z
[1 2 3]
--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To view this discussion on the web visit https://groups.google.com/d/msg/clojure-dev/-/R-VvIv0Q0QsJ.
To post to this group, send email to cloju...@googlegroups.com.
To unsubscribe from this group, send email to clojure-dev...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/clojure-dev?hl=en.
Andy
Sean
Agreed. In the base case, just copy the metadata map into the persistent collection at the end.
But I'm also not seeing why it would be a performance penalty to be able to bash the metadata on a transient collection.
Paul