--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to the Google Groups "ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.
--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev...@googlegroups.com.
To post to this group, send email to cloju...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojure-dev.
For more options, visit https://groups.google.com/d/optout.
We're seeing breakage because (I believe) of http://dev.clojure.org/jira/browse/CLJ-1499. Specifically ad-hoc maps not implementing .iterator() and post 1499 cant rely on SeqIterator.
If I've got this right, I'm surprised more people aren't seeing this?
Obviously not a bug in this release per se but perhaps something to look out for / publicize..
Some examples:
http://dev.clojure.org/jira/browse/CCACHE-41 - https://github.com/clojure/core.cache/blob/master/src/main/clojure/clojure/core/cache.clj#L57
clj-http - https://github.com/dakrone/clj-http/blob/master/src/clj_http/headers.clj#L105
Simple test-case:
user=> (use 'clojure.core.cache)
nil
user=> (def C (fifo-cache-factory {:a 1, :b 2}))
#'user/C
user=> (.iterator (keys C))
AbstractMethodError clojure.core.cache.FIFOCache.iterator()Ljava/util/Iterator; clojure.lang.APersistentMap$KeySeq.iterator (APersistentMap.java:184)
--
-Marshall
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev+unsubscribe@googlegroups.com.
To post to this group, send email to cloju...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojure-dev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev+unsubscribe@googlegroups.com.
To post to this group, send email to cloju...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojure-dev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev+unsubscribe@googlegroups.com.
-Marshall
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev...@googlegroups.com.
To post to this group, send email to cloju...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojure-dev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev...@googlegroups.com.
To post to this group, send email to cloju...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojure-dev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev...@googlegroups.com.
To post to this group, send email to cloju...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojure-dev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev...@googlegroups.com.
Ugh -- looks like the iterator value re-use behavior for EnumMap entrySet was "fixed" post Java 1.6 (my example was under Java 1.6, which I believe is still a Clojure-supported version of Java?).
I can throw together a synthetic example, but I think the people following this thread get what's happening. The point isn't whether this pattern is a "good idea" or not (it certainly isn't) but whether existing Java APIs people want to interop with use it (they certainly do).
I presently depend on no less than 3 separate Java library APIs I currently know for a fact depend on this behavior:- Hadoop ReduceContextImpl$ValueIterator- Mahout DenseVector$AllIterator/NonDefaultIterator- LensKit FastIterators
It is an option to explicitly construct `IteratorSeq` instances (I actually had verified that approach this afternoon for the Hadoop API in Parkour), but I'm not happy about it. That approach places a definite burden on integration library maintainers to implement the change, and on end-users to realize they need to upgrade for Clojure 1.7 compatibility. The `Iterator` interface just fundamentally in no way guarantees that the `next()` yielded values are functional-safe in the sense necessary to support chunking. I understand the desire to increase performance, but I don't think it's worth the potential silent and bewildering breakage in interop.
The point I was getting at is really whether you should consider this to be broken with the old behavior too.
Can you point to code for "the original behavior allowed room to transform the mutated object into an object which *could* be safely cached in a 'downstream' seq"? By what means does this transformation occur? It sounds to me like you are starting with an Iterator, creating a seq, then walking the seq exactly once, one element at a time, and producing a new transformed seq or other output.
If you did reuse that IteratorSeq, all of the elements of the sequence would point to the same object which would be in the "last" state like the java 1.6 example you gave. Thus, the "caching" capability of the seq can't possibly be something you're using. And if that's true, then why are you paying the allocation and synchronization costs of making the seq at all? Why not just use the iterator directly, thus skipping all the extra allocation that these object-reusing high-performance iterators are working so hard to avoid in the first place? In 1.7, transducers would give you exactly the capability to walk the source iterator, apply a transducer version of your transformation, and output to a collection (via into), a value (via transduce), or a lazy sequence (via sequence). I think you would find this faster as well due to reduced allocation (possibly greatly reduced depending on the transformation).