Open main menu

CDOT Wiki β

Changes

GPU621/Chapel

578 bytes added, 23:17, 29 November 2022
Procedure
*Similar to the inout intent, the ref intent causes the value of the actual to change depending on the function. However, while the inout copies the argument in upon entering the function and copies the new value out upon exiting, using a ref intent causes any updates to the formal to immediately affect the call site.
*The out intent causes the actual argument to be ignored when the procedure starts. The actual is assigned the value of the corresponding formal when the routine exits.
=== CLass Class ===
Like C++, the prime allows the user to create a new type that can contain variables and constants, called fields, as well as functions and iterators called methods. A new class type is declared using the class keyword.
class C {
}
}
=== Record ===
A record type can be declared using the record keyword. A record is a type that can contain variables and constants, called fields, as well as functions and iterators called methods. Records have many similarities to classes, but there are several important differences:
*Records do not support inheritance and virtual dispatch
*Record variables refer to distinct memory
*copy-initialization and assignment can be implemented for records
record Color {
var red: uint(8);
var green: uint(8);
var blue: uint(8);
}
 
=== Special MEthods ===
= Reference =
73
edits