Back writing in my website.

  • thingsiplay@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    15 hours 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?

    • TehPers@beehaw.org
      link
      fedilink
      English
      arrow-up
      0
      ·
      edit-2
      14 hours 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
        link
        fedilink
        arrow-up
        0
        ·
        14 hours 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
          link
          fedilink
          English
          arrow-up
          0
          ·
          14 hours 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
            link
            fedilink
            arrow-up
            0
            ·
            14 hours 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
              link
              fedilink
              English
              arrow-up
              0
              ·
              14 hours 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
                link
                fedilink
                arrow-up
                0
                ·
                14 hours 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.

      • thingsiplay@lemmy.ml
        link
        fedilink
        arrow-up
        0
        ·
        15 hours 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.