View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000617||LDMud 3.3||Compilation, Installation||public||2009-03-31 05:53||2009-05-05 15:50|
|Summary||0000617: relax syntax and warn about obvious coding errors?|
|Description||Since most of the MUD coders are not necessary experienced programmers, why not modify the compiler to catch some obvious mistakes. These could be issued as warnings or even compile-errors.|
I just stumbled over:
There is no useful case for this statement, even if it is syntactically correct.
There surely are a lot of other items like this one.
What is the general opinion here? Should we adhere to syntactic rules or enhance useability?
|Tags||No tags attached.|
Just a few hours ago I stumbled upon the same.
But in a if-elseif-else chain it's only useless if it is the last statement that is empty. Also a foreach loop with an empty statement is useless.
||Mhmm, isn't that actually making the syntax stricter? Ok, maybe not the syntax itself but I mean, we would make syntactically correct code to raise errors/warning upon compilation. That is not necessarily a bad thing, I appreciate if errors can be caught at compile-time, but I think the title of this issue is confusing in this context.|
Yes, the title is weird. I was thinking around the lines of "relaxing the necessity to adhere to syntactic correcteness" ... well, anyhow ...
Having given it some thought I would suggest to issue warnings for these cases and if #pragma pedantic is set - errors.
Also pragmas #warn/no_warn_common_mistakes to switch them on/off.
If the user can switch them off/on on a per-file basis, we can also think about issueing warnings for common mistake cases that could even have real uses, like:
and *maybe* while(...);
Hmm, I'd be more likely to have an empty body in a for loop than in a while loop.
Anyway, as long as these warnings can be switched off, I'm happy.
We can also think about adding a keyword or pseudo efun for intentionally empty statements. I.e. for(;;) ; would give a warning while for(;;) nop; (or whatever) would not.
||There is a difference between statements that are guaranteed to be useless ('if(expr);' is always the same as 'expr;' as long as no 'else' is following) and statements that might be a mistake. I wouldn't lump them together.|
|2009-03-31 05:53||_xtian_||New Issue|
|2009-03-31 06:01||Gnomi||Note Added: 0001009|
|2009-04-08 04:36||zesstra||Note Added: 0001012|
|2009-04-15 22:51||_xtian_||Note Added: 0001041|
|2009-04-16 11:39||fufu||Note Added: 0001043|
|2009-04-16 12:00||Gnomi||Note Added: 0001044|
|2009-05-05 15:50||zesstra||Project||LDMud => LDMud 3.3|