I teach a computer science course for beginner programmers using Scala.
As new students are getting the hang of abstract classes and traits, they will remember that they need to write extends, but then are immediately hit with a big red misleading error message:
trait Base:
val a : Int
val b : Int
val c : Int
class Foo extends Base
// ↑ class Foo needs to be abstract, since ...
Students then are mislead to think they need to write the abstract keyword, as that is confidently asserted as the first thing they read - and reading and interpreting the entirety of error messages is of course itself a skill that takes a while for students to acquire.
In fact, Foo does not need to be made abstract: it just needs to implement the fields that are obligated by the supertype – or it needs to be made abstract to delay that obligation to further subtypes. I don’t know why the latter scenario was assumed higher precedence for the error message, especially given that the former scenario (of a non-abstract class extending an abstract class) is far more common, and the most likely case is that the programmer has forgotten to implement the fields.
In any case, the problem is what should show first, not one of the solutions.
I propose the error message change to something like
Foo is missing implementations for Base:
val a : Int
val b : Int
val c : Int
You must define these members, or mark `Foo` as an `abstract class`
Not sure if this is something that a Pre-SIP needs to be made for. Help and feedback appreciated.