logoalt Hacker News

embedding-shapetoday at 1:52 PM3 repliesview on HN

I dunno, you're being pedantic :) Yes yes, the name clearly ends up "Markup Language" so yeah, with a very strict definition of programming languages, HTML is not one of them.

But if we use a broader definition, basically "a formal language that specifies behavior a machine must execute", then HTML is indeed a programming language.

HTML is not only about annotating documents or formatting, it can do things you expect from a "normal" programming language too, for example, you can do constraints validation:

    <input name="token" required pattern="[A-Z]{3}-\d{4}" title="Must match ABC-1234 (3 uppercase letters, hyphen, 4 digits)" placeholder="ABC-1234">
That's neither annotating, just a "document" or just formatting. Another example is using <details> + <summary> and you have users mutating state that reveals different branches in the page, all just using HTML and nothing else.

In the end, I agree with you, HTML ultimately is a markup language, but it's deceiving, because it does more than just markup.


Replies

throwaway150today at 2:09 PM

I'm not sure we can call your parent comment pedantic. They're just being correct. Is it pedantic to say that fish is not a fruit? It's just correct to do so.

If anything, it is the act of stretching the definition of "programming language" so much that it includes HTML as a programming language that we should call pedantic.

PaulHouletoday at 3:26 PM

One threshold is "can you write a program that might not complete?" You can't in SQL, which makes it less of a programming language than, say, FORTRAN.

If you look at the HTML 5 spec it is clear that it's intended to be a substrate for applications. The HTML 5 spec could be factored into a specification of the DOM, specification of an x-language API for the DOM and a specification for a serialization format as well as bindings of that x-language API to specific languages like Javascript.

show 1 reply
jraphtoday at 1:55 PM

> I dunno, you're being pedantic :)

It might be, I'm usually not, but this is all xhtml.club and this footnote are about, might as well be correct :-)

Constraint validation is still descriptive (what is allowed)

All details and summary are doing is conveying information on what's a summary and what's the complete story, and it has this hidden / shown behavior.

In any case, you will probably find something procedural / programming like in HTML, but it's not the core idea of the language, and if you are explaining what HTML is to a newbie, I feel like you should focus to the essential. Then we can discuss the corners between more experienced people.

In the end, all I'm saying is: you can just avoid issues and just say "HTML" without further qualifying it.