Musing over Namespaces

David Megginson david at megginson.com
Tue Dec 14 21:26:40 GMT 1999


"Don Park" <donpark at docuverse.com> writes:

> I started with the question: "Why isn't there namespaces
> in normal languages like English?"  A boring and divergent
> question.

Yes, that's an interesting difference between natural and formal
languages.  Formal languages used for programming, like Java, Perl,
and (more recently) C++, all use their own versions of namespaces.
The challenge is deciding where to put XML in that spectrum.

> Is it really a 'good thing' to have namespaces in XML?  

Probably -- at least, my instincts tell me that it is.  I think that
at least some of the benefits that have accrued to Java and Perl from
having packages can also accrue to XML.  Can you imagine any
significant number of independently-developed modules at CPAN if Perl
put all function and variable names into the same package?

> What ill effect will it have on XML's future?

I don't see a lot of ill coming from putting names into packages.  In
the C and pre-ANSI C++ world, people tried to avoid collisions by
using ad-hoc prefixes, so that every function in a library might start
with "bt_" or "mm_" -- that worked about 95% of the time, and blew up
the other 5% (I know, because I still have scars from the shrapnel).

> Why can't the semantic of '<name>' be determined purely by context?

That's fine if the document itself is the atomic unit, as it was in
the SGML world, and if there's some standard way to determine the
document type.

> What is wrong with using just <html> to distinguish HTML's use of
> 'a' tag?  

The idea is that we can reuse HTML <a> in other document types, like
(say) NITF or an XML schema language.  If you rely on the <html> root
element, that won't work.

What about something like <doc> -- would you allow only one element
type to use that?

> Is the ability to inject attributes from other namespaces really
> useful?  

I think so -- at least, it's very useful in RDF, because I can build
generic RDF engines that can do something useful with

  <megg:Thingy rdf:about="http://www.foo.com/ids/111">
    <megg:someProperty rdf:resource="http://www.foo.comm/ids/222"/>
  </megg:Thingy>

even if I don't know anything about the class.  Some people also like
the lang and space attributes from the XML Namespace, though I haven't 
found much use for them myself yet.

> What is the possitive effect of having just one namespace?

Hard to say, really -- I programmed for over a decade without package
names (namespaces), and I would never want to go back.  In SGML, we
were already experimenting with Architectural Forms, so there was a
demonstrated need for some kind of Namespace partitioning even before
XML came along.

> Why can't we have central registry of XML names?

I don't think that the XML world needs its own Network Solutions.
Hmmm .. actually, maybe I could squat on element names like "task" and
"work-order" until GM pays me $2M for them.


All the best,


David

-- 
David Megginson                 david at megginson.com
           http://www.megginson.com/

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list