34
Nihil75
181d

You know that moment you realize you read/write the wrong variable, and that's why u were stuck for 2-4 hours?

That.

Comments
  • 3
    It happens.
  • 5
    @kamen I lost 1 hour today uploading a file from the wrong folder - took too long to figure out why the code STILL wasn't working.
  • 2
    I was doing a side project making a C64 music tracker (so yeah, it's really my own fault), spent an entire day trying to work out why one set of values was not being written to the sound chip...came back the next day to find, at the end of the routine, I was manually pushing values to it, had even left the comment //REMEMBER THAT YOU ARE FORCING THE VALUES HERE and I must have scrolled past that a hundred times. I remember people at school would justify not being clever by disparaging others 'all the brains in the world and not an ounce of common sense', I think that about nails coders though.
  • 3
    I wrote some code for a side project. Wasn't working. Turns out, instead of typing fooBar, I wrote foobar. Took me an hour to figure it out.

    Note: that weren't the actual names of the variables, I'm not a neanderthal. Just can't remember them off the top of my head.
  • 0
    @connormon You need a non-idiotic language.
  • 0
    I once spent the last day leading up to a non-delayable product launch on trying to figure out why Compose wasn't working on the fresh EC2 instance where I forgot to install Docker.
  • 0
    @lbfalvy what would you consider a non idiotic language?
  • 0
    @connormon That's a very subjective question, so instead I'll tell you why this problem only occurs in an idiotic language:

    Assigning a new value to a variable and creating a new variable are non-overlapping use cases. Non-overlapping use cases shouldn't have identical syntax. A programming language that assigns identical syntax to non-overlapping use cases does so deliberately, because it's generally easier to execute an unambiguous command than to interpret it based on context. Somebody spent time making sure that you can make this mistake.
  • 0
    @connormon The other ridiculous property of many scripting languages is how they don't throw syntax errors until you call the function. Parsing a file is generally easier than parsing fragments of it on-demand, so again, a lot of effort went into making the language less ergonomic. Generally, the principle with scripting languages seems to be to fail as late as possible, preferably when some but not all of the incorrect persistent state changes have been committed, even for the most banal errors like mistyping a variable name. NaN also fits into this.
  • 1
    @lbfalvy Can't argue with that. All true.

    But u know, similar shit happens in C# -

    You define an array: `private float[] myArray`,

    And then you can write to it, but it's not working, array stays at 0 elements.

    Why? because you forgot to do `myArray = new float[5]` ....

    You don't get an error. not in IDE, not at runtime.
  • 1
    @Nihil75 That's an entirely different level of safety but it's definitely possible; tons of type systems are null safe. Rust, Typescript and (so I hear) Kotlin come to mind
  • 0
    Had this problem, then went static types. Don’t want to go back, maybe the exception being Clojure.

    I thought good IDEs highlight that kind of issues?
Add Comment