On Thu, Dec 11, 2008 at 7:49 PM, Robert Koberg <r...@koberg.com> wrote:
> > Hi, > > Would it be desirable to further define keywords such that it allows a > special kind of namespacing. > > * This could allow for more efficient (for the user) and targeted > navigation over large, nested collections. > * It would allow for mixing related data that might need to be treated > in different ways. > * It could provide the building blocks for a collection transformation > language > > For example: > > :keyword or :nil:keyword - defines a keyword in a null namespace > -- keeps backward compatibility > -- equivalent to the XML element <foo/> (no namepsace defined) > > ::keyword - defines a namespaced keyword in a default namespace > -- equivalent to the XML element <foo xmlns="http://some/namespace"/> > > :myns:keyword - defines a namespaced keyword in a named namespace > -- equivalent to the XML element <foo xmlns:myns="http://some/namespace > "/> > > Perhaps a requirement for this type of thing would be that the > namespaces need to be declared on the root element of the (nested) > collection. > Keywords can already be namespace-qualified: user=> (namespace :foo) nil user=> (namespace :my-ns/foo) "my-ns" user=> (namespace ::foo) "user" The idea of using this feature to specify XML namespaces has been discussed. Rich even adjusted the reader rules to allow fully-qualified URLs as namespaces: user=> (namespace :http://n01se.net/chouser/tag) "http://n01se.net/chouser" This should allow something to parse XML and produce a tree of Clojure collections representing it with full namespace qualifications, though to my knowledge this hasn't been done yet. --Chouser --~--~---------~--~----~------------~-------~--~----~ 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 clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---