• ValiantDust@feddit.de
    link
    fedilink
    arrow-up
    79
    arrow-down
    1
    ·
    2 months ago

    But are you gonna return something for this method??? You said you’d return an integer, yet there is no return statement!

  • tunetardis@lemmy.ca
    link
    fedilink
    English
    arrow-up
    33
    ·
    2 months ago

    Compiler/interpreter: Can’t find variable farfignewton.

    Earlier:

    Me: Declare variables near, far

    IDE: Oh! You mean farfignewton right? I found that in some completely unrelated library you didn’t write. Allow me complete that for you while you’re not paying attention.

    • brisk@aussie.zone
      link
      fedilink
      arrow-up
      4
      ·
      edit-2
      2 months ago

      I try my best to make my IDEs follow the principal that I should be able to type without looking at the screen, but apparently IDEs are really invested in return accepting completions to the point it’s often not configurable even when every other key is.

    • gregorum@lemm.ee
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      2 months ago

      thank you for flooding my memory with a bunch of silly 90s car commercials

    • Dojan@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      2 months ago

      Visual Studio: PROPERTY DOESN’T EXIST ON TYPE!! NOTHING EXISTS ANYMORE!!! REALITY HAS COLLAPSED!

      Me: What? I haven’t even touched that class, let me check.

      Visual Studio: Oops, nevermind, héhé 🙃

  • dudinax@programming.dev
    link
    fedilink
    arrow-up
    8
    ·
    2 months ago

    Me: <starts a heredoc>

    jetbrains: This heredoc goes on FOREVER!

    Me: I’m going to close it…

    jetbrains: <dies>

  • labsin@sh.itjust.works
    cake
    link
    fedilink
    arrow-up
    6
    ·
    2 months ago

    I start writing the implementation and get the “variable not defined” error and then let the ide add the declaration. It’s less keys to press and misspell.

  • kamen@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    2 months ago

    Imagine lint running on format and your linter removing unused variables: you start typing, hit format by muscle memory before using the variable. Rinse and repeat.

  • Dojan@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    2 months ago

    I recently started poking with Vue, For the most part when it comes to webapps I’ve mostly worked with React, Blazor, and a touch of Svelte. The linter is so aggressive. I start defining a method and it instantly goes “IT DOESN’T RETURN ANYTHING!!”

    Okay, thanks! I literally just defined the return type!

    • Prunebutt@slrpnk.net
      link
      fedilink
      arrow-up
      8
      ·
      2 months ago

      It’s probably gonna be optimized out by the compiler. However, linters will mark it for you, since it suggests that you actually wanted to do something with that variable and forgot about it after declaration.

      … Or it can be removed to reduce visual noise once it’s not necessary anymore after refactoring.

    • gens@programming.dev
      link
      fedilink
      arrow-up
      5
      ·
      2 months ago

      Lets say you use a variable named abcd in your function. And a variable named abcb in a for loop inside the same function. But because reasons you mistakenly use abcd inside that loop and modify the wrong variable, so that your code sometimes doesnt work properly.

      It’s to prevent mistakes like that.

      A similar thing is to use const when the variable is not modified.

    • Shareni@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      2 months ago

      Because it’s code that literally doesn’t do anything. Some languages won’t even let you compile without special instructions.