I am sick of error messages. I want possible solution messages. I have spent my life trying to understand error messages. Give me possible solutions/miss-understandings/how to resolve messages

Right, good and informative answer, but I think it is partially missing
Andre’s point though. With some better contextual looking the compiler
could have given a more helpful message, like "size does not take
parentheses after it." which would be much less obtuse than what it did
actually render as an error message.

This isn’t an isolated incident, the Scala compiler gives error messages
that confuse certainly beginners in the language, but also all the way
though advanced-intermediate users as well. I think the quality of error
messages does indeed slow down Scala developers and thus impedes the
Scala’s use more broadly.

It is also true that poor compiler errors certainly don’t only come from
the Scala compiler. Java’s can often be quite unhelpful and even misleading
and certainly verbose to the point of obfuscation. And before that C,
Pascal, FORTRAN, ADA, COBOL, they all put the burden on the software
engineer to figure out the true error and solution.

Scala wants to be a better language to code in, right? This is one area
where there are no limitations of outside compatibility, backwards
compatibility or such, it’s a doable thing that can make using Scala better.

2 Likes

I hope there is a web site store.scala-off-center.org where I can buy the t-shirt:

I am sick of error messages. I want solution messages.

scala-clippy was a step in this direction.

The way a linter says “you might be about to do something stupid,” a solution message says, “you did something stupid, here’s how to fix it.”

Maybe they’ll set up a scalafix web service to do all of linting, source repair, and solution messaging. The desired AI would sit behind the scenes.

Compiler error messages tend to lack the context required to be useful. That’s a symptom of 1970s-era constraints.

For example, there may be a path-dependent reason this error message is true. But it is not a solution message.

The two previous answer just goes to show. “Partially missing the point”? Bentito, you are too nice. Writing a compiler is easy. Lexing, parsing, code generation, all studied till we’re blue in the face. But useful solution messages? Zero.

Ok. Now I have got that off my chest, who is going to do something about it?

:o)

Andre

“the method “size” does not take any parameters.” !

Size is not a method. It is an Int.

[Edit] I didn’t totally believe what I wrote, so I checked. “size” does appear to be a method. My heartfelt apologies.

Andre

I agree with most of your points. In Scala it‘s even worse due to implicits where you‘re confronted with error messages that don‘t even touch the root cause, but give hint to a plan within a plan within a plan.

It might be a good idea to reread our CoC. PLEASE READ: Scala Code of Conduct

5 Likes

You’ve got me re-reading the thread vs. the CoC and wondering what you’re concerned about?

Oh, that’s a classic.

Welcome to Scala 2.12.4 (OpenJDK 64-Bit Server VM, Java 1.8.0_151).Type in
expressions for evaluation. Or try :help.scala> List(1, 2,
3).size():12: error: Int does not take parameters List(1, 2,
3).size() ^scala> List(1, 2, 3).sizeres1: Int =
3scala> 3():12: error: Int(3) does not take parameters
3() ^

The problem is that there is no size() method with an empty arguments
list, only a size method with no argument list. And that method returns
Int. So the compiler thinks you are trying to apply () to the Int
returned by size.

Yeah, the error message is confusing. Can it be better? Maybe replace the
message “does not take parameters” with “does not take parameters (maybe
you used parentheses on a method that does not have an argument list)”?

Best, Oliver

1 Like

How to write a solution message. Example.

scala> List(1,2,3).size()
:12: error: Int does not take parameters
List(1,2,3).size()

Wouldn’t life be so much easier if it were this instead.

“size” makes use of the uniform access principle. It is a method with no arguments, and the brackets are not required. In short, replace size() with size…

Jarrod,

I have just read the Code of Conduct. It looks reasonable to me.

You? Pull requests · scala/scala · GitHub is open for business. There are a number of tickets in GitHub - scala/bug: Scala 2 bug reports only. Please, no questions — proper bug reports only. labeled “usability” and/or “errors and warnings”, awaiting volunteers to make improvements.

Also, there are efforts on better errors in Dotty (aka Scala 3), see Awesome Error Messages for Dotty | The Scala Programming Language . Not applying AI to the problem, just considering usability more. A backport to Scala 2 would be welcome.

The limiting factor for doing better on this in Scala is simply resources — people to do the work.

About applying AI to the problem, sounds like something someone could get a Ph.D for, or multiple people could get multiple Ph.Ds.

We hate you too and take great personal joy in making your life as miserable as we can.

Love, Seth

:wink:

9 Likes

Seth,

Nice of you to throw down the gauntlet. I really do love all compiler
writers by the way. A great job, and a privilege in my opinion, having
worked on one myself. Thanks for the links.

Seems like Dotty people are working on usability issues relating to error
messages. I can see its already in good hands.

All the best,
Andre

Adding my two cents to this thread…

I really love term “Solution Messages” and will have to try to use that
in the future.

I have found in my career, that when I go to my superiors with
"problems" they tend to give me the stink-eye if I don’t also offer some
solutions as well.

In particular, the psychology of “Solution Messages” is way better than
"Error Messages." I hope in the future that messaging will evolve from
simply reporting symptoms, to actual diagnosis, treatment options, and
prognosis.

Cheers, Eric

Seth baby,

If the Dotty people need help, please tell them I have expressed a passionate (almost code of conduct violating) interest in turning error messages into solution messages.

Love,
Andre

1 Like

Thanks Eric,

Thanks for pointing out the term “Solution Message”. I hope it changes the way every compiler writer approaches reporting the mismatches between the BNF (or whatever) language definition and the stuff that coders like me write. That would be a new day in software engineering in my view.

1 Like

I really am sick of error messages. A couple of days ago I had a linker message (from a Visual Studio 2017 C/C++ project which drove me to the brink of madness) which was a 1000 times more maddening than the one I moaned about in this post. If I hate compiler writers, then what I have to say about linker writers breaks with the code of conduct.

Love,
Andre

1 Like

One of things I like about Maven is often when there is an error, it prints some terse diagnostics, but offers a hyper-link to a better explanation,with more context. I like this pattern because if you understand the terse diagnostics, there is not too much verbiage to deal with, but if you don’t understand, a better explanation is a click away. I have seen a few other apps/tools that do this, but Maven is the one which came to my mind first.

Indeed. In an HTML setting the terse message could be the link.

What was needed “back in the day” was feedback of the kind, “How did you fix this error?”. With today’s all-singing data mining techniques or whatever, a simple mapping from errors to solutions would be available today.

another 2 cents
Andre

I wrote this on another thread, but I think you might be interested in this view


On the balance of probabilities, I would imagine that most software engineers would prefer the identifier of a so-called “first-class” function object to be just the function’s name (like it is in Haskell), rather than “function space underscore”.

I think a functions first-class object name should be just it’s name.

Somebody, somewhere, thought that Uniform Access Principle was so cool, that it should trump the obvious, That is sad.


As one of the compiler gurus, how do you feel that, in scala, a 1st-class function object is not simply it’s name?

Love,
Andre