References

It accesses to an instance by an identifier.


Table of contents:


Identifier

Priority

Hiding

Address

Reserved variables

Constants

Identifier

An identifier is a name introduced into the program. It is introduced into the program by declaration and corresponds to the instance by definition.


int i = 5;

int j = 5;

int k = i + j + 10;


The above i, j, k are identifiers. The correspondence with the value is determined in the definition statement.

setter, getter, and constant can also be used in the same notation as references. These are different from simple identifier references, but we treate here as identical for convenience.


From the above, followings can be accessed by the identifier.


Variable

Field

Setter

Getter

Constant

Priority

Instance search by identifier is performed in the following order. This is the reference priority.


Variable

Field

Setter and Getter

Constant


In addition, variables are searched in order from the inner scope to the outer scope.

Hiding

If there are instances associated with the same identifier, the instance with the highest priority is returned.


Identifier confliction hide low priority instances. There is no special notation for changing the priority. You cannot access such instance.

Address

If the reference returns an instance, the instance itself is not returned. The address of the memory where the instance was allocated is returned.

Reserved variables

Rice have variables that will be automatically defined by the system. These are called reserved variables.

Reserved variables are:


__count

__index

__key

__value

__error


See the reference for more information and the links above for individual reserved variables.

Constants

Constants are identifiers that are automatically defined by the system. User cannot define it like a variable. Since it is a constant, it returns the same value each time it is referenced, and it is not possible to assign a value.

Preset constants are:


MAIN

DQ

NL

TAB

CR

LF

IMAX

IMIN

LMAX

LMIN

RMAX

RMIN

EPSILON

NAN

NINF

PINF


See the reference for more information and the links above for individual preset constants.

Copyright © Rice All rights reserved.