8
submitted 5 days ago* (last edited 5 days ago) by EuAndreh@programming.dev to c/programming@programming.dev

Back writing in my website.

all 31 comments
sorted by: hot top new old
[-] talkingpumpkin@lemmy.world 4 points 4 days ago

is

: <<EOF
  text
  text
EOF

a bash-ism?

[-] EuAndreh@programming.dev 2 points 4 days ago

AFAICT, not really, looks line POSIX sh at a glance. Just don't forget to : <<'EOF' instead of : <<EOF.

But : is arguably simpler than cat, one fewer fork/exec call plus no open(2) on /dev/null.

[-] EuAndreh@programming.dev 2 points 4 days ago

I like it, thanks :)

[-] thingsiplay@lemmy.ml 5 points 5 days ago

I think this solves an issue, that's not an issue at all and makes it more complicated and harder to read. What do I mean by that?

It requires more text and exact correct syntax of multiple elements. It makes it harder to see where the start and end is, and one has to look for any lines that could potentially be a comment in a heredoc. The syntax highlighter does not show this in comment color. Bash still executes those lines to read the "comment", as it thinks its normal code. In example variables can still be expanded in heredocs. Other tools removing comments from script to count lines would be fooled too.

Compare this to a single hashtag symbol in the beginning of each comment. That's all. This is also good practice everyone understands. From practical point of view, why would anyone use heredocs for multi line comments over single line comments?

[-] FizzyOrange@programming.dev 4 points 5 days ago

Yeah but... Don't. Multiline comments are a bit of an anti-pattern at the best of times. This is a war crime.

[-] TehPers@beehaw.org 2 points 5 days ago

Multiline comments are a bit of an anti-pattern at the best of times.

If you're making this as a general statement, it varies from language to language. For example, CSS (and arguably HTML and Markdown) only supports multiline comments, and multiline comments are often used for documentation (as with jsdoc and, though only comments in the same way that heredocs to /dev/null are, Python).

But yeah, if you actually do this in Bash, wat.

[-] thingsiplay@lemmy.ml 3 points 5 days ago

CSS (and arguably HTML and Markdown) only supports multiline comments, and multiline comments are often used for documentation

Those aren't programming languages. Because, especially in HTML, a line end does not end an instruction and is just for formatting. So single line comments would be very awkward in HTML, so they had to use multi only. And because CSS is meant to be used close to HTML, I think they opt in to the same. JavaScript in example has single line comments again.

Does any programming language exist that supports multiline comments only without single line comments?

[-] EuAndreh@programming.dev 4 points 5 days ago* (last edited 5 days ago)

C89, AKA ANSI C famously only supports /* */, having // as a cross-pollinated idea from C++.

[-] thingsiplay@lemmy.ml 4 points 5 days ago* (last edited 5 days ago)

Good example, at least historical. ;-) I wonder why they never added single line comments before. I mean it took them quite a long time to do so. Languages before 1960 even had single lines too.

Edit: BTW it was common in C to write multiline comments to have them look like single line comments too, because that's easier to read and understand. Maybe that's why they didn't feel the need for, because in practical usage it could be replicated. In example as:

/* Title
 * description
 * variables
 */

This could easily be replaced by single lines as:

// Title
// description
// variables
[-] TehPers@beehaw.org 0 points 5 days ago* (last edited 5 days ago)

Both HTML and CSS (when together) are turing complete, and JSX syntax only supports HTML comments in many places.

JavaScript having single line comments isn't really relevant. Multiline comments are in heavy use there, arguably moreso than single line comments.

Edit: and I should add that "programming languages" is moving the goalpost. The person I responded to didn't qualify their statement to programming languages.

[-] thingsiplay@lemmy.ml 1 points 4 days ago* (last edited 4 days ago)

Edit: and I should add that “programming languages” is moving the goalpost. The person I responded to didn’t qualify their statement to programming languages.

I think from context it is apparent that we are not talking about HTML and CSS (which you brought this up yourself, not the person you responded to). I think there was no need to specify his statement was to programming languages, by context we know it is. Also we are in Programming.dev. What context do you need more?

[-] TehPers@beehaw.org 1 points 4 days ago

TIL programmers don't write HTML and CSS.

