[dmd-internals] Fixing forward ref bugs for good

David Nadlinger code at klickverbot.at
Wed Sep 14 02:14:45 PDT 2011


On 9/14/11 9:47 AM, Walter Bright wrote:
> On 9/14/2011 12:06 AM, Rainer Schuetze wrote:
>> This works out better than the current dmd implementation, e.g. when
>> forward referencing symbols in a mixin. There are still situations
>> that depend on interpretation order, but that is to be expected when
>> "static if" is used.
>>
>> It might be good to define the lookup mechanism, so it would be
>> possible to determine whether a failing forward reference is beyond
>> expected behaviour rather than a compiler-implementation detail.
>>
>
> This is good stuff.

I'd love to see a clear definition of the behavior of »static if« and 
friends, since trying to find out what happens e.g. when forward 
referencing something from a mixin or referencing the mixed-in scope 
from a mixin (e.g. via typeof(this), when the template is mixed into a 
class/struct) is more or less pure guesswork right now.

Also, even if this certainly isn't the best way to advertise for D, it 
would be great if the definition order-related peculiarities could be 
clearly mentioned in the docs (e.g. for static if), since these issues 
caused me a big headache when I first stumbled across them (and they 
still occasionally do).

David


More information about the dmd-internals mailing list