Anvil | Smiths Smiths | Register Register | Login Login |
Search:
Show links Show tools Show tree | Previous document Next document | njet.org > Anvil > Documentation > Language reference > Expressions > Primaries > Identifiers

Identifier

An identifier is a name (or compound name) pointing to an entity. It is an error to have a name that does not point to an entity. See scoping for a discussion about entities.

  • Keyword ``var´´ is an explicit variable declaration modifier. It is a signal that a variable with a given name should be created with a local scope (function or scope), instead of referring to some previously declared entity outside the local scope.
  • Keyword ``module´´ escapes reference to the scope of an enclosing module. The name of the module can also be used.
  • Keyword ``static´´ returns the reference to system namespace "static", if that is declared in the servers configuration.
  • Keyword ``this´´ returns an instance of the current enclosing class.
  • Keyword ``this´´ may also appear inside identifiers as it is used when referring to an instance of an enclosing class with ``classname.this´´.
  • Keyword ``super´´ is used to invoke super class methods and constructor, and when accessing a super class member variable (although they cannot become hidden).
  • Keyword ``class´´ (unless last) returns the type handle for the current enclosing class.
  • If keyword ``class´´ is used as the last element in an identifier, it returns the anvil.runtime.Type of the referenced entity.
  • Keyword ``class´´ yields the type of left side expression as anvil.runtime.Type.
  • Keyword ``sizeof´´ yields the logical size of left side expresion.
  • Keyword ``copyof´´ yields deep copy of left side expression.
  • Keyword ``cloneof´´ yields shallow copy of left side expression.
  identifier :=  
    [ "var" ] 
    [ symbol | "module" | "class" | "static" | "this" | "super" ] 
    ( "." ( symbol | "this" ) ) * 
    [ "." ( "class"  
          | "sizeof" 
          | "copyof" 
          | "cloneof" ) 
    ] 

Values returned by entities
Entity Returned value
module anvil.runtime.Scope
class anvil.runtime.Type
interface anvil.runtime.Type
namespace anvil.runtime.Scope
system namespace anvil.runtime.Namespace
import anvil.runtime.Scope
library anvil.runtime.Scope
function anvil.runtime.Function (*)
method anvil.runtime.Function (*)
constructor anvil.runtime.Function
constant variable Contained value
module variable Contained value
member variable Contained value
parameter Contained value
local variable Contained value

(*) If callable is modified by parameter list, it is a [NOT FOUND: accessors/calls]call. Other entity references can also be modified with a parameter list, but in that case the construct is a call emulation.

See also  | Primaries  | Calls  | Refs  | Assignments  | Catch  | Tags  | <module>  | <import>  | <var>  | <const>  | <function>  | <while>  | <break>  | <continue>  | <foreach>  | <for>  | New operator  | Defined expression  | Delete expression  | Grammar  | Assignable primaries  | <namespace>  | <class>  | <invoke>
Contributes notes:
Add a note
What's new | Anvil