Re: Publishing a new draft (HTML5+RDFa)

On Jul 31, 2009, at 1:59 AM, Michael Hausenblas wrote:

> Ian,
>
>>>> For example, the use of prefixes
>>>
>>> If I understand you correctly, the use of prefixes is a "personal
>>> preferences based on design philosophy" disagreement that you have  
>>> as
>>> you have yet to produce a technical problem with the use of  
>>> prefixes.
>>> How does that feature break UAs?
>>
>> I don't understand what you mean by "break UAs".
>>
>> Prefixes are widely documented to be an antipattern in language  
>> design.
>> For example, see this e-mail:
>>
>>   http://lists.w3.org/Archives/Member/w3c-archive/2009Jul/0125.html
>>
>> ...where I give a quite detailed analysis of why prefixes are a  
>> feature of
>> poor language design.
>
> With my RDFa TF and DERI AC Rep hat off I must say I don't  
> understand this.
> I indeed took a look at the provided references (interesting) but  
> fail to
> see the deeper problem.
>
> Let me step back.
>
> I'm not talking about prefixes/XMLNS now, but about namespaces in  
> the sense
> of [1]. In my understanding *every* 'decentralised' language (be it a
> programming language such as Java or a markup language such as XML- 
> based
> things) needs a mechanism to unambiguously assign global names to  
> locally
> defined items. This is the context necessary to deal with the  
> decentralised
> aspect: everyone's free to come up with a 'System' class, e.g., in  
> Java -
> and you put it in your package, say. org.deri.commons.System, and  
> hence both
> machines and humans know, which System class you mean. Same holds  
> true for
> XML, RDF, etc. -  this is IMO not poor language design, this is very  
> clever.

The problem is not namespaces as such, but prefixes. Java doesn't  
require you to make an alias for a namespace identifier (or even allow  
this as far as I know). You can use either a fully qualified  
identifier or import a namespace wholesale, with file-wide scope.

The common mistake that both content producers and content consumers  
make is to assume the namespace *prefix* rather than the namespace  
*URI* is what carries semantic meaning. This idea may seem simple to  
an expert, but even intelligent people get hopelessly confused about  
this.

Furthermore, prefixes have a hierarchical scope rather than document- 
wide or universal. That means snippets of markup can silently change  
meaning when moved, not just from document to document, but even from  
one part of the document to another. CURIEs are particularly bad,  
because they use prefixes in attribute values, which means that even  
using the proper DOM APIs can't protect you from the hazards of moving  
content from one place to another in the document. For attributes or  
markup, at least using DOM APIs will push you to get the right  
namespace URI.

This kind of hazard can be mitigated by a convention of always using  
the same prefix for any given namespace - which seems to be the de  
facto convention that usually evolves for popular namespaces. But this  
seems to miss the point of namespaces - it fails to provide actual  
decentralized extensibility, since there is no control over the prefix  
namespace, yet at the same time it seems to show decentralized  
namespace management is not really necessary, since in practice people  
manage to avoid prefix collisions and indeed have to, to avoid  
hopeless confusion.

Prefixes are there to work around the deficiency of unwieldy unique  
identifiers for namespaces. Clearly it would be cruel to force authors  
to type (or read!) "http://www.w3.org/1999/xhtml/" over and over,  
instead of just once per document. But a simpler DNS-based convention,  
plus a managed registry for prefixes that name well-known  
vocabularies, would have solved the problem. That way, authors or  
content consumers who mistakenly thought "xhtml:" or "foaf:" or "rdf:"  
or "rss:" as a prefix had an intrinsic magic meaning would be right,  
and could happily go about their lives without having to understand  
the subtleties of prefix mapping.

For Namespaces in XML, that's water under the bridge. It's too widely  
deployed to fix. But for RDFa in text/html, or solutions that are  
similar in spirit, it's not too late to learn and improve.

Regards,
Maciej

Received on Friday, 31 July 2009 09:45:33 UTC