Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A: A definition is something that can be referred to by name. This includes packages, namespaces, classs, interfaces, functions (including getters and setters), parameters, variables, constants, events, styles, and effects.

Q: What is a scope?

A: Think of a scope as either A scope corresponding to a curly-brace block in a file , (or the an entire file) and contains the definitions that occur there. Each definition lives in a particular scope, and scopes can live inside other scopes. In addition, each project has a scope which contains definitions which are visible outside the file in which they occur.

...

the identifier s that is the first argument of the g call resolves to the definition of the parameter named s while the identifier i that is the second argument of the call resolves to the definition of the local variable named i. By resolving an identifier to a definition, the compiler can determine, among other things, the type of the identifier: for example, s is a String, and it can then check whether the definition of the g function accepts a String as its first argument.

Name resolution typically involves searching up the scope chain for a definition with the some name.

Q: What is a code generator?

...