Hacker News new | past | comments | ask | show | jobs | submit login

An HTML file is not a program.



Of course it is, it is a collection of instructions that can be executed by a computer to perform a specific task. In this case the task is to display some data on a screen in a specific way. We need to stop arguing that HTML is not a programming language, it's silly and serves no purpose.


In most non-technical discussions like this, it's only serving the purpose of gatekeeping, as if people who work with HTML or CSS are not really programmers. That's nonsense and should be rejected.

I do think that, in specific technical contexts, a useful distinction (though still fuzzy on the margins) can be made between programming languages and markup languages.


> In most non-technical discussions like this, it's only serving the purpose of gatekeeping, as if people who work with HTML or CSS are not really programmers. That's nonsense and should be rejected.

that is my real point


Of all the things you can say about an HTML file, the one thing you can absolutely not say is that it is a collection of instructions. It is literally a declarative description of components to be rendered.

I also did not say HTML is not a programming language.


> declarative description of components to be rendered.

Doesn't the "to be rendered" part make it instructions? Its like there are two labels for a bottle of poison: "poison" and "poison: do not drink". But the label that says "poison" is of a shape, color, and design that is commonly understood to be a label that tells the reader not to imbibe the contents of the bottle to which it is attached.


If HTML is a programming language, then what, pray tell, are the artifacts in which that language is caused to produce output called?


It's not programming language because it's a markup langauge.

It's not turing complete. There are limits to the types of computation that can be performed with it.

It's not silly -- it's a meaningful distinction.


If you define a "program" as "a series of instructions to perform a task, where the instruction set is Turing Complete", then your statement is tautologically correct based on your definition. A much more general definition is simply "a series of instructions to perform a task". Do you feel that the former definition of the word "program" is the only one worth using?

