Re: Why bound prefixes are an anti-pattern in language design

On Thu, 6 Aug 2009, Danny Ayers wrote:
> 2009/8/6 Ian Hickson <ian@hixie.ch>:
> > On Wed, 5 Aug 2009, Martin McEvoy wrote:
> >> >
> >> > (Of course, I personally would strongly argue against any prefix 
> >> > mechanism. But that's another story.)
> >>
> >> I have never understood your stance on prefixes, to me and many 
> >> others they are a "feature" of the future web as well as the present, 
> >> even html5 uses prefixes i.e: data-* so why you think they are OK in 
> >> some cases and not in others seems a little inconsistent to me but 
> >> that my own personal view.
> >
> > My stance is against mechanisms that bind arbitrary strings to other 
> > arbitrary strings, which can then be used in conjunction with a third 
> > set of arbitrary strings to form a identifier that is never explicitly 
> > stated in the source.
> 
> I don't know where you get the 3rd set from, but syntactically binding 
> short strings to longer strings is a successful technique in software 
> engineering. Import antigravity.

Three sets:

   <element xmlns:one="two" one:three="value" />

...forming the pair {two, three}.


> > data-* isn't such a mechanism, since "data-" isn't explicitly bound to 
> > anything, and doesn't mean anything but "data-".
> >
> > I have a problem with mechanisms that separate parts of an identifier 
> > for a variety of reasons.
> >
> > Copy-and-paste of the source becomes very brittle when two separate 
> > parts of a document are needed to make sense of the content.
> 
> Fair point, but does this outweigh the benefits of extensibility?

That's a judgement call, but personally, I would say no, not even 
remotely. Far more people benefit from easy copy-and-paste than benefit 
from extensibility. What's more, the people who benefit from this kind of 
extensibility tend to be the experts, whereas the people who benefit from 
the ability to copy-and-paste tend to be the novices. So IMHO it's a 
pretty easy judgement call: copy-and-paste is important.


> > Copy-and-paste is how the Web evolved, so I think it is important to 
> > keep it functional and easy.
> 
> Yes, but it *did* evolve -

Should it stop evolving? That's a depressing thought.


> what proportion of Web pages do you think were created through c&p now?

A huge amount. I'd be shocked if many of the WordPress templates were 
created from scratch, for instance -- I expect most of them are created by 
varying pre-existing templates. That's certainly how we seem to write 
specs at the W3C -- has anyone ever written a W3C spec by starting from a 
blank page rather than starting from a template or another spec and 
replacing the meat?


> > Prefixes are notoriously hard for authors to understand. As far back 
> > as 2004, Micah wrote "As the author of an O'Reilly book on XForms, I 
> > can report that 90% of the technical questions from readers involve 
> > confusion related to namespaces".
> 
> Yet most programmers somehow seem to get their heads around namespaces 
> for their libraries, and XML namespaces has not-insignificant 
> deployment.

Every year, people in the US wrap their heads around the US Tax code, but 
that doesn't mean that its complexity is acceptable.


> >   http://www.w3.org/2004/04/webapps-cdf-ws/papers/verity.html
> >
> > Parand Darugar has said similar things: "Experience shows XML 
> > namespaces can be a common cause of confusion and a major complicating 
> > factor in XML adoption."
> >
> >   http://www.ibm.com/developerworks/library/x-abolns.html
> >
> > Fundamentally, prefixes are an indirection model. Indirection models 
> > are very, very hard for people to understand.
> 
> Spurious claim.

I disagree; I think the (admittedly circumstancial and anecdotal) evidence 
I listed in my e-mail is enough to demonstrate that this is true.
 

> The whole notion of a markup language is based on indirection - the 
> syntax is attached to some kind of dispatching mechanism to interpret it 
> - you don't get to follow a link by magic.

The more layers of indirection you add, the more complex a system becomes. 
Just because we got away with one layer, doesn't mean we should jump up 
and add another.

(But I don't think authors see markup as an indirection mechanism, I think 
they see it as a direct means of expression.)


> > Maciej has also said things to this effect: "Namespaces are an example 
> > of the Fundamental Software Engineering Error, which is that something 
> > too terrible to actually use can be fixed by adding a level of 
> > indirection. Sometimes that is true but software engineers try to do 
> > it even when it clearly is not."
> 
> Whether or not prefixes are appropriate for HTML5, your stance is not 
> solid. You might as well argue that there's no point in any 
> specification - why put a "<" at the start of a tag when you have to 
> indirect to a parser...

I have no idea what you mean here.


> Hope I irritated you enough for you to think about this.

I have thought about this a lot, over many years.

Have I irritated you enough for you to think about it also?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Thursday, 6 August 2009 09:40:38 UTC