Bug tracker best practices

Regan Heath regan at netmail.co.nz
Tue Jun 26 01:19:49 PDT 2007


Oskar Linde Wrote:
> Regan Heath skrev:
> 
> > Here is my bug test case:
> > 
> > [bug001.d]
> > import std.random;
> > void main() { index++; }
> > 
> > Error reported on compile is:
> > "C:\D\src\tmp\bug001.d: module bug001 std.random.index is private"
> 
> [snip]
> 
> > 2 - std.random.index is private so it's not likely I am actually trying to modify it.  I think I should get the error:
> > "C:\D\src\tmp\bug001.d(2): Error: undefined identifier index"
> > instead.
> 
> Compiler error messages are a tricky business. What if you were actually 
> trying to refer to a private identifier in another module. Wouldn't it 
> be helpful to be told that a protection attribute prevented the access 
> instead of an unhelpful "undefined identifier"? 

There is that... at the very least it needs a line number in the error as it can be difficult to find otherwise.

> I believe the best 
> (only?) approach to compiler diagnostic messages is for the compiler to 
> tell, as descriptively as possible and from its own perspective, why 
> something failed. Not trying to second-guess the users intentions.
> 
> More serious is that the following altered program compiles without error:
> 
> import std.random;
> void main() { std.random.index++; }

That's not good.

Regan



More information about the Digitalmars-d mailing list