We constantly struggle to name things involved in name binding. Take the following two rules:

Foo(x): defines NS x
Bar(y): refers to NS y

We need names for the following things:

  • Foo(x). We currently tend to call this definition site of x.
  • x inside Foo(x). While x in general is a name, how do we call it at the position where it is defined. Is this the definition site of x? If so, what is Foo(x)?
  • Bar(y). We currently tend to call this use site of y.
  • y inside Bar(y). Again, y in general is a name, how do we call it at the position where it is used. Is this a use site of y? If so, what is Bar(y)?

Another issue is scope. We use scope as a level of visibility. Classes scope methods, methods scope variables. In other texts, a scope is a property of a name. The scope of a variable is …

Submitted by Guido Wachsmuth on 8 March 2013 at 16:21

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

On 11 March 2013 at 10:03 Gabriël Konat commented:

The term is the definition/use site and the name is the identifier (or just name) of the site. Why do we need to name these sites anyway, aren’t they just used for matching?

The scope of a variable is a hierarchical (or just ordered) list of identifiers (from definitions that scope, or from anonymous scopes) that encapsulate the visibility of the variable?


On 11 March 2013 at 10:21 Eelco Visser commented:

@Gabriel: when explaining the language we need to have names for the parts that play a role in name binding.


On 11 March 2013 at 10:36 Gabriël Konat commented:

@Visser: I know, but wouldn’t it be just a (pattern) match? To make my question more clear: where do we use the fact that Foo(x) is called a definition site?


On 11 March 2013 at 11:24 Eelco Visser commented:

@Gabriel: “where?” when explaining the concepts of name binding to new users of Spoofax.


On 11 March 2013 at 12:23 Gabriël Konat commented:

@Visser http://orly.imagefail.com/

But I already answered my own question. When explaining vertical scopes the definition site tells you in which child terms the definition is visible, so we indeed need to name it.


On 11 March 2013 at 16:50 Gabriël Konat commented:

What about these names?

Language (instance):

foo a
bar a

Meta naming:

  • Foo(x): defines NS x - binding rule
  • Foo(x) - pattern match
  • defines NS x - defines declaration
  • refers to NS y - refers to declaration

Name binding naming:

  • Foo(x) - definition site
  • Bar(y) - use site
  • x/y - identifier, name
  • foo a - definition with name/identifier “a” in namespace NS
  • bar a - reference to name/identifier “a” in namespace NS

On 12 March 2013 at 16:52 Eelco Visser commented:


// whole thing: binding rule
Class(x, y, _): // binding context pattern
defines Class x // defines clause
imports Field, Method from Class y // imports clause
scopes Field, Method // scoping clause

Class(“A”, “B”, [])
// binding context
// “A” and “B” are names (identifiers)
// “A” is binding instance
// “B” is bound instance
Class(“B”, “C”,[])
// “B” is binding instance
// “C” is free instance


On 12 March 2013 at 16:52 Eelco Visser closed this issue.

Log in to post comments