A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on IRC (such as one of these permanent autoconfirmed members).

Difference between revisions of "Why no namespaces"

From WHATWG Wiki
Jump to: navigation, search
m
m (Blockquote)
Line 10: Line 10:
 
An unfairly short summary is that:
 
An unfairly short summary is that:
  
: Short names like "rdf:" or "foaf:" often work OK, if they are treated as globally unique.  But by definition, they aren't globally unique, and they really can't be.  In some cases, HTML has opted to define prefixes itself (such as aria-*), but the general XML solution is to use a URL.   
+
<blockquote><div>
 +
Short names like "rdf:" or "foaf:" often work OK, if they are treated as globally unique.  But by definition, they aren't globally unique, and they really can't be.  In some cases, HTML has opted to define prefixes itself (such as aria-*), but the general XML solution is to use a URL.   
  
: Long namespace names, including URLS, are a pain to type, make the code unreadable, and are magnets for cut-and-paste editing which sometimes ends up invalidating the use anyhow.
+
Long namespace names, including URLS, are a pain to type, make the code unreadable, and are magnets for cut-and-paste editing which sometimes ends up invalidating the use anyhow.
 +
</div></blockquote>
  
 
See also: [[Namespace confusion]]
 
See also: [[Namespace confusion]]

Revision as of 10:16, 18 October 2009

In most of computer science, namespaces are a wonderful invention and greatly simplify maintenance.

XML namespaces were intended to provide these advantages to markup languages, and they have had some success within XML, perhaps because its draconian error-handling encourages careful use.

Unfortunately, XML namespaces don't work so well in HTML -- in practice, the web is more like a bunch of piles than like a well-organized filing cabinet.

Maciej Stachowiak explained some of the problems very well in http://lists.w3.org/Archives/Public/public-html/2009Jul/0919.html

An unfairly short summary is that:

Short names like "rdf:" or "foaf:" often work OK, if they are treated as globally unique. But by definition, they aren't globally unique, and they really can't be. In some cases, HTML has opted to define prefixes itself (such as aria-*), but the general XML solution is to use a URL.

Long namespace names, including URLS, are a pain to type, make the code unreadable, and are magnets for cut-and-paste editing which sometimes ends up invalidating the use anyhow.

See also: Namespace confusion