Replying to myself...

Hmmm, of course, defining that function wouldn't solve the problem of 
clashes.

On Wednesday, 10 April 2013 14:03:47 UTC+1, Simon Katz wrote:
>
> I'm wondering how two things fit together (and I suspect they don't).
>
> First, if I define a record type, e.g.
>   (defrecord Foo [x y z])
> I can access fields using keywords as functions:
>   (:x (->Foo 1 2 3)) => 1
>
> Second, Clojure supports namespace-qualified keywords, presumably because 
> it's possible that different libraries might want to use the same keyword 
> for different purposes.
>
> But if I use defrecord I get unqualified keywords, and the possibility of 
> clashes with other libraries.
>
> I guess I could define my API to not include the keywords and define an 
> API function like this:
>   (defn x [foo] (:x foo))
> but I'm not sure I like that much.
>
> Are there better or more idiomatic approaches?
>

-- 
-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to