Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
myss45095yOhhh god, please don't put these ideas into their heads, I can see so many ways how this could backfire terribly.. 🙈
-
Not really. The compiler only knows that, at that point, whatever comes next doesn't make sense as a continuation of the current line. It doesn't really mean that exact position is where the semicolon should be: the correct point is usually several tokens back.
-
nbmc195yI don't think the compiler knows that. The ide shows a red underline under it and some ides have plugins that do that.
-
To be fair semicolons are kinda redundant nowadays. In all my time using languages that don't require them I don't think I have even once come across a situation where not putting a semicolon made the syntax ambiguous. That sad I still hate this because people that can't even put their semicolons properly shouldn't use a language without
-
Ooh, I think that's a good concept... for a programmer's nightmare story. Just imagine: Compilers. That. Assumes.
Good luck debugging on that. -
JavaScript is doing exactly that and it may lead to unexpected behavior.
Look at this:
return {
foo: "bar"
}
and this:
return
{
foo: "bar"
}
The first one will work, the second will return undefined as it becomes:
return;
{foo: "bar"};
You don't want that feature. -
Swift and Kotlin do have optional semicolons but unlike in JS, this is implemented safely.
Semicolons should and will die out. -
BitWise435yCompiler: "hey, somethings wrong here. I got this error for you."
Smart compiler imagined by this kid: "hey, somethings wrong. I got this error so here is your editor open to the snippet of code as well as the previous snippet that called it, a suggestion of what might be wrong and some underlines. Let me know when you think you solved it and I'll continue where i left off." -
There is a very big reason why this doesn't happen. It has to do with Turing automata and means that you have an undecidable/uncomputable problem. Personally though... I wish you would be given one chance to accept the request and see if you can continue compiling.
Related Rants
-
athlon9Schrödinger’s semicolon Source: reddit r/programming
-
makwayne7So this happened in my computer science class Creepy guy trying to be cheesy (to this pretty girl): "you're ...
-
Pointer19School time, programming class: Girl: Hey, Can you help me? Me: Sure, what's up? G: I have an error but I don'...
That's a point!
joke/meme
semicolon
compiler