Boost logo

Boost :

Subject: Re: [boost] New libraries implementing C++11 features in C++03
From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2011-11-24 09:34:10


On Fri, Nov 25, 2011 at 1:00 AM, Christopher Jefferson
<chris_at_[hidden]> wrote:
>
> On 24 Nov 2011, at 12:48, Dean Michael Berris wrote:
>>
>> Well, then the person who doesn't put the work in to learn to use the
>> library *and* learn to read the compiler messages properly is *the*
>> problem. I seriously think this is a case of PEBKAC. No amount of
>> library engineering will solve that kind of problem IMO.
>
> Really? You think it is completely the user's fault that they get upset by regularly seeing 100k+ error messages in spirit, and choose to use another system like lex/yacc instead? I really hope not, as the size of the compile errors is the only reason I have stopped using libraries like spirit in projects I work on.
>

There are two components to this problem of error messages: the code
and the compiler.

Let's get something out of the way: if your code is correct, then you
don't see error messages. This is a given. Now the gap comes from the
solution in the user's head and the solution that becomes code --
until you get the semantics of the library you're using, you can't
even begin to understand how to use it *properly*.

If the compiler you're using was able to point you to the problem in a
manner that is not retarded or at least was meant for humans to
understand, then you *wouldn't* complain about the error messages
generated because the code you wrote is wrong. The compiler used to be
something that just translated code from one form to another and
unfortunately the human aspect to this equation got ignored.

So there are two solutions that directly address the error message problem:

1) Learn how your compiler identifies errors and adapt to these
conventions. Seriously, it's common sense: learn to use the tool and
you'll be more effective with it. This applies to any tool.

2) Use a compiler that displays better error messages until a point
when it stops complaining because your code has become acceptable.

Corollary to 2 is that you should file a bug to your compiler vendor's
bug tracking or support system to fix their horrible error messages.
Another corollary is if the compiler is open source try to actually do
something about it.

So... my point is that even with Lex/Yacc or Antlr or <insert parser
generating solution here>, you *still* have to learn to use the tool
and you *still* have to deal with the error messages one way or
another. What you can change is not only the library you use but also
the compiler you use.

> I view libraries like spirit as inspirational. They show the direction that I think C++ should take, and the power the language has. I really hope any future extensions (like concepts) are designed to help make libraries like spirit both more powerful and more user friendly. However, at the moment while they do the best that they can, it is unfortunately often not good enough in our current compilers.
>

I believe you have it backwards: the current compilers are not good
enough to handle perfectly valid C++ in a manner that's helpful to
humans who actually write/debug code that fails to compile.

I believe if the same number of people who complain about Spirit
complain to the GNU foundation, Intel, Microsoft, Apple, EDG, Comeau,
<insert compiler vendor here> and say "your error messages suck" we'd
be advancing the state of the art for *all* of C++.

Anyway, I'm getting tired of this -- I'm crawling back under the rock
where I've been hiding and let you guys figure this one out.

Cheers

-- 
Dean Michael Berris
http://goo.gl/CKCJX

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk