|
||||||||||||
|
|
||||||||||||
ClassesEverything inside Anvil is an object -- even integers and floats. An object is a binding between the class and instance. When an object has been created, or instantiated, it has been given an identity: it remains in a fixed position in memory. Using the addressOf() function, the address of an object can be retrieved.
The class of an object is retrieved using Some of the objects are said to be immutable, meaning that their contents cannot be changed after they are created. Immutable objects include integers, floats, strings, patterns, and tuples. Most of the objects are said to be mutable, meaning that their contents can be changed during execution. User-defined classes are a good example, although they can also be coded in a manner that would make them immutable. Once an object has been created, it is never explictily destroyed. However, when the Java virtual machine decides that the object is no longer reachable (by means of static, or stack references), it becomes eligible for garbage collection: the object is destroyed, and its associated memory address is released. Every class belongs to a module. A module is a collection of classes and functions. There is only one instance of each module. Classes and modules come in three different flavors. All of them are accessed a little bit differently, but they behave similarly.
See also
| Language reference
| Class customization
|
||||||||||||
|
|
||||||||||||