70 comments

[ 2.8 ms ] story [ 145 ms ] thread
HTML is a presentation language, XML is a data language, JavaScript is a programming language.

HTML is more like Powerpoint, XML like MS-Access.

HTML is like Powerpoint? Wow, if only it was that easy. It's more like Excel IMO if we really want to make such an asinine comparison.
how would I add two numbers in html? <p>1+1=2</p>
<p><script>document.write(1+1);</script></p>
Javascript is not HTML. Both can usefully exist without the other.
Quote: "However, if you are configuring an application by setting its preferences, or an operating system by manipulating its system files, or a webpage by marking up its text with HTML, anything that will set up the future behavior of the computer to accomplish something for you, then these are activities that are so closely akin to anything essential that can be said about what programming is, that I no longer see the point in trying to forge a distinction."

Not programming, not programming and, yes, not programming.

The green text on a black background makes this incredibly hard to read.
Just whip up a little Javascript function and drop it into your HTML between the relevant tags and refresh your cached page. Oh wait... I meant reprogram the color settings in your HTML.
Or you can modify the CSS:

    <style type="text/css">
      body {
          background-color: white;
      }
        
      .bodytext {
          color: black;
      }
    </style>
I just think its somewhat ironic that an article on the power of html has such poor page styling.
I'm not sure where you're seeing all this controversy, nor do I quite understand why you're so upset about it. Nevertheless, why don't we just judge HTML in terms of its intended purpose? Before CSS and Javascript and the separation of semantics, presentation and behavior I might actually have agreed with you. At this stage, though, I'd venture that HTML is designed for the purpose of describing the semantic notions of a document rather than computation. Since you ask us to be humble I'll oblige and concede that not all programming languages have to be turing complete (there are useful languages that aren't). But surely it has to be designed with computation as a purpose? Even CSS fullfills that criteria to a higher degree. If not, you might as well argue that any arbitrary language at any level in Chomskys hierarchy constitutes a programming language. It's been a while since I read SICP but I really don't think this is what Abelson and Sussman had in mind.
This article does not mention the phrase "Turing completeness" once. The core of its argument is just a half-assed comparison between HTML and machine language, because neither has explicit control structures, and HTML links are kind of like implicit control structures if you squint really hard. Lame.
It doesn't mention declarative either. And perhaps xslt, a Turing complete, declarative functional language should be mentioned as well since it looks a lot like html.
As an aside, HTML5 and CSS3 are [turing complete](http://lambda-the-ultimate.org/node/4222).
I wouldn't count that as Turing-completeness. It requires the user to repeatedly press the tab and space keys to advance the computation; the amount of computation that the CSS is doing for each press of the tab and space keys is trivial. Many systems that are not normally considered "Turing-complete" have the same property. For example, one can construct a finite state transducer that takes a Turing machine state as input and produces the next state of the Turing machine as output. Repeatedly applying this transducer to some input string will simulate a Turing machine, but finite state transducers are not considered Turing complete.
Can you explain why you feel that disqualifies it? The required input doesn't make any decisions, or hold any state as in your example; it's just "turning the crank" so to speak. Even a CPU needs a clock, right?
I'd say that a CPU that needs a clock but does not have one is not Turing-complete. CSS plus an infinite stream of user input is Turing-complete, but CSS itself is not Turing-complete. I should make it clear that I'm not saying, "my definition is the one true definition of Turing-completeness"; just that I prefer this definition. One reason I prefer this definition is that the claim "CSS is Turing-complete" makes it sound like browsers could take unbounded time to render a webpage that only used HTML and CSS, which as far as I can tell is not true.
That does seem sensible. I'll agree to a weaker, more specific claim like: HTML5 + CSS can simulate a Turing machine in Rule 110, but browsers aren't set up to do that without user input. Turing completeness level: eh.
The CPU clock is part of the CPU. That doesn't mean a CPU without a clock is Turing-complete. An ALU with access to a couple registers is not Turing-complete. "Turing-complete as long as something else provides the power to loop endlessly" is not Turing-completeness.
Anything without infinite memory is simulating a Turing Machine. That doesn't mean they aren't useful.
Whether something is useful is a different question than whether something is Turing complete. Brainfuck is Turing complete and eminently useless. CSS is not Turing complete, and arguably useful. How do I know that CSS is not Turing complete? Because I believe that - without Javascript - any given page render will finish. Presuming that's the case, CSS cannot be Turing complete. Of course it can be part of a larger system which is. A finite state machine is not Turing complete; an infinite tape is not Turing complete; but when you combine them, you get a Turing machine.
Brainfuck etc, don't guarantee infinite storage. Therefore, they cannot compute everything computable. Hence, they are are limited to only computing some things but not others. Hence they are not Turing Complete.

Don't get me wrong, I'm fine with lowering the bar and calling them "Turing Complete" as a practical matter. I'm against then turning around and raising the bar and pretending Turing Completeness is implantable when it comes to defining "programming languages."

"Programming language" is an engineering term not a mathematical one.

I think you're making this distinction wrongly.

"Brainfuck etc" - by which we mean not just joke programming languages but most (all?) programming languages generally considered to be Turing complete - don't prohibit infinite storage, and tell you how they would behave if somehow they were run in an environment where they did have infinite storage available.

In that sense, I think it is extremely reasonable to say "the language is Turing complete", without any lowering of the bar.

Any individual finite realization of that language will, of course, be theoretically a finite state machine. But you can't reason about how that restriction of the language will behave (for instance, whether it will halt for all inputs) in the general case without naming the particular resources available. And at that point, it's still not a convenient form for those kinds of questions.

1. Machine/Assembly languages are not theoretically able to access unlimited memory. Hard limits are hardwired into the core of the language A0 is only so big. That we consider such languages as MIX to be Turing Complete is an engineering decision not something amenable to mathematical proof.

2. Let us assume that Turing Completeness is an essential property [in the medieval sense of "essential property"] of programming languages. Using a Turing Complete programming language called "TC" I write a Domain Specific Language called "DFA" for constructing Deterministic Finite Automata. Because Deterministic Finite Automata are "sub-Turing Complete", DFA is not Turing Complete and hence statements in DFA are not written in a programming language. But being isomorphic with statements in the "TC" they must be written in a programming language. Reductio ad Absurdum.

3. It is Turing Complete languages that are hard to reason about. That's why we have the Halting Problem. Deterministic Finite Automata always finish. What makes programming in HTML useful is that whole categories of problems are precluded.

Regarding 1, I agree that machine code (and machine-code equivalents) for probably all architectures are not Turing Complete if we are to be rigorous.

In that case, regarding 2, any encoding from a Turing Complete language into machine code must inevitably be an approximation. That says nothing about the source language.

Regarding 3, I mostly agree - if you can comfortably accomplish your task in a language that is not Turing complete, then making the language Turing complete is a bug not a feature. That is true whether the task is programming or markup.

I would say that HTML is not a programming language because it is not very good for programming; it is a markup language, because it was designed for markup and is much better for markup than for programming or most other tasks. Turing completeness is irrelevant.

Ran here to see this comment. If it isn't Turing complete, it's not a programming language. Arguably it's not necessarily a programming language even if it's Turing complete. E.g. c++ templates.
> If it isn't Turing complete, it's not a programming language.

Says who?

Turing completeness is nice and all, but it also comes with some baggage and difficulties. There's value in having constrained domain specific languages.

> Says who?

Says most of the people who care, and who therefore use the term the most.

> Says who?

Says most of the people who care, and who therefore use the term the most.

Turing completeness is arguably required for a general purpose programming language, but I think something can be a programming language while being more specialized. Given that you're capable of comfortably solving your problem in the language at hand, I think Turing completeness is a bug not a feature.
If we define a programming language as a "language designed to communicate instructions to a computer," and then we observe that most "traditional" programming languages require an intermediary to make the computer "do what the program intends" (such an intermediary being a compiler or a runtime or some other transformation), then one could argue that HTML is a language, and the browser is such intermediary.

Therefore, HTML is a programming language, IMHO. It may be "primitive" in the pecking order of programming languages based on some arbitrary definition of sophistication, but it rises above the stated definition.

By this definition any input that a program processes would qualify, since inputs by definition "instruct" the program how to operate.

At that point you've robbed the term of any useful meaning.

Inputs are not instances of a computing language. They are arguments or parameters to the program.
HTML is not an instance of a "computing language". HTML is simply an input to a program.
This guy's talking out his arse.

> "Most linguists would agree that if you are using any formal system of symbols or codification to communicate such a plan, then you are using a language."

No, communicating a plan constitutes what linguists call a "communication system" which doesn't necessarily meet their definition of a language.

> "if you are using machine language [...] All you have to work with at that level are binary codes which you store in a list and feed to a processor; no logical, no iterative, no conditional constructs are there for you."

What? JE, JNE, JGE, JNZ and so on are obviously conditional. And logical. What the hell is wrong with this author?

> "if your own education and thinking has you convinced beyond any doubt that HTML is not a programming language [...] Go get some more education at an institution other than a glorified vocational training center"

What a pompous cunt.

Honestly, I was expecting this article to go a completely different way. Namely, I expected it to talk about how <canvas> is Turing complete (and therefore, should be valid consideration as a programming language as much as LaTeX or Cxx templates are).

There's certainly use in confronting elitism and FUD, but having a technical kernel (see what I did there? :P) of truth supporting a more abstract argument would be far more compelling imho. I'd really love to see more discussions about <canvas> and what it means for the future of HTML as a language (and whether or not it will come to be a more fully-fledged programming language itself).

<canvas> doesn't do anything by itself; you draw on it using JavaScript. Someone could argue that because JS can be embedded in HTML, it's really a part of HTML, which makes HTML a programming language; but the HTML standard does not require JS support, and most browsers have an option to disable support, so I think they are separable.
Imho, your latter statement would be true except for the inclusion of <canvas> which is there specifically to allow it to be manipulated by JS.

You are, of course, correct though, <canvas> is not actually Turing complete without JS; but then a Turing machine cannot operate without both the ticker tape and the pen to write on it. Given that, JS + <canvas> seems to be a near perfect analog to a Turing machine to me. (Though, I can think of numerous ways that someone might disagree.)

Either way, I would still like to see more in-depth analyses of this interaction; and I find it odd that a discussion of HTML as a programming language would make no mention of it whatsoever.

If you have JavaScript (obviously Turning complete by itself), why do you need canvas?
And yet he attacks elitism with his particular kind of elitism.

I'm not sure this is at all useful.

"Go get some more education at an institution other than a glorified vocational training center."

I believe that "glorified vocational training center" is a self-depreciating reference to the author's home institution, MIT. I suspect that other members of the MIT community were the first order audience for the article and the thrust of his critique is that claims that HTML is not a programming language are structured as arguments from authority.

What makes

  (print "Hello World")  ; MIT/GNU Scheme
a proper program, and

  <p>Hello World</p>
something else seems more rooted in opinion than any intrinsic difference.
Well, one can be compiled to an independent binary that can load and run on a variety of machines. The other requires a large application infrastructure to run at all. Commonly they are lightyears apart. Its easy to see why one would be called a language and the other, not.
"[O]ne can be compiled to an independent binary that can load and run on a variety of machines. The other requires a large application infrastructure to run at all."

That seems more a matter of current tooling, not anything about the languages themselves. Did Java only become a programming language when someone wrote a compiler to machine code? Is perl more in the same category as C or as HTML? Quite a few languages dynamically link a runtime, and most are dependent on OS facilities that could be extended to handle HTML.

HTML will never run standalone, right? Its designed to run in a very rich environment.
I don't see the environment for an HTML page being richer, in any sense at all, then the environment for a Java program. Especially if we are not considering javascript to be a part of html.

To be clear, I emphatically agree that html is not a programming language, I just don't think this is getting at why.

I wonder if its something like the arguments for why humans are different from animals (e.g. opposable thumb; tool maker; language). We keep casting about for things; they keep getting disproved. Maybe its not a worthwhile categorization.
My view is that HTML is not a "programming language" because it was not designed for programming, and isn't very good at it. C isn't a markup language because it wasn't designed for adding presentational and organizational context to information, and it isn't very good at it.

Some markup languages let you do some programming, and vice-versa. There are also some candidates for being considered both a programming language and a markup language. HTML, absent js, doesn't seem to be one of these.

But that's circular, right? HTML isn't a programming language, because you can't program. Maybe its like pornography; you know it when you see it.
It is only circular if we define programming by reference to programming languages.

To be honest, I am not sure precisely how I would define programming. A first attempt would be "structuring events and computation, often by reference to future input".

As with most definitions outside mathematics, it's going to be fuzzy.

Edited to add:

Note that with this framework, whether you are programming is not determined by what language you are using.

If Hello World is output, what difference does The route from source code to execution make in regard to its effect?

BTW,it is practical to compile the HTML into machine code. MIT/GNU Scheme could be used to do the trick.

How about this for an intrinsic difference: one language is capable of performing arbitrary computations (it's Turing complete), and the other is not?
The only problem with that is that, recently, there has been a resurgence of the notion of sub-turing complete languages as still being valid programming pursuits. E.g., see Coq.

I have not really come down on one side or the other (mainly because I do not have the requisite experience and have not yet had the time to research the question thoroughly enough to form a well-founded opinion). But, that programming languages must be Turing complete is not necessarily a given.

The classification of Coq versus HTML is like that of classifying people as expats versus migrants, it reflects more upon the affinity of the person classifying for what is being classified than upon any objective distinction.

Computer Scientists use Coq and Web Designers use HTML. Denying HTML is a programming language is a mechanism for denying a particular form of legitimacy to a particular cluster of activities. It's not like you're average Java programmer could actually prove that Java is Turing Complete in polynomial time. Most people take it on authority that C is Turing Complete, and that's reasonable because that's the way science largely works.

It feels like you may have misunderstood my purpose. My point was not that HTML should be denigrated from the status of programming language where Coq is a programming language. My point was that the line is blurry (I think you and I agree on this), and that it is not a given that a “programming language” is necessarily Turing complete.
It feels like you may have considered my reply an argument rather than a riff on your observation that Coq gets props as a programming language. When I see a programming language that comes with an infinite tape, I'll take the idea of Turing Completeness as a necessary condition for a programming language more seriously.

My point is that excluding HTML from the family of programming languages is a social distinction. And mentioning Turing Completeness is usually a way of cutting off conversation not opening it up.

Ahh, I must have misread; it seems you and I are on exactly the same page :)

   (print "Hello World")
Where is the Turing Completeness? Or more specifically how does the it express Turing Completeness any more or less than:

  <p>Hello World</p>
It is only by resorting to metaphysics that one can claim that one is a program and the other isn't despite both producing the output Hello World.
If "looking at the properties of the language they are written in" counts as "metaphysics", then sure, I guess we have to employ metaphysics. So what?
That was a terrible example. Try calculating PI with HTML.
A fast HTML implementation for the first 1,000,000 digits:

   <a href="http://www.piday.org/million/">π</a>
Takes advantage of memoization and lazy evaluation.
(comment deleted)
I think the issue here is that it's quite possible (if often inconvenient) to use a programming language for markup. If it's good at that, I might call it a programming and markup language. I would only call it a programming language if it is good at defining meaningful computation and/or sequencing actions.
(comment deleted)
This article prompts a staccato of reactions in me.

The first is to observe the Argument of the Beard.

Next is to think about how telling your VCR to start recording whatever's on TV at 3pm and stop at 4pm is known as programming it.

After that I get lost in a quagmire of musing whether SQL is a programming language.

After that I start thinking about Turing completeness, followed quickly by the observation that there are things that are Turing complete that I would not consider to be programming languages.

And then at some point I realize we're just idly shuffling words and the meanings of words around the table. That's where I suddenly lose interest because I've really got no reason to have a problem with the current vernacular meaning of the term.

> there are things that are Turing complete that I would not consider to be programming languages.

Like what?

Lots of cellular automata, probably.
There are two ways to go about answering this:

1. You could try a formal definition -- such as Turing completeness

2. You could accept a colloquial definition. This definition has to be extracted from the things that people call programming languages.

If you opt for #1, then you have to accept you have abandoned #2. There are things that are Turing complete which people in the ordinary use of English may not think of as programming languages. (For instance: an actual Turing Machine with the infinite tape).

If we go with #1, knowing full well that it may be counter-intuitive, then we are left with a technical question which, at least, can be answered. You can see if rule 110 or whatever can properly be implemented. You can decide if some feature of the browser allows for it and so forth. At least you know what the exercise is.

If you decide you want to capture people's intuitive sense of a "programming language" then you have to intuition monger. I think intuitions are informed by the use of the word "language" as well.

So, for instance, people may "program" a VCR, but no one calls that using a programming "language." This is because it does not feel language-like to us. Same with an actual Turing machine. If you transcribe the instructions of the Turing machine into instructions like "1 - go forward, 2 - print a 1, 3 - go back" etc, then suddenly it "feels" like a language.

If you accept that you are intuition mongering, I think you would have to poll people who are familiar with HTML and other languages and ask them. (I suspect they would say, in general, that it is not).

Of course, #2 may change as the language evolves and our sense of what a "language" is evolves with it.