[Issue 340] [Tracker] Forward reference bugs and other order-of-declaration issues
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Nov 13 12:03:15 PST 2007
http://d.puremagic.com/issues/show_bug.cgi?id=340
------- Comment #3 from jarrett.billingsley at gmail.com 2007-11-13 14:03 -------
(In reply to comment #0)
> A design principle of D is that the order of declarations at module level or
> class level is irrelevant.
>
> Here's just one statement to this effect:
>
> [Features to Drop]
> "Forward declarations. C compilers semantically only know about what has
> lexically preceded the current state. C++ extends this a little, in that class
> members can rely on forward referenced class members. D takes this to its
> logical conclusion, forward declarations are no longer necessary at the module
> level. Functions can be defined in a natural order rather than the typical
> inside-out order commonly used in C programs to avoid writing forward
> declarations."
>
> (There ought to be more, but I can't seem to find them at the moment.)
>
> As such, there should be no errors reported by the compiler caused by trying to
> use a symbol before it's defined. Of course it makes sense that a variable
> can't be used within a function before it's declared, with functions being
> sequential in nature. But otherwise, the compiler should accept forward
> references without any trouble.
>
> There are two documented instances for which forward references fail, namely
> nested functions within a function and autotype declarations. Otherwise, any
> failures of a D compiler to get over the fact that the use of a symbol
> lexically precedes its declaration in a module, class, etc. are bugs.
>
> While we're at it, forward reference bugs are part of a more general class of
> issues whereby the compiler treats code differently depending on the lexical
> order of declarations. These can include not only valid code failing to
> compile, but also instances where the code compiles either way but behaves
> differently.
>
> This is a tracker for bugs of this nature - bugs whereby code containing
> forward references fails to compile correctly, and anywhere else where the
> order of declarations influences compiler behaviour in a way that should not be
> happening.
>
> Getting the phrase "forward referenced" out of the compiler's repertoire of
> error messages (by actually fixing the bugs, obviously, not by rewording the
> error) would certainly be a step forward.
>
RRRRGH
RRRRRRRRRRRRRRRRRRRRRRRR
FIX FORWARD REFERENCE ERRORS NOW
..
I've just run into ANOTHER forward reference error that is absolutely
un-work-around-able. These are the only bugs in the DMDFE that really cause an
issue for me. It's REALLY pissing me off.
--
More information about the Digitalmars-d-bugs
mailing list