(I guess if all you use are LLMs to write it, maybe that's true.)

[-] thingsiplay@lemmy.ml 1 points 4 days ago

You understand the difference between a markup language to display text with HTML and CSS, and a programming language to execute programs. Right? And this has nothing to do with LLMs. I don't know why you are in an attacking position for no reason. I didn't want hurt anyone, just discussing here.

[-] TehPers@beehaw.org 1 points 4 days ago

I don't know why you are in an attacking position for no reason. I didn't want hurt anyone, just discussing here.

You are being excessively pedantic over a topic that has absolutely nothing to do with the discussion. I don't know how you want me to respond to these comments.

As a reminder, what I was responding to was whether multiline comments are an anti-pattern, not whether HTML+CSS is a programming language.

[-] thingsiplay@lemmy.ml 1 points 4 days ago

You are being excessively pedantic

I am not excessively pedantic, maybe you are just confused. (This is what you get, if you cant stop attacking personally.)

I was responding to was whether multiline comments are an anti-pattern, not whether HTML+CSS is a programming language.

Yes, and you brought up HTML and CSS as an example, which I invalidated the example with the given reasons. You was the one bringing up markup languages to programming languages discussion. And I pointed out this is a programming forum, the topic is about programming and the statement can be assumed to be programming related, not generalized across all type of languages (like markup, as you brought it up).

[-] TehPers@beehaw.org 1 points 3 days ago

Well no, in your pedantry, you've failed to actually contribute to the discussion.

And while we're being pedantic, by the most common definition of a programming language, HTML+CSS is Turing complete and therefore a programming language. Again, not that it matters.

And I pointed out this is a programming forum

Sorry, I didn't realize you were an admin here and that discussing HTML and CSS are not allowed here.

[-] thingsiplay@lemmy.ml 1 points 3 days ago

Well no, in your pedantry, you’ve failed to actually contribute to the discussion.

No, you failed to contribute to the discussion with wrong argumentation and bringing up a topic that has nothing to do with it. You were the one arguing why the other person is wrong. Now you cry if someone points your failure out. (BTW that is what you get for keeping the personal attacks.)

by the most common definition of a programming language, HTML+CSS is Turing complete and therefore a programming language.

This does not matter. Because the purpose and usage of both languages are markup languages, not programming languages. And you say I am the one being pedantic (for no reason btw)...

Sorry, I didn’t realize you were an admin here and that discussing HTML and CSS are not allowed here.

Now you are being childish, just because someone pointed out that your example was wrong (with given reasons). Nobody said you aren't allowed to talk about HTML and CSS, I just pointed out that the argumentation was wrong.

[-] thingsiplay@lemmy.ml 2 points 5 days ago

I don't think that being turing complete means anything in this discussion, because it does not change what the language is for and how its used and interpreted. HTML and CSS are not instructions for the CPU, they are markup languages describing text for humans, not compiling it down to execute machine code for CPUs.

[-] TehPers@beehaw.org 2 points 5 days ago

Again, the discussion was about multiline comments, not programming languages.

And regardless of all that, JSX remains one of the most used languages in the world and supports only multiline comments in certain contexts, and JavaScript as a whole uses multiline comments generously.

The discussion was around multiline comments being an anti-pattern, which is entirely untrue. They just serve a different purpose than single-line comments, and usage varies from language to language.

[-] thingsiplay@lemmy.ml 1 points 5 days ago

The discussion was around multiline comments being an anti-pattern, which is entirely untrue.

It is an antipattern in Bash. He did not say that for HTML or JavaScript.

[-] TehPers@beehaw.org 1 points 5 days ago

Bash doesn't have multiline comments. Even the article acknowledges this lol. From context, it was a general statement, not specific to Bash.

[-] thingsiplay@lemmy.ml 2 points 5 days ago* (last edited 5 days ago)

The entire point was having multiline comments in POSIX shell. So that's what we are discussing here right? That's the entire reason we discuss this. Edit: Also as said, this is about programming languages, not markup languages.

[-] FizzyOrange@programming.dev 1 points 4 days ago

The fact that CSS only supports multiline comments doesn't mean multiline comments are good, it means CSS is badly designed.

[-] TehPers@beehaw.org 1 points 4 days ago

It means neither of those, actually, just that CSS supports only multiline comments.

Multiline comments remain prevalent across ecosystems though (like in JS and Python). If you believe they're bad there too, that's fine, but the fact is that it would be an anti-pattern to go against those established standards.

[-] EuAndreh@programming.dev 1 points 5 days ago

I use this only when developing, mostly while debugging. IIRC I've never commited code like this.

[-] FizzyOrange@programming.dev -1 points 5 days ago

Close notepad.exe. Open a real editor. Select the text you want to comment out. Press Ctrl-/

[-] EuAndreh@programming.dev 0 points 5 days ago

No notepad.exe, nvi: 'a,s/^/# /.

[-] CameronDev@programming.dev 2 points 4 days ago
[-] EuAndreh@programming.dev 2 points 4 days ago

Oops, renamed the www dir, should be back now.

this post was submitted on 05 Sep 2026
8 points (78.6% liked)

Programming

28414 readers
448 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 3 years ago
MODERATORS