DEV Community

loading...

Discussion on: Quiz: is this a programming language?

shalvah profile image
Shalvah

Wow, you guys have argued quite a bit😅. Some interesting points here.

I think I like how @ashleyjsheridan and @crimsonmed have put it. They got me thinking about something: what's markup?

To "mark a document up" means to annotate it, typically to add some meaning. So you can't write markup by itself. There must be a text that the markup describes; otherwise it's useless. Similarly, a document with only HTML/Markdown tags (and no other text within the tags) is pointless (leaving CSS and JS out of the equation for now). It likely won't show anything when the browser renders it.

However, a file containing only PHP syntax is totally valid and will do something when executed by the PHP interpreter. I think this is an important difference. 🤔

Thread Thread
stereobooster profile image
stereobooster Author

Removing text from HTML is like removing IO operations from PHP. Example:

<ul>
  <li>1</li>
  <li>2</li>
  <li>3</li>
</ul>
Enter fullscreen mode Exit fullscreen mode

vs

for (let i = 1; i <= 3; i++) {
  console.log(i);
}
Enter fullscreen mode Exit fullscreen mode

Now let's "remove text"

<ul>
  <li></li>
  <li></li>
  <li></li>
</ul>
Enter fullscreen mode Exit fullscreen mode

vs

for (let i = 1; i <= 3; i++) {
}
Enter fullscreen mode Exit fullscreen mode

In both cases it will do calculation (browser will build DOM, JS will iterate over i) and in both case we will "see" no output

Thread Thread
ashleyjsheridan profile image
Ashley Sheridan

A for loop isn't comparable to a pre-build <ul> list of items. A fair comparison would be to compare your <ul> list with the following:

1
2
3
Enter fullscreen mode Exit fullscreen mode

That's it, just numbers. There's no loop, no iteration, it's already built by you. There is no program. If HTML ever got that capability, then it could be part way to be considered a programming language, but for now it's a markup language only.

Thread Thread
stereobooster profile image
stereobooster Author • Edited

So you say that

console.log(1)
console.log(2)
console.log(3)
Enter fullscreen mode Exit fullscreen mode

Is not a program? Can you give definition for a program so I can differentiate what is program and what is not?

Thread Thread
crimsonmed profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
Médéric Burlet

Already gave it a lot of times but you can't read. As said in all the definitions apart the one you made up a programming languages differs from a markup language at is can compute. Typically wrttting the first 10k prime numbers or 10k fibonacci sequence numbers. Something that you would have to calculate yourself and then write all the answers in a ul for html as it won't be able to calculate.
The point is simply algorithms. Html can't create and solve algorithms that compute various operations.

You can't even do 2 squared in html.

You gonna ask where the definition comes from and once again I gonna tell you I posted over 10 links as well as rfc and others that you admitted to not being bothered to read. So @ashley Sheridan it's better to leave this guy to his ignorance as he not willing to learn.

Thread Thread
ashleyjsheridan profile image
Ashley Sheridan

This is (technically) a program (albeit incredibly basic) written in a programming language. Doing this same thing in HTML wouldn't be a program as HTML isn't a programming language.

Thread Thread
stereobooster profile image
stereobooster Author • Edited

I'm glad we figured out that this is a program.

HTML isn't a programming language

