News for hackers. Stuff that matters.
Re:Rust Moving Towards an IDE-Friendly Compiler with Rust An... by Buttons840 on Saturday February 01, 2020 @07:57PM (#22214392)
> A piece of code looks error-free, then you fix an error somewhere else, reach the next compiler phase, and an error pops up where you just were.

Isn't this the case with all compilers? The most basic example being (for example) I have a syntax error on line 10, and that's the only reported problem, but then I fix the syntax error and now I have an error on line 200.

I agree it is a problem, the world would be better if all languages could avoid it, but I don't expect it ever to go away. Do you believe this problem is better or worse in Rust compared to other languages?

Re:Rust Moving Towards an IDE-Friendly Compiler with Rust An... by the8472 on Saturday February 01, 2020 @09:14PM (#22214707)
Eclipse's ECJ will keep compiling a class even when a specific method is invalid.

And even inside a method it'll try to massage the AST into a somewhat valid state while you're typing so it can keep analyzing the code and show errors/make suggestions. A missing bracket on line 15 won't prevent it from soldiering on to spot a misspelled method call in line 40 even though the nesting is totally messed up and if taken at face value line 40 would be syntactically invalid since it's outside the class body.

Re:Rust Moving Towards an IDE-Friendly Compiler with Rust An... by usrusr on Saturday February 01, 2020 @11:15PM (#22215101)
And it doesn't just march on to identify errors elsewhere, it can often continue all the way to runnable bytecode. The invalid parts will just be replaced by exceptions that parrot the compiler error. Meanwhile other code paths can already be exercised which can be very handy at times.
Re:Rust Moving Towards an IDE-Friendly Compiler with Rust An... by gmueckl on Sunday February 02, 2020 @02:43AM (#22215740)
On the flipside, I have managed to actually run non-compiling Java classes because of that a couple of times, only to stare at the debugger with wide eyes when I realized what was going on.
Re:Rust Moving Towards an IDE-Friendly Compiler with Rust An... by _bxg1 on Saturday February 01, 2020 @09:38PM (#22214797)
I could even understand not trying to handle the brackets scenario. In RLS, a type error on a local variable can hide a borrow-checker problem in a completely different file.
Re:Rust Moving Towards an IDE-Friendly Compiler with Rust An... by Matthias247 on Saturday February 01, 2020 @09:39PM (#22214803)
It’s more pronounced than in other languages. You could have an entire file with zero errors. No red squiggles, nothing. Then after you fix your errors in different files suddenly errors show up (eg for borrow checking, thread safety analysis, etc).
Re:Rust Moving Towards an IDE-Friendly Compiler with Rust An... by dx87 on Saturday February 01, 2020 @10:26PM (#22214946)
That always gets me. I'll be writing some code and think I finally got really proficient with Rust because I'm not getting any errors or warnings, then I try to compile and find out an error in another file was preventing the compiler from showing me everything wrong in my current file.
Re:Rust Moving Towards an IDE-Friendly Compiler with Rust An... by mxcrossb on Sunday February 02, 2020 @02:57AM (#22215790)
Yes I think what rust fans should argue is not that it’s just like compile time errors in other languages, but more like run time errors.
Re:Rust Moving Towards an IDE-Friendly Compiler with Rust An... by _bxg1 on Saturday February 01, 2020 @09:00PM (#22214646)
In other languages I'm familiar with as long as the syntax can actually be parsed, errors are mostly localized. Of course if you change the type of something that can cause errors elsewhere. But this is different. The new errors have nothing at all to do with the one that was fixed except that they come from an earlier stage of the compilation process.
Re:Rust Moving Towards an IDE-Friendly Compiler with Rust An... by edflsafoiewq on Saturday February 01, 2020 @08:18PM (#22214490)
> Do you believe this problem is better or worse in Rust compared to other languages?

Unlike other languages, Rust still has borrow checking to go after all the type errors are gone.

Re:Rust Moving Towards an IDE-Friendly Compiler with Rust An... by pjmlp on Sunday February 02, 2020 @07:01AM (#22216560)
An idea currently being added to Swift, C++ (via static analysis, core guidelines lifetime profile), Ada/SPARK, D, OCaml and Haskell, originally developed in Cyclone, further explored in ATS.

So that "Unlike other languages" isn't quite true.

What Rust has done, was to prove it is viable to push such ideas into mainstream computing.

Re:Rust Moving Towards an IDE-Friendly Compiler with Rust An... by pcwalton on Sunday February 02, 2020 @01:54PM (#22218586)
This is incorrect. Neither Cyclone nor ATS had borrow checking. In fact the ATS author at one point dismissed borrow checking as too inflexible.

The borrow checker is actually original, though based on known techniques. Specifically, the original part is that it allows the per-use-site choice of aliasing vs. mutability instead of making the decision globally.

Re:Rust Moving Towards an IDE-Friendly Compiler with Rust An... by pjmlp on Sunday February 02, 2020 @02:16PM (#22218725)
I might be wrong on the origins, but I am certainly right that everyone else is now adopting similar algorithms.

So while it is great that Rust is making these concepts mainstream, in about 5 years time, the other languages will have their New Jersey style implementations mature and available for their communities.

Re:Rust Moving Towards an IDE-Friendly Compiler with Rust An... by pcwalton on Sunday February 02, 2020 @02:22PM (#22218781)
Borrow checking cannot be soundly added to C++, or most other languages, for systematic reasons. Soundness isn't a theoretical property here: C++ has constantly been adding things that make it safer as opposed to making it safe, and memory safety problems are still a huge issue.

See "Safe C++ Subset is Vaporware" by Robert O'Callahan: https://robert.ocallahan.org/2016/06/safe-c-subset-is-vapour...

Re:Rust Moving Towards an IDE-Friendly Compiler with Rust An... by pjmlp on Sunday February 02, 2020 @04:25PM (#22219548)
Why do you think I mentioned New Jersey style implementation?

Google and Microsoft are the ones driving that effort, in what concerns C++.

That vapourware is quite welcomed when using DriverKit, Unreal, COM/UWP, Project Treble drivers,..

Re:Rust Moving Towards an IDE-Friendly Compiler with Rust An... by onei on Sunday February 02, 2020 @05:18AM (#22216231)
It depends on the compiler. A naïve parser might reach a syntax error and error out. A more advanced parser will look for a synchronidation point that it can move to and carry on. If the compiler is in a statement, that might be a semicolon, for a function it could be a closing brace. From there it can reset to some degree and carry on parsing the file.