Addy Osmani describes Web Components, of which an important part is custom tags. The promise: In one word, a future with Web Components is declarative. JavaScript still exists in this future, but is relegated back to a role where it acts as a glue holding the other bits of a component together. Web Apps in the near future will be composed almost entirely from elements (tags). Some of these elements (like the <audio> tag) will be given to you by the browser but others like <slide-show> will be custom elements provided by UI libraries or you can write it yourself.

Programming with tags. Where have we heard this before?

Starting in the 90’s (and through to the present), there’s ColdFusion. It offers quite a library of custom tags — for everything from control flow (<cfif>) to database interaction (<cfinsert>).

Microsoft has ’em too — called Web Controls — abstracting away things like authentication and (again) database access. Drop in a tag, get a fully-functioning login form.

Logic as markup. So tempting, and so wrong.

Markup is nouns and adjectives. It doesn’t have verbs. It describes, but it does not impel.

Unless we start from the assumption that we want our logic to be declarative! In which case we end up with tags representing verby things like “authenticate the user, hit the database, and iterate the results”.

Now, expressing a syntax tree in markup is just as syntactically “correct” as any other way. If you want to wrap your if statements and subroutines in angle brackets, no problem, you can do that. If you want function arguments expressed as attributes, OK.

But why would we? We’ve got languages — lots of them. And we make new ones all the time. Why retrofit HTML?

ColdFusion and Web Forms were not unsuccessful. Lots of people adopted them, and there was a marketplace for custom tags. The same will probably go for Web Components.

I suspect, however, we’ll go through a time of irrational exuberance before realizing that everyone has created their own weird-ass pseudo-language with angle brackets.

discuss on hacker news