• x4740N
    link
    fedilink
    English
    arrow-up
    96
    arrow-down
    1
    ·
    11 months ago

    Wouldn’t most development programs tell them the syntax error on the line and column where you replaced the semicolon

    This wouldn’t work

    • lechatron@lemmy.today
      link
      fedilink
      English
      arrow-up
      39
      ·
      11 months ago

      Just tested in the console, it gives an illegal character error and gives you the line number.

    • Cipher22
      link
      fedilink
      English
      arrow-up
      17
      arrow-down
      1
      ·
      11 months ago

      It would work for someone just starting and not knowing good tooling yet. However, the compiler should also tell you where to look and give you the area to look at as well. It’ll be less clear than an IDE, though.

    • saigot@lemmy.ca
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      10 months ago

      Yeah, doing something similar with brackets would be much more effective since that usually doesn’t give a line number. Is there a unicode clone of )?

    • kamen
      link
      fedilink
      arrow-up
      2
      ·
      10 months ago

      Yup. It’s as if we’re assuming this friend is coding inside Notepad.

  • Brickardo@feddit.nl
    link
    fedilink
    arrow-up
    64
    ·
    11 months ago

    Why, of all possible languages, would you suggest this for Javascript where semicolons are not mandatory

  • phorq@lemmy.ml
    link
    fedilink
    Español
    arrow-up
    51
    ·
    11 months ago

    Even better would be to remap their keyboard’s semicolon key to that symbol

  • Passerby6497
    link
    fedilink
    English
    arrow-up
    29
    ·
    11 months ago

    Meanwhile in VS Code: hey, I see this Unicode symbol that’s confused for this expected symbol, would you like to replace it?

    • notthebees@reddthat.com
      link
      fedilink
      arrow-up
      5
      ·
      11 months ago

      I had a friend who was a compsci minor who did almost the entirety of said minor on a really old chromebook. They did everything on a basic text editor. You would be surprised

      • baatliwala
        link
        fedilink
        arrow-up
        18
        ·
        11 months ago

        I mean, if they’re evaluating hand written code no sane teacher is going to go “Good God this isn’t a semi colon, it’s a Greek question mark!”

    • whotookkarl
      link
      fedilink
      arrow-up
      2
      ·
      11 months ago

      BOM U+FEFF is another fun one, most editors won’t show it but it can cause errors like when I found one in a SQL script that was combined from existing utf-8 files together with cat. You’ll see it in a hex editor or in notepad I think it just made the rest of the line italic.

  • moshtradamus666
    link
    fedilink
    arrow-up
    20
    ·
    11 months ago

    That’s too evil. At my work people like to put a tape under someone’s mouse and it can be pretty funny.

    • Zerush@lemmy.mlOP
      link
      fedilink
      arrow-up
      6
      ·
      edit-2
      11 months ago

      Some hairs under the lens, it gives some funny erratic moves of the pointer.

        • Albbi@lemmy.ca
          link
          fedilink
          arrow-up
          5
          ·
          11 months ago

          It’s ok, someone either put a hair under his ‘e’ key, or remapped it so that it randomly spits out ’ instead.

      • LittleBorat2@lemmy.ml
        link
        fedilink
        arrow-up
        7
        ·
        11 months ago

        The funny erratic movement can keep your work pc from locking up while you do nothing. It’s win win.

    • Feyr
      link
      fedilink
      arrow-up
      1
      ·
      10 months ago

      If you get a post-it just right halfway over the lens, the mouse will only move in one direction!

  • fubarx@lemmy.ml
    link
    fedilink
    arrow-up
    15
    ·
    11 months ago

    MSVC supports unicode. In C or C++, you could try:

    #define ; ;

    Second one is the greek semicolon but the client I’m using may strip it out. I’m too lazy to try.

    • PM_ME_VINTAGE_30S [he/him]@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      3
      ·
      11 months ago

      Running #define ; anything yields error: macro names must be identifiers for both C and C++ in an online compiler. So I don’t think the compiler will let you redefine the semicolon.

      • fubarx@lemmy.ml
        link
        fedilink
        arrow-up
        3
        ·
        11 months ago

        Haha. Thanks for checking. Given the C pre-processor, I’m sure there’s a way to maliciously bork it if someone sets their mind to it.

        • PM_ME_VINTAGE_30S [he/him]@lemmy.sdf.org
          link
          fedilink
          English
          arrow-up
          2
          ·
          edit-2
          11 months ago

          Well I just tried #define int void in C and C++ before a “hello world” program. C++ catches it because main() has to be an int, but C doesn’t care. I think it is because C just treats main() as an int by default; older books on C don’t even include the “int” part of “int main()” because it’s not strictly necessary.

          #define int void replaces all ints with type void, which is typically used to write functions with no return value.

    • Sailing7@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      11 months ago

      I’m not sure but I think the second one looks just a tiny bit different, so it should have worked.

  • dlok
    link
    fedilink
    arrow-up
    11
    ·
    11 months ago

    Wanted to use this to prank a colleague but SQL server accepts that as well lol

  • Frozzie
    link
    fedilink
    arrow-up
    9
    ·
    11 months ago

    Hah. Try it on my version controlled project!

    • Zerush@lemmy.mlOP
      link
      fedilink
      arrow-up
      5
      ·
      edit-2
      11 months ago

      What? Remapping your keyboard? Well, there are worst jokes, I still remember that time when the first PCs appeared and you could try them in shopping centers. They quickly stopped doing this, because some went into the BIOS and disabled the keyboard or worse, the screen, Hail Satan. Good ol’ times 😏