Bug tracker best practices

Oskar Linde oskar.lindeREM at OVEgmail.com
Mon Jun 25 07:37:25 PDT 2007


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"? 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++; }

/Oskar



More information about the Digitalmars-d mailing list