So what is your definition of a programming language? It should contain iteration? SQL (query part, I'm not talking about stored procedures) contains iterations. Is it a programming language?

Thread Thread
crimsonmed profile image
Médéric Burlet

You can't compare HTML and SQL. One per its official definition is a markup languages and the other one by its official definition is a query language.

If you are going to make comparisons don't compare dogs and apples. Compare green and red apples.

Go and compare markdown and HTML.

This is the exact same issue where you went and compared sea lion and lion without even looking at their offiacally defined name which differ completely.

@ashley Sheridan you'll never get anyway om this thread I think he is just reaching for the post with most comment badge.

Thread Thread
ashleyjsheridan profile image
Ashley Sheridan

SQL is absolutely a programming language. It contains loops, branching logic, can define functions and procedures. XML is also a programming language, as it too has all of these things. XHTML wouldn't be, because it's an XML subset that omits those features, although technically you can use XSL to convert an XHTML page (just not a standard HTML one) into something else.

Thread Thread
stereobooster profile image
stereobooster Author • Edited

can define functions and procedures.

Right. Latest versions indeed contain that. But I asked would you consider initial SQL which had SELECT, INSERT, UPDATE and DELETE to be a programming language? (Without stored procedures and functions)

For example, sqlite doesn't have stored procedures (there is WITH RECURSIVE but again this is later addition).

Thread Thread
ashleyjsheridan profile image
Ashley Sheridan

You're deliberately omitting parts of my answer to attempt to make an argument for you. I specifically mentioned that SQL had loops and branching logic. That's been part of it for many, many years (I don't even recall a time when it wasn't).

Can you point to any part of HTML that contains:

  • Loops
  • Branching logic
  • Variables
  • State management

These are all parts (not the only parts, however) that constitute a programming language as determined the definition of the term. I do understand that you're trying to understand the term yourself, and maybe want to make the argument that HTML should be classed as a PL, but that's based on a slightly flawed concept of what a programming language is. This doesn't lessen HTML in any way and doesn't make anyone who knows it and uses it less of a developer.

Thread Thread
stereobooster profile image
stereobooster Author • Edited

I don't omit anything. I'm asking question. I'm trying to pinpoint your definition of a language. I'm trying to understand if bounded iterations are enough or not (that is why question about SQL).

I specifically mentioned that SQL had loops and branching logic

Yes. But my initial question was about SQL which doesn't contain stored procedures. That is why I asked again. For example SQLite doesn't contain stored procedures.

So you say that programming language should contain:

  • Loops
  • Branching logic
  • Variables
  • State management

I will take it as your definition (it is really hard to get this answer from you - you're so focused on HTML...)

So functions are optional? (You didn't mentioned them)
What the difference between Variables and State management?

Thread Thread
ashleyjsheridan profile image
Ashley Sheridan

Stored procedures are not the same thing as branching logic. Does SQLLite contain branching logic? Absolutely. Can HTML? Absolutely not.

Isn't this entire thread specifically about HTML? Given that, is there any wonder why I try to keep the thread on topic (your topic), which is HTML? Also, I have mentioned before, it's not my defintion, it's the definition of a programming language. You seem to have a version of the definition which is yours but it doesn't match the industry definition.

Functions are option, yes. Look at BASIC, which has no functions, but is 100% a programming language.

State management isn't the exact same thing as having availability to variables. For example, direct memory access could be considered a form of very low level state management, although without the use of variables this would become incredibly complicated. Some languages also abstract away some kinds of state, in ways that aren't available to your program. For example, a basic foreach loop that iterates across an object. Not all languages make the internal pointer mechanisms available via variables (or at all), but there's certainly a state being managed there.

On the flip side, HTML has none of that. It describes content, and that's it. At a basic level, you could compare an HTML document to information stored in memory. Each block of memory (e.g. each HTML node) has a start and end position, and can have pointers to a parent, previous and next sibling, and x number of child nodes. There's nothing beyond basic connections between items, no concept of any programming functionality.

Thread Thread
stereobooster profile image
stereobooster Author • Edited

You seem to have a version of the definition which is yours but it doesn't match the industry definition.

So you claim there is "the industry definition". I wonder how we can get a definition of that kind. Was there an industry wide vote or something? I missed my invitation.

Just to prevent: If you gonna use quote from Wikipedia as proof. This is not an industry wide definition. This is just a definition of website called Wikipedia.

There is no such thing as industry wide definition. There are people who believe in one definition and people who believe in another. For example Professor Brailsford thinks that HTML is declarative programming language youtube.com/watch?v=4A2mWqLUpzw

Peter Van Roy has a separate category "Descriptive declarative programming" which includes XML, S-Expressions info.ucl.ac.be/~pvr/VanRoyChapter.pdf. HTML also would be in that category

That is why I'm asking for a definition. I'm trying to understand your logic. But for some reason you try to prove me wrong instead of explaining what you mean

Thread Thread
crimsonmed profile image
Médéric Burlet

He explained plenty what he meant and you ignore half of his text. Even the official definition of HTML which classifies it as a markup language by its own creator was ignored by you 😂

Thread Thread
stereobooster profile image
stereobooster Author

HTML which classifies it as a markup language

I said it before. There is no proof that markup language can't be a programming language as well. What about Postscript?

Here is another definition of a programming language:

A programming language consists of (1) a syntax, given as a formal grammar; and (2) a semantics

1: w3.org/TR/html52/syntax.html#syntax
2: w3.org/TR/html52/dom.html#elements...

Just to remove this argument about "official definition"

Thread Thread
crimsonmed profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
Médéric Burlet

Why you keep changing the subject we are talking about html and not postscript not brainfuck not javascript.

Waste of time I'm going back to blocking you. If you can't even read a simple rfc which is written by the creator of the languages then clearly you have ko will to learn.

Peace out

stereobooster profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
stereobooster Author

I'm trying to have a constructive conversation. Stop freaking out. I'm asking simple straightforward question and instead of answering the question you start to attack argument, which I haven't made.

It is called "strawman"

You misrepresented someone's argument to make it easier to attack.

-- yourlogicalfallacyis.com/strawman

You assume that you are totally right and there is no chance that other person can be right. Let me introduce you to the work of David Dunning and Justin Kruger britannica.com/science/Dunning-Kru...

Thread Thread
crimsonmed profile image
Médéric Burlet

No I think that is you. To safe keep your argument you're comparing two different things Query Language with Markup Language. If you would be trying to be constructive you would compare 2 Markup languages.

stereobooster profile image
stereobooster Author

Please stop overreacting.

I asked for a definition of "program". Not a "programming language". I don't see where you gave a definition for a "program"