www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Feature request : Make Error Messages More Helpful

reply Davidl <Davidl 126.com> writes:
I've considered one solution to make error messages more helpful, add one  
attribute to DObject
bool thissymtriggeredanerror;
and when error triggered make this DObject 's attribut  
thissymtriggeredanerror to be true
and each check of emiting error messages would first try to figure out  
whether all expressions
statements has thissymtriggeredanerror set to be false, then real semantic  
parse is executed.

this would avoid the great bunch error messages coz by only 1 simple  
mistake like user forget to
declare a variable, and user mis declared the prototype of a func. this  
could help user to read
the error message more efficiently.

though this feature request should be in rather low priority ;)
Apr 03 2007
parent reply Dan <murpsoft hotmail.com> writes:
Davidl Wrote:

 I've considered one solution to make error messages more helpful, add one  
 attribute to DObject
 bool thissymtriggeredanerror;
 this would avoid the great bunch error messages coz by only 1 simple  
 mistake like user forget to
 declare a variable, and user mis declared the prototype of a func. this  
 could help user to read
 the error message more efficiently.
 
 though this feature request should be in rather low priority ;)

Anything like that should be done on the AST, not on the runtime Objects... that said... I see nothing else wrong with it. : p
Apr 03 2007
parent reply =?ISO-8859-1?Q?Julio_C=E9sar_Carrascal?= <jcesar phreaker.net> writes:
Dan wrote:
 Davidl Wrote:
 
 I've considered one solution to make error messages more helpful, add one  
 attribute to DObject

Anything like that should be done on the AST, not on the runtime Objects... that said... I see nothing else wrong with it. : p

Error messages should be at least as helpful as to allow a solution to FizzBuzz: http://www.adampetersen.se/articles/fizzbuzz.htm ;)
Apr 14 2007
parent reply Don Clugston <dac nospam.com.au> writes:
Julio CÚsar Carrascal wrote:
 Dan wrote:
 Davidl Wrote:

 I've considered one solution to make error messages more helpful, add 
 one  attribute to DObject

Anything like that should be done on the AST, not on the runtime Objects... that said... I see nothing else wrong with it. : p

Error messages should be at least as helpful as to allow a solution to FizzBuzz: http://www.adampetersen.se/articles/fizzbuzz.htm ;)

template Fizz(int x) { static if (x==0) const char [] Fizz = ""; else const char [] Fizz = Fizz!(x-1) ~ " " ~ ((x%3==0 && x%5==0)? "FizzBuzz" : (x%3==0) ? "Buzz" : (x%5==0) ?"Fizz" : x.stringof); } int a = Fizz!(100);
Apr 14 2007
parent =?ISO-8859-1?Q?Julio_C=E9sar_Carrascal?= <jcesar phreaker.net> writes:
Don Clugston wrote:
 template Fizz(int x)
 {
     static if (x==0) const char [] Fizz = "";
     else const char [] Fizz = Fizz!(x-1) ~ " " ~
     ((x%3==0 && x%5==0)? "FizzBuzz" : (x%3==0) ? "Buzz" : (x%5==0) 
 ?"Fizz" : x.stringof);
 }
 
 int a = Fizz!(100);

Very nice. I should have tried before posting. Je je.
Apr 14 2007