Seems the use of // comments, whitespace, ordering things, all break things for reasons that I can’t make sense of. Perhaps just part of the way it is checked for errors? Not sure.

Anyway, I’ve made a generator here: https://perchance.org/1jt36ldioy#edit demonstrating. All the error-producing code is commented out so it doesn’t raise an error. Just uncomment one and you’ll see the error for that particular one.

  • wthit56@lemmy.worldOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 months ago
    ["hello"
    // hi
    ]
    

    That is a square-bracket piece of code, with a comment inside, as you said. All the examples are in square-bracket code. So… 👀

    The last output in those square brackets is "hello", a displayable text string. The comment should be ignored, right? That’s the point of a comment; that it’s not processed in any way.

    I think there’s just something about the way it’s processed and it’s erroneously thinking the comment is meant to be output. Which is definitely not the expected way comments work. Hence “odd errors and messages.” It’s not consistent with the concept of a comment, or just generally how comments work.

    (Plus those other weird situations too.)