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
-
No, that would be terrible.
It takes source code control away from the programmer.
It assumes that the compiler can figure out exactly what the intent of the programmer is.
Also, a compiler's job is to exactly translate the source code to target code while preserving meaning, nothing more, nothing less. It can never do anything that can potentially change the meaning of a program.
You do have linters and realtime code analysis/intellisense/ide tooling that tells you that maybe you want to put a semicolon at the end of a line (eg. Many ides mark invalid code with a red squiggle). -
crisz81915yString s = "hello"
+ "wold"
A compiler would have troubles at guessing where's the missing semicolon -
Pickman6525yThat would be bad... But it could gently ask if you want the compiler to add it for you. Because let's face it, sometime the compiler does get what you're trying to do.
-
Pickman6525y@crisz not really. The next line starts with a binary operator so it must be at the end of the second line. I would not be against a tool that helps you fix such things at compile time (with human supervision of course). It would also establish a baseline for IDE (which could use some common standards).
-
@Pickman linters and ide error checkers exist for exactly this purpose, many of these programs are specialised compilers that are engineered to try to find errors as fast as possible and also suggest automatic fixes (eg. Visual Studio and IntelliJ suggest automatic fixes quite often).
Again, it's not the compiler's job. Crashing on error is a good idea when you can't afford to be wrong.
Btw, there is a common standard for source code analysis and hints and all, check out the language server protocol. -
@RememberMe idk what compilers you work with but I hate it when my compiler crashes on an error. I prefer an error message with line number and useful information instead of a crash.
-
@JustKidding I meant that the compiler just refuses to compile and stops, not that it doesn't give me any useful info.
If it just fixed stuff and went in compiling I'd get very uncomfortable. -
Pickman6525y@RememberMe language server protocol? Thanks I will look into it.
Personally I would not mind if they integrated some features now performed by IDEs into compilers but I understand (and share) your opinion that automatic generation of code can be dangerous. -
@RememberMe I was aware of that ;) it just triggered me since sometimes use some experimental features at work which causes the compiler to crash, sometimes even on correct code and that's really annoying sometimes
-
@JustKidding do you work with numerics and/or templates in C++ by any chance? :p
-
@RememberMe we're doing formal proofs in SPARK (has nothing to do with Apache Spark) and GCC doesn't like some of the proof annotations.
-
@JustKidding is that the Ada based thing? Sounds pretty hardcore. I've only experimented with Coq for formal proofs.
-
@RememberMe Yes, it is, we're also doing Ada ;) we mostly do low level stuff, e.g. formally proven device drivers in SPARK, platform support for smaller uncommon platforms and so on. But on some platforms you don't have the official Ada compiler (which is based on GCC) but only default GCC it can crash sometimes when you add too fancy proof annotations. Fortunately you don't need them to compile so you can comment them out on that target.
-
@JustKidding that's pretty damn cool man, keep at it. Hopefully I'll also be working with stuff like that one day.
Thought provoking!
random