On Sep 30, 11:17 am, Rich Hickey <[EMAIL PROTECTED]> wrote:
> On Sep 30, 5:04 am, Achim Passen <[EMAIL PROTECTED]> wrote:
>
> > On Sep 30, 5:20 am, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote:
>
> > > After some more thought, I'm not sure whether this should be a concern
> > > or not. Since jmap's purpose is to wrap Clojure maps for passing to
> > > Java APIs, I'm not sure when it will be necessary to compare jmaps to
> > > Clojure maps. In the abstract, it would be nice if they could be
> > > compared for equality, but I'm not sure how important this is in
> > > practice.
>
> > I tend to agree. In most cases there should be no doubts whether a map
> > at hand is wrapped or not. If otherwise, you could safely unwrap both
> > via cmap (that's the reason why i wrote cmap to act "forgivingly" when
> > not applied to jmaps) and then compare afterwards.
>
> I've been thinking about this Map vs Collection issue for a while now
> and am considering making the move to: Clojure maps implement Java
> Map.
>
> The jmap workaround highlights the awkwardness of not aligning with
> Java here.
>
> My current thoughts are:
>
> - Java Maps not being Java Collections is truly sad, but not something
> I can do anything about.
>
> - For consumption from the Clojure side, I can hide that difference in
> coll?, count, to-array etc.
>
> - Code that looks for Collection currently matches Clojure maps but
> wouldn't anymore. It never matched Java Maps. clojure code should move
> to coll?, and for Java code I can provide RT.isCollection for
> replacing instanceof calls.
>
> - Using the ad hoc hierarchy support, I can unify Collection and Map
> by deriving both from :Collection, thus allowing matches for all
> collections in multimethods etc.
>
> - The real reason to implement Java interfaces is to support use from
> Java, where the limitations of Maps not being Collections is already a
> fact of life, and Clojure maps not implementing Map a problem.
>
> - If I'm going to do this, the sooner the better.
>
> Any change in this area may involve some breakage, but I'm confident
> there will be all necessary facilities to move existing code.
>

I've made maps implement java.util.Map
unified equality and hashCode semantics for sets/maps/lists with
java.util
enabled sort on all colls and strings
enabled to-array on Maps

In SVN rev 1052

Rich

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to