this post was submitted on 06 Mar 2024
522 points (96.1% liked)

Programmer Humor

32558 readers
539 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] jol@discuss.tchncs.de 38 points 8 months ago (3 children)

For all intents and purposes, a markup document is a script that outputs a document. There's no point in saying the HTML isn't a programming language. Not all languages have to be general purpose.

[–] pixelscript@lemmy.ml 40 points 8 months ago (2 children)

The bar for me is whether the language describes an executable program that has state and control flow.

You could perhaps be generous and describe the DOM as a (write-only) state and the parser as a control flow. I don't, personally.

HTML is just a data container format to me. Belongs with the likes of XML, JSON, JPG, PNG, GIF, MP3, MOV, etc.

The umbrella term I'd use for all of these is "coding". That's the skill of understanding structured languages and format specifications, and understanding how you can and can't piece things together to make something coherent. This is a critical requisite skill to programming. But programming is more.

Programming is the art of juggling of state and control flow in clever ways to trick funny rocks into computing something you don't know. It doesn't need to be general purpose, but I would argue it indeed needs to have a purpose. It has to be something more than just a pile of declarations you know from the outset. Otherwise it's just structured data.

[–] WldFyre@lemm.ee 14 points 8 months ago (1 children)

The umbrella term I'd use for all of these is "coding".

Saying "it's not programming it's coding" is like engineer "it's not dirt it's soil" levels of pedantry that are silly to expect people outside your profession to know.

Hey, maybe you are engineers after all lol

[–] pixelscript@lemmy.ml 5 points 8 months ago (1 children)

Sure. Which is why I would only make this distinction in a place where I can reasonably expect people to know better. Like, perhaps, a niche community on an experimental social media platform dedicated to programming.

[–] frezik@midwest.social 0 points 8 months ago

That'd be nice, but it's obvious who is and isn't a programmer in this one.

[–] docAvid@midwest.social 1 points 8 months ago (2 children)

So, writing stateless functions, or working in declarative languages doesn't count?

[–] pixelscript@lemmy.ml 2 points 8 months ago (1 children)

Stateless functions still deal with state, they just don't hold onto it. Without state to mutate, a so-called stateless function doesn't do anything.

In declarative languages, your state is the sum of everything you've declared. You don't query results out of thin air. Computational results logically conclude from everything you set up.

HTML ""has state"", as in it has a DOM, but it doesn't do anything with it. You don't mutate the DOM after it's built, or query the DOM to compute results that weren't trivially evident from the state you declared.

You can do those things with JavaScript. But all that proves is JavaScript is a programming language, and HTML is just a data format it can interact with.

[–] docAvid@midwest.social 1 points 8 months ago

Programming is the art of juggling of state and control flow

Sure, stateless functions deal with and impact state in some way. If that's what you meant by your previous comment, that's fine, but that's honestly not what would typically be meant by "juggling" state.

The part about declarative languages has nothing to do with state. Declarative languages do not give the programmer control over flow, the other part of your definition.

Learn Lisp, and you will never again be so certain about the difference between a programming language and a data format.

[–] frezik@midwest.social 1 points 8 months ago (1 children)

There's no such thing as a pure functional language. All it would accomplish is warming the CPU up. All such languages store data away at some point.

[–] docAvid@midwest.social 1 points 8 months ago (1 children)
[–] frezik@midwest.social 1 points 8 months ago (1 children)

Your statement implies it. Having stateless or declarative functions that never store or retrieve data would mean they are pure functions.

[–] docAvid@midwest.social 1 points 8 months ago

No, my question does not imply a pure functional language at all. Pure functions exist in languages which are not purely functional. Most of the functions I write are pure functions. I could have a workflow where I work with another programmer who handles the minimal stateful pieces, and I would only write stateless functions - would that make me not a programmer?

