Purpose of this chapter.
We will learn about the references which is the elements that make up the expression.
Access to instance by identifier.
A reference as an expression is an access to an instance by name(identifier).
As an example, let us show Moving getter of Circle class.
open getter bool Moving
In the above code, _tt is a reference. It is accessing to the field with the identifier '_tt'.
Getter calls can also be used in the same notation as reference. The above Moving getter can be accessed just by the identifier 'Moving' if it is within the definition of the Circle class.
The following four are accessible by reference.
The reference searches an instance in the following order.
Getter and Setter.
In addition, a variable will be searched in the order from the inner scope to the outer scope.
If an instance with the same identifier exists, the reference returns an instance with a higher priority. Instances with a lower priority are hidden in this case.
There is no special notation for changing the priority difference.
If the reference returns an instance, the instance itself is not returned. The address of the memory which the instance is allocated is returned.