Now that clojure maps are Java Maps, it is easier to inter-operate
with Java code that has methods that take a Map as one of its
arguments, because you can just pass the Map right into the Java
code.  The problem is that often times, the Java method is expecting
the Map to have String values in the keys, definitely not clojure's
Keywords.  So if you have a {:foo 1} clojure map that you pass to a
Java method, which then calls map.get("foo"), you won't find that
value.

Does anyone have any suggestions for how to handle this?  You could
just use Strings for the keys in the clojure map, but then that map
might not work with other clojure functions that expect the keys to be
Keywords, not Strings.  You could pass the map through a function that
converts the Keywords to Strings before using it in Java, but I
thought that was the whole point of making clojure maps implement Map,
so I wouldn't have to do (jmap {:foo 1}) everytime I want to pass a
Map to Java.

I'm wondering if there is some way to make a clojure Map be smart
enough to return the value even if you give it string.  Probably not,
because then what do you do with {:foo 1 "foo" 2}.  Anyway, just
wondering if anyone else has run into this Keyword/String mismatch
problem and if you have an elegant solution.


--~--~---------~--~----~------------~-------~--~----~
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