- cross-posted to:
- [email protected]
- cross-posted to:
- [email protected]
Had errors like this once. Wracked our brains for hours. Eventually realized we had an old version of the code running on some hosts and the new version running alongside it on others. The code had changed enough that the line numbers didn’t make sense anymore.
You probably passed a bad argument to a library, or a line wasn’t terminated properly.
well, it is better than an error with no description, filename, line of code nor exit code or linke to a log file… I have had way too many of those in those pesky “no code” environments and applications that is supposed to make programming equipment easy.
I hate these. You don’t need to program for very long before you see one of these. And, you get used to the idea that when it says there’s an error on a blank line, that it means something isn’t properly terminated on one of the previous lines. But, man, I hate these.
At the very least, you’d hope that by now compilers/interpreters would be able to say “error somewhere between line 260 and 265”. Or, more usefully “Expected a closing ‘)’ before line 265, opening ‘(’ was on line 260”.
Error on <blank line> just pisses me off because the compiler / interpreter should know that that isn’t true. Whoever wrote the compiler is a seasoned developer who has been hit by this kind of error message countless times. They must know how annoying it is, and yet…
My personal favorite is when it complains about a missing semicolon. So it’s 100% knows what the problem is, it knows where the problem is, and it knows how to fix it. But it’s not going to fix it out of spite.
Thing is, if it just guesses what you meant instead of sticking to the standard, you can end up with ambiguous meanings. Like what if you forgot a character that wasn’t a semicolon but inserting a semicolon would turn it into valid code?
Like:
x = y z++;
Inserting a semicolon would turn that into set x to the value of y and then increment z. But maybe the line is missing a plus instead of a semicolon and the intent was to set x to y plus z and then increment z.
It’s a pain but strict syntax helps avoid frustrating to debug bugs.
Taking it a step even further, you can make your code more robust by treating warnings similarly to errors. Even though the general cases usually still work despite warnings, they are great for avoiding edge cases that can also be difficult to debug. At least if you take the time to understand what the warning is really about and don’t just google “how to get rid of warning x” and add some casts or something you don’t understand to make the message go away.
Oh boy, are you gonna LOVE Javascript
Is your point that JS doesn’t really need semicolons at all any more?
Not just that, it’s the reason why it doesn’t need semicolons: https://en.wikibooks.org/wiki/JavaScript/Automatic_semicolon_insertion
Javascript and html are more suggestions on how to write something that may work in a web browser.
This is why i flunked college
There’s also “you forgot to save before you ran the compiler”, and yeah, whatever is on that line in the stored to disk version is garbage.
That’s the worst when your cycle time is very long. You fix a bug in the code, start your test running again and come back to check the next day only to see the exact same bug again and might think that your fix didn’t work and something more esoteric is going on (“maybe it’s a compiler or hardware bug!” (It almost never is)).
Then you add a bunch of debug prints to really get a good idea of what’s going on and rerun the test. Either you remembered to save and suddenly the mystery bug is gone because the fix is still in the code. Or maybe you forgot to save again and now it looks like it’s not even reaching any of the code you added the prints to.
May I introduce you to our Lord and savior, rustc?
im_in_danger.exe
I hate that I noticed the syntax error on line 263 before I realized what the joke was. (at least I assume that 260 contains a function with a callback meaning it is missing the closing parenthesis)
My assumption is that it’s setting up an object to map element selectors -> callbacks.
var specialElementHandlers = { '#editor': function() { return true; } };
But yeah, could be something as
var specialElementHandlers = Object.assign({}, defaultHandlers, { '#editor': function() { return true; } }; // missing closing parenthesis
Yeah, it’s not a joke, it literally happens all the time, and an error after block close generally means the system doesn’t think it’s closed, usually because a bracket isn’t paired off.
No one seems to mention this but a lot of the time the code in the binary might not be the same code you see in your IDE so the line number doesn’t match. Intellij for example decompiles libraries when you open them and you have to press a button to download the actual source with all the comments and everything
You need to do binary search. Comment out all lines in the IDE, save, push to master, and then close the laptop
Jokes on you, master is locked and can not be pushed to in repos i manage at work
Fine, then push to dev and make a PR, urging your line manager to merge it quickly without review since it’s a small hotfix
Fix a spelling error, but that broke the compiler so reverted the change and now it’s still broken. Please merge.
Perfect
that’s everyday with the legacy web app at work, it crunches up code in a templating process and all the errors become either completely meaningless or just “error 500”
Reminds me of AWS Lambda. Gateway Error 502 you say? Gotta go digging in the application logs!
that’s IIS as well, I think it’s because we had our severs configured in a reverse proxy and hitting IIS and failing before the http serverhad returned a response caused the 502 error, completely useless error.
(not very experienced with server configs so forgive me if the language isn’t 100%)
You think this is bad? Go look at compile time Blazor error messages.
Eh, those usually ain’t too bad. Runtime Blazor errors usually are a bit more annoying, sometimes requiring you to open up the intermediate compiled cs files.
Me: Tries to learn to use C++ templates and custom containers again.
C++: Wall of hieroglyphics.
Me debugging SQL syntax errors in complied dbt models.
I really enjoyed working with SQLDelight when I was briefly writing a Kotlin backend, sadly it wasn’t complete enough. (It “generates typesafe Kotlin APIs from your SQL statements.”)
Doing PDF handling with jQuery? Yeah, it do be like that sometimes.
Files should have ended on line 200…
I was kind of thinking that yesterday when looking at a Rust library. Rust is competent with line numbers, so you don’t really have an incentive for splitting files from that angle, but sometimes, folks just seem to keep adding to their files ad infinitum.
Well, specifically that library has a few files with more than 1k lines. And I hope this one’s the largest at 4k lines: https://docs.rs/git2/latest/src/git2/repo.rs.html
What also needs to be said, is that this library is actually maintained by the Rust language team. Really makes me want to open an issue to tell them that Rust has a pretty cool module system. 🙃