News for hackers. Stuff that matters.
Re:You can't do that because I hate you by gruez on Thursday December 28, 2023 @05:29PM (#38799532)
How do you feel about java/c++ compiler that give hints like "missing semicolon"? Clearly it knows what's wrong. Why not automagically fix that for you[1]?

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Re:You can't do that because I hate you by akoboldfrying on Thursday December 28, 2023 @06:50PM (#38800197)
JavaScript automatic semicolon insertion does a great job most of the time, but still leads to bafflement when code like

    const b = 1
    [1, 2, 3].forEach(console.log)
(from your linked page) does the wrong thing, because both forms (with and without a semicolon) are syntactically valid. I would much rather just always use semicolons (or, like Python, never use them) than have to memorise the 5% of oddball cases where I need to add them manually to resolve ambiguity.
Re:You can't do that because I hate you by ryandrake on Thursday December 28, 2023 @08:57PM (#38801004)
I'd actually love that feature!

We have AI now that can write the entire code for you. Surely it's not much to ask that a compiler, as it parses your code and likely already has high confidence you need a semicolon in a certain spot, can just correct it for you and move on. Maybe have a --fix-errors option to the compiler command line or something.