On 9/14/2011 12:06 AM, Rainer Schuetze wrote:
On 14.09.2011 00:04, Walter Bright wrote:
Don, just so you know, I've been thinking for a while about transitioning
from doing the semantic pass in order to doing it completely "on demand". In
other words, try to semantic a declaration. In the process, any declarations
it depends on are semantic'd if not already, recursively.
I've been trying something similar for Visual D in its yet to integrate
semantic analysis for intellisense. Still, static if and mixins get in the way
of complete "on demand" handling. When a symbol is searched in a scope (e.g. a
module, class, struct), some preparational work has to be done before the
member list can be searched:
1. all "simple" non-scoping members are expanded (version/debug conditions,
attributed declaration blocks). the branch inserted to the scopes' member list
is also searched for "simple" non-scoping members (this step could also be
done non-lazily, but doing it lazily slightly changes the interaction of
version statements and conditionals with "static if" conditionals - good or
bad, I don't know)
2. "complex" non-scoping members are expanded in lexical order (static if,
mixins). When inserting the expanded branch into the scopes member list, the
expansion restarts at 1.
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.
_______________________________________________
dmd-internals mailing list
dmd-internals@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-internals