Handling Qualified Names
Qualified names are a constant issue in NaBL. Here is why.
Java has a sort
AmbName
with two constructorsAmbName/1
andAmbName/2
. A typical name would look like this:AmbName(AmbName(AmbName(ID("package")), ID("class")), ID("field"))
An easy way to specify resolution would be:
AmbName(ID(n)): refers to Variable n otherwise refers to Field n otherwise refers to Class n otherwise refers to Package n AmbName(q, ID(n)): refers to Package n in Package q otherwise refers to Class n in Package q otherwise ...
The issue here is, that
q
is not really a name, but a term with a name inside. The heuristic is to find the closest name in it. However, this is not always the case:Foo(x, y): refers to Foo x refers to Bar y
Here, we do not have a closest name. We solved this currently by duplicating
refers
asqualifies ... in
. However, this is not desirable.Another issue is duplication. In Java, you have rules how a method name resolves, and later more rules for how to find a conformant one. Currently, we model this like this:
Method(m, a*): refers to best Method m of conformant ParameterTypes pt* where a* has type pt* Method(e, _, Id(m), a*): refers to best Method m of conformant ParameterTypes pt* in Type t where a* has type pt* where e has type t MethodName(Id(n)): identifies Method n in current scope otherwise identifies imported Method n MethodName(q, Id(n)): qualifies Method n in Type q otherwise qualifies Method n in Type t where q has type t
If we want to give up this separation, this leads to duplications of the first rule.
Submitted by Guido Wachsmuth on 8 March 2013 at 18:06
Issue Log
For now, we generate rules which determine the naming parts of terms.
Log in to post comments