As an example: if you use a Game Maker application to construct a video game where your inputs are the graphics, the level design, and some basic scripting to connect them up, is the resulting output "not a program" because the input scheme that you used in order to define its behavior was not Turing Complete? You could make an argument that, in the context of Quines, this isn't relevant because the Program is not outputting its own source code but only the top-most layer of its definition, but then again that's true at some level for any Quine not written in machine code (and even then it'd probably be missing much of the OS / display drivers / etc.).

Edit: removed an example about "programmable TV remotes" because it wasn't a very good example, and added a note about Quines.


>"a series of instructions to perform a task"

Limitations of those instructions is the key aspect. You couldn't use any English or natural language expression for example. It might seem obvious but complexity of those instructions is what makes the language abstract. Having complicated instructions isn't always desireable though e.g. the CISC vs RISC debate.


To be clear, I am in complete agreement with every point you've made explicitly in this thread. What I do not agree with is the following implicit claim:

An HTML file cannot be a Quine because an HTML file is not a program because HTML is not Turing Complete.


An html file doesn't contain just html.


If programming languages need to be turing complete, do you consider this language a programming language?

https://github.com/ainfosec/crema

Also, you can generate RSA key pairs using HTML: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ke...

IMHO, the better mental model is that HTML is a declarative programming language that is very abstract.


HTML has sections for data and code just like most other executable files. The code parts in an HTML file are typically in <script> sections.


Why do you think it supports <script> tags? To allow you to extend the functionality where HTML is clearly limited.

Adding two numbers in HTML might be expressable but clearly it's much easier in Javascript.


Lots of historians consider programmable looms to be the first computers, even though they're not Turing-complete.

Cellular automation is Turing-complete, but is not a program.

Turing-complete is a fun thing to talk about in college theory classes, but has limited practical use outside of academia.


It's only real use outside of academia is getting investors on board with your cryptocurrency


And—apparently—gatekeeping what is a "real" programming language.


At some level probably a meaningful distention, like you wouldn't decide to create a neural network in HTML alone. But from a high level HTML is a language used in programming, generally with other languages to create distributed multi-platform computer programs.

My point is let's stop being so pedantic in the soft spaces. This isn't a discussion about "should I use HTML to write my kernel?"


Markup language is a useful category, but the dividing line isn't "Turing complete". Some traditional markup languages are Turing complete (certainly postscript, possibly troff?), while some interesting academic programming languages carefully avoid being so (eg. Charity).


While certainly the class of Turing-complete languages is an important one, I think it's a mistake to treat that specific class as the definition of “programming language”.


Is JSON a programming language then?


In my opinion: JSON is not a programming language when it's used as a data transport format; however, it can represent code which an interpreter could evaluate as a program.

For example, a Lisp based on JSON:

https://github.com/kanaka/miniMAL

A program:

  ["+", 2, 3]
I suppose this is still not a proof that JSON is (or can be) a programming language, since it covers only the notation.



If that's the definition, then plain text is also a program. It instructs your text editor what to display on the screen.


Isn't that how most interpreted languages work?


it the text contains a program then it could be


This is HTML+CSS. CSS3 is Turing Complete.


why not? a html file is a set of instructions for the browsers render engine. That is enough for it to qualify as a program



does every program needs to be turing complete?


Not really, since programmable machines predate real-world turing-complete computers by at least a century.

https://en.wikipedia.org/wiki/Jacquard_machine


Only if you define programs as instructions for manipulating Turing machines.


To be pedantic, we can define a non-Turing-complete subset of a Turing machine's instruction set, and pass combinations of these instructions to the machine, and that could still be called a program.


Why not?


It can receive input and create output. The browser is the interpreter for scripted HTML programs.


HTML by itself can't receive input or create output. It is input/output. It can't run or be executed. It doesn't transform state or even have state. It's not Turing complete.

HTML with either CSS3 or JavaScript is definitely a program, though.


> HTML by itself can't receive input or create output.

Neither can an ELF binary. It needs a loader to execute it.

> It can't run or be executed.

Yes it can, with a runtime that understands HTML.

> It doesn't transform state or even have state. It's not Turing complete.

That's not a requirement for a program.


So what is your definition of a program? It sounds like you're using a definition that's so broad, it would include image files, MP3s, and .gitignore.


You can write an entire game like super mario in an html file. Is a super mario game not a program? And no, this is not an archaic way to use html files, it is pretty common to share smaller games as html files. You play them by loading them into your browser.

Remember that html files are not just html. The way we use them today they are fully functional programs.


You are arguing against a statement I didn't make. Look back at the last sentence of my original comment[1] where I distinguished HTML from HTML+CSS3+JS.

It seems we agree that HTML (a language, not a file that also includes other languages) cannot create a game like Mario or even Pong.

1. https://news.ycombinator.com/item?id=24826670


"HTML by itself can't receive input or create output."

So GET and POST are figments of my imagination then?


Those are HTTP I believe.


Http verbs which can be sent from html


Except that you can "run" (display) an HTML document without ever sending any HTTP requests. The HTML has no power to send one. It just tells you what happens if a user clicks a UI element.

Saying that HTML can send HTTP messages is like saying that HATEOAS API responses[1] can send HTTP messages. They can't without a separate program (written in a non-HTML language) to interpret the HTML and send the message.

1. https://restfulapi.net/hateoas/


> HTML with either CSS3 or JavaScript is definitely a program, though

Then so is something in HTML that doesn’t use CSS3 or JavaScript, for the same reason that a C program that contains no loops is still a program.


> for the same reason that a C program that contains no loops is still a program

HTML is not "C without loops". It is, by definition, a subset of the string type. All HTML is a string, but not all strings are HTML.

The following is valid C, but I would absolutely argue that it isn't a program:

    char str[] = "Geeks";
It's a declaration, just like HTML is. It is a string that is being declared and stored.

Still, that C example is more of a program than any HTML is because it contains an instruction. It manipulates memory.

HTML is literally just a file format. It is not any more of a program than a PNG file is.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: