Discussion: Helpful and unhelpful compilers

  • (2 Pages)
  • +
  • 1
  • 2

18 Replies - 3513 Views - Last Post: 18 January 2014 - 11:02 PM

#1 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7996
  • View blog
  • Posts: 13,694
  • Joined: 19-March 11

Discussion: Helpful and unhelpful compilers

Post icon  Posted 17 January 2014 - 02:09 PM

View Postandrewsw, on 17 January 2014 - 02:51 PM, said:

Just to note that Python error messages are some of the most helpful of any language, which is why you will always be asked to post them. (They should be posted for any language though.)


andrewsw posted this comment in the python forum, and it started me thinking about which languages are helpful, and which ones are just mean and ornery. Java and python seem to me the most helpful of the ones I've used - they really go to the mat to give you a precise indication of where they think you stuffed it up.

PHP tries, I suppose, but it's just not very clever and the language is far too permissive, so it's kind of impossible for the error messages to be useful - even if they took the minor step of translating compiler-ese into something more like English.

At the far end, for me, is ml, particularly sml/nj which is the only ml flavor I've really used (aside from Scala). As far as I can tell, ml is a covertly esoteric language, with a degree of randomness built in to the compiler - sometimes it'll pass your code, sometimes not, as it chooses. But the error messages that the compiler provides are almost like it's making fun of you - most of the error message actually points to stuff inside the compiler! It's like it's saying "well, yeah, here's where you have to rewrite the compiler if you want this syntax to pass." But telling you where the syntax is incorrect is almost too much to ask, and telling you what went wrong? That's completely not on.

So what languages/compilers have the most useful or friendly error messages? Which ones make you want to stick a knife into someone?

Is This A Good Question/Topic? 3
  • +

Replies To: Discussion: Helpful and unhelpful compilers

#2 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 2069
  • View blog
  • Posts: 4,307
  • Joined: 11-December 07

Re: Discussion: Helpful and unhelpful compilers

Posted 17 January 2014 - 04:31 PM

I hear that if you run the sml compiler backwards it tells you to twist the knife in the wound.
Was This Post Helpful? 0
  • +
  • -

#3 ishkabible  Icon User is offline

  • spelling expret
  • member icon




Reputation: 1623
  • View blog
  • Posts: 5,710
  • Joined: 03-August 09

Re: Discussion: Helpful and unhelpful compilers

Posted 17 January 2014 - 06:20 PM

I think it is context dependent as well as expertise dependent.

I can't speak for ML but I can speak for Haskell. GHC's error messages assume that you have some basic understanding of the underlying algorithms and it reports to you why the algorithm failed on your code not why your code failed. This was the biggest barrier to entry for me and made the error messages seem TERRIBLE. But if you have built up an understanding they are some of the most precise and helpful error messages I have ever seen. They often even recommend the correct response to the error.

Prolog basically just has syntax errors which are easy to understand as is I think the case in any language and run time errors which again require understanding of the underlying algorithms, namely that of the search that prolog preforms. The error messages tend not to be very helpful unless you understand the underlying algorithims. I'd rate swi-prolog as far worse than GHC(i) for this reason but for someone who knows prolog very well it is just the opposite.

GCC's error messages are not very good if you ask me. Anything short of C or C with classes (that is anything with templates or macros) and GCC's error messages fall apart. Clang on the other hand is pretty nice and I'd say is as helpful as GHC. Still I'd claim that both just tell you were the underlying algorithms fail; Clang just provides a better answer that takes more context into consideration and tends to have better recomendations.

Python is a bit like prolog in that it has syntax errors and runtime errors (for the most part). The runtime errors tell you why the underlying imperative machine failed and rather helpfully give you more context (variable names, values, location in code, etc..).

the Java compiler is middle of the line for me. I however use eclipse and my code seldom fails to compile if I have removed all of the squiggly lines. The errors that the IDE reports to me have a great deal of context (exact location in the actual code I am writing), occur while I am thinking about them, and often have decent recommendations and even quick fixes to help with this. The compiler itself however I can't say I love.

C# with Visual Studio is slightly above Java with Eclipse in this respect for me but only slightly. It's the same kind of stuff frankly.

tl;dr/conclustion
I'd say that context and presentation are the most important items and that you have to have a good understanding of the underlying systems at play to properly gauge the quality of error messages.
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3806
  • View blog
  • Posts: 13,488
  • Joined: 12-December 12

Re: Discussion: Helpful and unhelpful compilers

Posted 17 January 2014 - 06:43 PM

I know I mentioned Python but, in reality, I never see any error messages :) :innocent:
(only joking!)

I'm obviously a fan of Python's error messaging.

I would like to add a sub-question though:
Which is the most verbose?

My money's on Java.

Added: I should clarify: which produces the most error-output for the same error (or sequence of errors)?

This post has been edited by andrewsw: 17 January 2014 - 06:47 PM

Was This Post Helpful? 0
  • +
  • -

#5 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2271
  • View blog
  • Posts: 9,498
  • Joined: 29-May 08

Re: Discussion: Helpful and unhelpful compilers

Posted 17 January 2014 - 06:57 PM

VB.net will often tells you how to fix the compile errors.
Was This Post Helpful? 0
  • +
  • -

#6 ishkabible  Icon User is offline

  • spelling expret
  • member icon




Reputation: 1623
  • View blog
  • Posts: 5,710
  • Joined: 03-August 09

Re: Discussion: Helpful and unhelpful compilers

Posted 17 January 2014 - 07:29 PM

Quote

Which is the most verbose?

My money's on Java.

Added: I should clarify: which produces the most error-output for the same error (or sequence of errors)?


