Qualified names are a constant issue in NaBL. Here is why.

Java has a sort AmbName with two constructors AmbName/1 and AmbName/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 as qualifies ... 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

On 8 March 2013 at 18:45 Guido Wachsmuth tagged rfc

On 7 May 2013 at 23:01 Guido Wachsmuth commented:

For now, we generate rules which determine the naming parts of terms.


On 7 May 2013 at 23:01 Guido Wachsmuth closed this issue.

Log in to post comments