Is HTML A Programming Language? (Webbed Briefs)

Today I stumbled into this Fediverse post:

A great conversation in the supporter Discord/Matrix reminded me that it’s about time to share this fantastic item by @heydon.

Anyway, yes HTML is a programming language and folks who argue with this statement in my comments will be muted, blocked, defederated, or all three.

https://briefs.video/videos/is-html-a-programming-language

From https://mastodon.uno/@vkc@linuxmom.net/113669662074489728

I was naively answering a sound no, then I took the time to read the transcription at Is HTML A Programming Language? (Webbed Briefs) (also copied at page 2 of this post).

Well, that’s an interesting reading.

As an aging grumpy person I even missed the fact that CSS is Turing complete! Indeed it is, see https://brandondong.github.io/css-turing-machine/

I tend to agree with mausmalone who wrote

@vkc I work on web dev and I personally have never considered HTML a programming language and I never understood what the debate was all about or why it was contentious. I’m glad now that I’ve never bothered to argue about it, because I wholeheartedly believe that web professionals and web work are undervalued.

From https://mastodon.social/@mausmalone/113670088334657621

As far I could understand the issue is undervalueing work made by other people and overvalueing your own work

Title:Is HTML A Programming Language? Published:5th March 2022

It’s been a long time! Glad to be back. In this episode, I ask a question that has never been asked before and has certainly not in any way caused a great number of arguments and nobody has ever been blocked or muted on social media for asking it. Bon appétit.

Help Ukraine defend itself.

These things take a solid frickin’ week to make so, if you’re able, support me on Open Collective or buy a T-shirt or hoodie!

Transcript ↓

In this episode of Webbed Briefs, I shall be asking the question, “Is HTML A Programming Language?” And—spoiler alert—I shall be answering that question, quite emphatically, with this word: “Yes”, which is the standard British English term for “Yes”.

That’s the easy part out of the way. Now let’s examine some of the objections to the unequivocally true statement, “HTML is a programming language”.

(1) “You can’t write a program with HTML”

What is programming? Programming is giving computers instructions. It’s telling them what to do. Programming languages are grammars understood by and intended for computers.

With that in mind, your first clue that HTML is a programming language is that you don’t see HTML tags on a rendered web page. That’s because they are not intended to be seen and read directly by human visitors to that page.

Your second clue that HTML has gone and done some ruddy programming all up in your computer is the graphical topography of the web page you are looking at. Without HTML instructing the computer to structure and format it according to the HTML author’s instructions, it would look something like this.

(2) “HTML is not Turing complete”

Neither are the languages SQL, Sequel, or Skwool.

Turing completeness is one way of measuring the capacity of general purpose programming languages, not a test for programming per se.

HTML is a domain specific programming language, not designed for anything but rendering web documents: a singular but important purpose. I feel like this is a fairly simple diagram to understand. So this shouldn’t give you much trouble either. Or this.

(3) “HTML isn’t a programming language, it’s a markup language”

Sure, and this isn’t a quadruped, it’s a horse. A markup language is not a natural language; it has strict syntactical rules intended to be understood by computers. And the only reason we want computers to understand those rules is in order to tell the computer what to do AKA programming.

What you really mean when you say “HTML isn’t programming” is “HTML isn’t the kind of complex or impressive programming I—a person desperate to make claims of intelligence—could possibly lower myself to be associated with.” Which is all the more embarrassing for you when the HTML you do end up writing sucks so much ass.

(4) “You can tell HTML isn’t programming because it doesn’t have if statements”

First of all, yes it f**king does. But also: do you see any if statements on this, a punch card? Even one? No you can’t. And if punch cards “aren’t programming” then we’re missing a rather important antecedent to the programming that does fit your wild preconceptions.

Also, what the f**k is this expression? No if statements here, can’t be programming then.

Instead of getting hung up on specific language features and formats, a much simpler way of determine whether some text is programming or not is to try and use it to tell a human being to do something.

Director’s note: Forgiveness

And don’t be fooled by HTML pages still rendering when you write broken markup. That’s because it is a forgiving language—or rather, the browsers that render it are forgiving—not that it isn’t a programming language at all.

If you don’t believe HTML is a programming language because it is declarative and you simultaneously believe procedural JavaScript is improved by adopting a more declarative style, you may have brain worms.

Director’s note: Objection: HTML doesn’t even compile

Python, JavaScript, PHP, Perl, Ruby, and BASIC do not need to be compiled either. People are obsessed with making JavaScript into a compiled language but that’s another matter for another day.

(7) “HTML doesn’t do anything on its own, it needs a browser to work”

We’ve only just met, and this is crazy, but all programming needs something to program and an environment in which to perform that activity. Unless your intention is to, let’s say, sell the text representing an unexecuted program as an NFT, your program has no value in and of itself. NFTs don’t actually have anything but a purely transactional value anyway, but that’s beside the point.

Director’s note: Why Does It Matter If HTML is a Programming Language or Not?

If you expect HTML to manifest some sort of intrinsic worth like a rare mineral while accepting that other languages require runtime environments, that tells me you are applying more emotion than logic to the subject of whether HTML is or is not a programming language.

(It is one.)

(8) “If HTML is a programming language, then a Word document is a programming language”

A Word document is not a language at all, you absolute f**khead. You are reaching so hard to support your parochial views on programming, you’ve conflated markup with the graphical user interface of a proprietary desktop publishing application.

Director’s note: Why Does It Matter If HTML is a Programming Language or Not?

Well, programming is a relatively well paid occupation, largely because we consider it a difficult thing to do well. Even though, say, nursing or retail are probably a lot harder on a number of levels.

By othering HTML (and related languages like CSS) as just code and not really programming, the implication is that they do not deserve the same care and attention as other languages.

This can lead to a couple of unfortunate outcomes:

  1. People who specialize in HTML and CSS are not valued or paid as well as they deserve to be, or
  2. People who do so-called “real programming” are given the responsibility over a language they have no respect for because “anyone fucker can write this shit”

Skilled professionals go underpaid or can’t find work and the web itself becomes stuffed with hideous “div buttons”: keyboard and screen reader inaccessible faux button elements.

In summary:

  1. HTML is a declarative language
  2. HTML is a domain specific language
  3. HTML is a markup language
  4. HTML is a Turing incomplete language
  5. HTML is not a natural language
  6. HTML is a programming language
  7. And so is CSS
From https://briefs.video/videos/is-html-a-programming-language/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.