I agree that things will be fine if the third-party code uses namespace-qualified keywords, but there can be clashes if the third-party library uses simple keywords.
On Wednesday, 10 April 2013 20:55:18 UTC+1, Cedric Greevey wrote: > > I don't think that creates a need for qualified defrecord "base keys" (the > [x y z] in your example) though. Those keys are all from one origin: the > piece of code with the defrecord itself in it. That piece is defining the > data type and it stands to reason that it be privileged to specify > unqualified keywords for use with that type. > > If an instance of the record type ends up being "promiscuous", the keys > introduced by third-party code will by definition not be (intended to be) > the same as any of the base keys, and so will be optional keys (ordinary > map keys rather than mandatory record fields). Those can still be > namespace-qualified: > > testchamber.core=> (defrecord Foo [a b]) > testchamber.core.Foo > > testchamber.core=> (Foo. 3 4) > {:a 3, :b 4} > > testchamber.core=> (assoc (Foo. 3 4) ::bar 42) > {:a 3, :b 4, :testchamber.core/bar 42} > > > > On Wed, Apr 10, 2013 at 3:38 PM, Simon Katz <nomi...@gmail.com<javascript:> > > wrote: > >> Yes. That concept of a promiscuous map (great name) is what I'm trying >> to get at. >> >> >> On Wednesday, 10 April 2013 20:30:52 UTC+1, Cedric Greevey wrote: >> >>> The main use for qualified keywords that occurs to me is if you have a >>> "promiscuous map" that will be holding key/value pairs submitted by >>> multiple pieces of code of distinct origins. A big registry of preferences >>> that can be added to by plugins would be an example, with qualified >>> keywords making it much less likely for two plugins to be made that are >>> incompatible with each other because they keep overwriting each others' >>> preferences. >>> >>> >>> On Wed, Apr 10, 2013 at 9:13 AM, Jim foo.bar <jimpi...@gmail.com> wrote: >>> >>>> On 10/04/13 14:03, Simon Katz wrote: >>>> >>>>> Second, Clojure supports namespace-qualified keywords, presumably >>>>> because it's possible that different libraries might want to use the same >>>>> keyword for different purposes. >>>>> >>>> >>>> I don't think that is the reason for having namespace-qualified >>>> keywords...different libraries might want to use the same keyword for >>>> different purposes and that is fine - no clashes (or at elast I've not >>>> understood what you mean). >>>> >>>> It's my understanding that ::foo has (or should have) actual 'meaning' >>>> in whatever namespace it exists whereas :foo doesn’t really have any >>>> 'meaning'. >>>> >>>> I don't really think you want to access your record fields with a >>>> namespace-qualified keyword, do you? How would that work exactly? what if >>>> you got an instance of the record outside the namespace where the >>>> namespace-qualified keyword is defined? It doesn't make sense to me at >>>> all... >>>> >>>> Jim >>>> >>>> >>>> -- >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Clojure" group. >>>> To post to this group, send email to clo...@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+u...@**googlegrou**ps.com >>>> >>>> For more options, visit this group at >>>> http://groups.google.com/**group**/clojure?hl=en<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+u...@**googlegrou**ps.com. >>>> >>>> For more options, visit >>>> https://groups.google.com/**grou**ps/opt_out<https://groups.google.com/groups/opt_out> >>>> . >>>> >>>> >>>> >>> -- >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com<javascript:> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com <javascript:> >> 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+u...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- -- 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.