You poor naive child. Have you ever seen a template heavy error in GCC? in C++ in general? template meta programming can produce some wicked WICKED error messages for the tiniest of issues. PAGES of them too with single types that take up a paragraph. Java has nothing on C++ at least in this case. If you ever make an error with a boost library this is also likely to happen simply because of all the TMP behind them.

For more general errors Java might have C++ beat though.
Was This Post Helpful? 1
  • +
  • -

#7 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3806
  • View blog
  • Posts: 13,488
  • Joined: 12-December 12

Re: Discussion: Helpful and unhelpful compilers

Posted 17 January 2014 - 07:39 PM

Being sad, I was looking around, and C++ did pop up a lot. I only occasionally dip into C++ so I've not encountered the full fury of its output.
Was This Post Helpful? 0
  • +
  • -

#8 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3662
  • View blog
  • Posts: 11,463
  • Joined: 05-May 12

Re: Discussion: Helpful and unhelpful compilers

Posted 17 January 2014 - 10:04 PM

I think it was a Pascal compiler for the C-64 that I used once that was just downright unhelpful. All it would spit out was an error code (some 6 digit number) and I had to go look up the error code in the manual and then try to guess what the problem was. Needless to say, I abandoned using that compiler and went back to using BASIC interpreter which would almost always just report "Syntax error."
Was This Post Helpful? 0
  • +
  • -

#9 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3662
  • View blog
  • Posts: 11,463
  • Joined: 05-May 12

Re: Discussion: Helpful and unhelpful compilers

Posted 17 January 2014 - 10:11 PM

Anybody recall which compiler it was in the 80's that would print out the offending line, and then on the next line below it, show a caret pointing to where it encountered the error, and then on the next few lines give the error code and error message?
Was This Post Helpful? 0
  • +
  • -

#10 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7996
  • View blog
  • Posts: 13,694
  • Joined: 19-March 11

Re: Discussion: Helpful and unhelpful compilers

Posted 17 January 2014 - 10:33 PM

View PostSkydiver, on 18 January 2014 - 12:04 AM, said:

I think it was a Pascal compiler for the C-64 that I used once that was just downright unhelpful. All it would spit out was an error code (some 6 digit number) and I had to go look up the error code in the manual and then try to guess what the problem was. Needless to say, I abandoned using that compiler and went back to using BASIC interpreter which would almost always just report "Syntax error."



I remember that one from my toying with BASIC. Just "Syntax error". Fortunately, in my case, I wasn't trying to do anything very complicated, so it was enough. At the time, of course, I had no idea that a compiler could do anything else - or really, that a compiler existed. I think I was about ten years old, and I just thought there were elves in there or something.
Was This Post Helpful? 0
  • +
  • -

#11 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3806
  • View blog
  • Posts: 13,488
  • Joined: 12-December 12

Re: Discussion: Helpful and unhelpful compilers

Posted 18 January 2014 - 05:47 AM

It should be possible to adjust the level of error messaging.

  • WTF is this comma doing here?
  • I have no idea what this is!
  • You have no idea what you are doing, why don't I just start Minesweeper for you?
  • Please put down the mouse, and step away from the keyboard..

Was This Post Helpful? 0
  • +
  • -

#12 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3662
  • View blog
  • Posts: 11,463
  • Joined: 05-May 12

Re: Discussion: Helpful and unhelpful compilers

Posted 18 January 2014 - 06:16 AM

Sort of tangent to the adjustable level, I recall a prank played once where somebody replaced the English string resources for the error messages with Esperanto. :)
Was This Post Helpful? 0
  • +
  • -

#13 blankwavercade  Icon User is offline

  • D.I.C Head

Reputation: 30
  • View blog
  • Posts: 117
  • Joined: 13-December 11

Re: Discussion: Helpful and unhelpful compilers

Posted 18 January 2014 - 11:27 AM

Even though it's actually an interpreter. Javascript gives by far the worst errors. If it's something other than an extra semicolon parenthesis or bracket you're going on a wild goose chase to find the error. Even worse is when you are working with minified files. The error will always be on line 1... of course using minified files is not the best idea for development, but you need to make sure the minified file will work once youre in a production environment.

On the other hand, I do like the php interpreter errors. they give broad enough errors that the line number will normally show you a stupid mistake you made.

For actual compilers I don't mind the java compiler errors.
Was This Post Helpful? 0
  • +
  • -

#14 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3806
  • View blog
  • Posts: 13,488
  • Joined: 12-December 12

Re: Discussion: Helpful and unhelpful compilers

Posted 18 January 2014 - 11:45 AM

View Postblankwavercade, on 18 January 2014 - 06:27 PM, said:

Even though it's actually an interpreter. Javascript gives by far the worst errors.

I'm slightly puzzled by this. Where are you seeing these errors?

In GC I see stuff like this:

Posted Image
but this is pretty clear to me.

The most common one I come across is Object blah has no method 'whoops' but this is more helpful than from most other languages.
Was This Post Helpful? 0
  • +
  • -

#15 blankwavercade  Icon User is offline

  • D.I.C Head

Reputation: 30
  • View blog
  • Posts: 117
  • Joined: 13-December 11

Re: Discussion: Helpful and unhelpful compilers

Posted 18 January 2014 - 03:06 PM

andrewsw in your example as you can see none of those give you line numbers. that has always irked me. A lot of javascript I deal with alot of js that isn't written by me. It may have been written a year or two ago. Not knowing why '_dumpException' is even in the code turns into an hour of digging through a ton of other files. And like i said minified js is awful. If it gives you a line number it'll say line 1. Well, yea for sure its line one i know this since its minified.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2