(There are also purely functional languages, by the way. I just didn't remotely imply there were, or make any claims about them, at any point in this thread, prior to this parenthetical.)

The part about declarative languages has nothing to do with state, or functional languages. Declarative languages are a whole different thing. Of course declarative languages handle state. The comment I was replying to said "Programming is the art of juggling of state and control flow". Declarative languages don't involve juggling control flow.

[–] okamiueru@lemmy.world 16 points 8 months ago* (last edited 8 months ago) (2 children)

Not really. If so, you might as well consider the stuff you can use to format a comment here on lemmy, as "programming". That's conceptually more similar to HTML as what programming actually is.

quote

some title

Ooo hyperlink

Etc.

[–] jol@discuss.tchncs.de 13 points 8 months ago

Yes, markdown is as much programming as HTML.

[–] UnverifiedAPK@lemmy.ml 2 points 8 months ago* (last edited 8 months ago) (2 children)

Yeah.. there are macros to handle formatting. Next you'll say Scratch isn't programming either.

[–] frezik@midwest.social 8 points 8 months ago

To my knowledge, Scratch can save information away and retrieve it later. That's enough to be programming. There are Theory of Computation reasons for this; it's not an arbitrary distinction.

[–] okamiueru@lemmy.world 3 points 8 months ago* (last edited 8 months ago) (1 children)

That's such a weird point to make. Is it because to you, it seems like the line drawn is arbitrary? I cannot imagine any other reason. Certain words just mean certain things.

Markup languages are exactly as much "programming" as you marking a word and hitting "bold". Which is to say, nothing at all. People are wrong all the time, and I have a very limited amount of fucks to give when it happens.

As for Scratch, it is a programming language. So, why would you think it's a logical next step for me to say otherwise? Next, you'll say something remarkably dumb in response. Resist the temptation, and do something more productive.

[–] pivot_root@lemmy.world 3 points 8 months ago (1 children)

If he had said "LaTeX" or "roff", that might have been a good example of something that blurs the line between the two. They aren't specifically intended to be programming languages, but with a powerful enough macro system, a markup or typesetting language can be used in the same way as something like Brainfuck.

[–] okamiueru@lemmy.world 2 points 8 months ago* (last edited 8 months ago)

Absolutely. Those you suggest there are good examples.

Good enough that, instead of "is/isn't" programming language, it would be more a "ah, so, how do you define that then?". Now that I've had some sleep, one could argue that I could have been nicer and suggested that approach for HTML as well. After all, it's just words that mean stuff, and transfer a concept between people, that translate to the same (ish) idea. The moment the latter isn't the case, it's no longer very useful for the former.

Most disagreements, I find, are just cases of different understandings. Discussions worth having is when both are correct but different, and both want to figure out why they differ. So, on second thought, I think I was appropriately rude ^_^

Both LaTeX and roff are Turing complete, but they are also DSLs with a somewhat narrow "domain". Sounds exactly right that these blur the lines between what is/isn't. You could even argue that claiming one or the other is just one way to express how you understand that difference.

[–] frezik@midwest.social 1 points 8 months ago (2 children)

If a language can't store information and retrieve it later, then there is a limit to its usefulness. There are problems it cannot solve.

That's OK, because not every language needs to be do that in order to serve its niche, but it's not a programming language.

[–] jol@discuss.tchncs.de 7 points 8 months ago (1 children)

As I said, not all programing languages are general purpose. Just because there are problems it can't solve does not mean it's not a programming language.

[–] frezik@midwest.social -4 points 8 months ago (1 children)

Yes, that's exactly what it means.

[–] docAvid@midwest.social 1 points 8 months ago

No, it's really not.

[–] ferralcat@monyet.cc 2 points 8 months ago (1 children)
[–] frezik@midwest.social 2 points 8 months ago

No. A form can't do anything except send data to a server or get handled in the browser by Javascript (or Typescript or whatever). In either case, HTML is not capable of storing or retrieving anything on its own. It only provides an interface for potentially doing that.