tooling quality and some random rant

Vladimir Panteleev vladimir at thecybershadow.net
Mon Feb 14 07:01:09 PST 2011


On Sun, 13 Feb 2011 21:12:02 +0200, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> Vladimir Panteleev wrote:
>> On Sun, 13 Feb 2011 20:26:50 +0200, Walter Bright  
>> <newshound2 at digitalmars.com> wrote:
>>
>>> golgeliyele wrote:
>>>> I don't think C++ and gcc set a good bar here.
>>>
>>> Short of writing our own linker, we're a bit stuck with what ld does.
>>  That's not true. The compiler has knowledge of what symbols will be  
>> passed to the linker, and can display its own, much nicer error  
>> messages. I've mentioned this in our previous discussion on this topic.
>
> Not without reading the .o files passed to the linker, and the  
> libraries, and figuring out what would be pulled in from those  
> libraries. In essence, the compiler would have to become a linker.

You are trying to solve a much bigger problem, which indeed sounds like a  
lot of effort for something so insignificant. What I'm talking about is  
much simpler.

Let's take two cases which will cover over 99% of such cases when using  
DMD.

In both cases, the user only passes .d files to DMD, no extra .obj or .lib  
files, as is the case most of the time:

1) The user forgot to declare main().

If you don't pass the -c or -lib switches to the compiler, it's reasonable  
to expect that the user wants to compile and link an executable. But DMD  
knows that there is no D main() symbol in the files passed to it! So it  
can print a nice error message without having to run the linker to print  
its ugly one.

2) The user didn't pass all of his program's modules to the compiler.

By far the most common cause, we've discussed this one before. It only  
requires knowing if a certain module is part of the standard library or  
not. Even simply doing it for modules present in the current directory  
would help. I know it's not consistent, but neither is import hinting for  
certain standard library functions, and both are great ideas.

-- 
Best regards,
  Vladimir                            mailto:vladimir at thecybershadow.net


More information about the Digitalmars-d mailing list