User Tools

Site Tools


data-arrays-references

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
data-arrays-references [2018/12/14 15:12]
barryfp [Primitive types]
data-arrays-references [2020/04/24 02:08] (current)
barryfp [Garbage collection]
Line 38: Line 38:
 </​code>​ </​code>​
  
-Note that string concatenation is achieved by constructing a character array into which the existing and extra character arrays are passed as parameters (see below documentation on arrays).+Note that string concatenation is achieved by constructing a character array into which the existing and extra character arrays are passed as parameters (see below documentation on arrays). Variables (and function calls) that are not of character array type can also be placed within string expressions using the same notation, and use the ''​makeString''​ [[associative-functions|associative function]] to convert from their type into a character array.
  
 Decimal types are declared using the "​dec"​ type, and can hold both positive and negative numbers: Decimal types are declared using the "​dec"​ type, and can hold both positive and negative numbers:
Line 106: Line 106:
 Arrays of the form described in this section are always passed by reference. Like data types, array references are read-only when passed between two components. If a writable copy of a constructed array is desired, the ''​clone''​ operator must be used to obtain such a copy. Arrays of the form described in this section are always passed by reference. Like data types, array references are read-only when passed between two components. If a writable copy of a constructed array is desired, the ''​clone''​ operator must be used to obtain such a copy.
  
 +Any array can have its current length queried using the attribute ''​arrayLength'':​
 +
 +<code d>
 +int q = x.arrayLength
 +</​code>​
 ====== Cloning data and arrays ====== ====== Cloning data and arrays ======
  
Line 170: Line 175:
 Objects, data types and regular arrays are all '​constructed'​ at runtime and are accessed by reference. These items are automatically garbage collected when their reference count reaches zero or when their creating component is destroyed. ​ Objects, data types and regular arrays are all '​constructed'​ at runtime and are accessed by reference. These items are automatically garbage collected when their reference count reaches zero or when their creating component is destroyed. ​
  
-Note that Dana's garbage collector is a simple reference counter and **does not check** for circular references; it is therefore ​the programmer'​s responsibility to ensure that there are no further references to a constructed item for it to be cleaned up. +For more information on Dana's garbage collector, which is a little different to other languages, please see the [[memory-management|memory management]] topic.
 ====== Serialisation ====== ====== Serialisation ======
  
data-arrays-references.1544818335.txt.gz · Last modified: 2018/12/14 15:12 by barryfp