[cfe-dev] Dynamic / Last Resort Lookup
Argyrios Kyrtzidis
kyrtzidis at apple.com
Wed Feb 2 10:17:09 PST 2011
On Feb 1, 2011, at 6:41 AM, Axel Naumann wrote:
> Hi,
>
> We need to implement something similar to dynamic scopes:
>
> void f() {
> File::Open("serialized.data");
> object->func();
> }
>
> This will call func() on an object that was retrieved from the file
> serialized.data (all of it happens at runtime).
Cool!
> The part that blocks us
> from implementing it is Sema: all the lookup hooks require a predefined
> set of identifiers.
>
> Attached patch creates a last resort, dynamic lookup: if that hook
> (implemented by an abstract interface) has been provided, it will get
> its chance to look up a symbol but only if all the other language
> foreseen lookups have failed (i.e. with lowest precedence).
>
> We believe that the cost for clang is minimal, but for us the benefit
> would be huge. Any chance that I may check it in? Of course better ideas
> and / or suggestions for naming improvements are very welcome :-)
This can have other uses as well, e.g. resolving names even if the header is missing.
This currently will only work for id-expressions, I'm assuming you are planning to handle failed namespace lookups, typename lookups, etc. ?
-Argiris
>
> Cheers, Axel.
> <Sema_DynamicLookup.diff>_______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list