85
Comments
  • 30
    Ohhh god, please don't put these ideas into their heads, I can see so many ways how this could backfire terribly.. 🙈
  • 34
    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.
  • 17
    There was one attempt to do this. If called JavaScript.
  • 3
    I don't think the compiler knows that. The ide shows a red underline under it and some ides have plugins that do that.
  • 0
    And thus V8 was born
  • 3
    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
  • 2
    These type of kids grow up to design languages like Go.
  • 3
    Ooh, I think that's a good concept... for a programmer's nightmare story. Just imagine: Compilers. That. Assumes.

    Good luck debugging on that.
  • 2
    Fixing semicolon errors was not part of the compiler's job description.
  • 7
    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.
  • 2
    Swift and Kotlin do have optional semicolons but unlike in JS, this is implemented safely.

    Semicolons should and will die out.
  • 1
  • 1
    Compiler: "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."
  • 2
    Yea, now we all know that JavaScript was written by 16-year-olds
  • 2
    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.
  • 0
Add Comment