D should disallow forward references

grauzone none at example.net
Tue Aug 25 07:34:24 PDT 2009


Right now, D seems to *intend* to allow arbitrary forward references of 
types and functions. But the reality is different. dmd accepts some 
forward references, but chokes up on others. For example, forward 
references to classes are normally no problem, while enums can't be 
forward referenced at all. (Which is funny; you'd think that enums are 
simpler than classes.) Structs often require creative rearrangement of 
source code to make them work.

For a general overview of forward reference bugs, just search Bugzilla:
http://d.puremagic.com/issues/buglist.cgi?quicksearch=forward+reference

I think you can say, that forward referencing is quite incomplete and 
buggy in dmd. Even worse, it bothers the programmer in everyday 
programming. The programmer gets the feeling, he's doing more work 
working around compiler bugs, than on his program. There's nothing worse 
than a core language feature, that doesn't work as advertised.

Unfortunately, Walter seems to consider these bugs as minor issues, and 
apparently, he thinks that amount of work fixing them doesn't pay off. 
Although he often fixes some related bugs here and there, the problem 
remains.

Conclusion: other than trying to keep a buggy feature, that isn't going 
to be fixed, remove it from the language.

Why? Because it reduces confusion and frustration for the programmer, 
because the compiler actually *works*. A programmer won't get confused 
over buggy language features anymore; the confusion gets replaced by 
clear and straight forward rules. It also solves all problems related to 
circular module dependencies.



More information about the Digitalmars-d mailing list