D should disallow forward references

grauzone none at example.net
Wed Aug 26 10:21:40 PDT 2009


Robert Fraser wrote:
> grauzone wrote:
>> I agree; but: I'm just saying that disallowing it would actually be 
>> better for the programmer, than leaving it half-broken.
> 
> I strongly disagree. Dealing with header files, forward feference 
> issues, etc. is the #1 reason I don't use C/C++ (really, I could live 
> with the rest). D's forward reference errors are basically nonexistent 
> within a single module, with the exception of templates, so it's not 
> "half-broken" in any way.

You can get various problems with structs and enums even within the same 
module. In the past, I also encountered issues like compiler crashes, 
hangs, and invalid code generation. Whatever dmd does to resolve forward 
references, it's not very robust. That's why I think the language 
specification should be a bit trimmed a bit to make the compiler robust.

Or do you think it's acceptable to demand from programmers to rearrange 
*valid* code around, until the compiler accepts it?



More information about the Digitalmars-d mailing list