Qore Programming Language Reference Manual
1.12.0
|
Starting in Qore 0.8.0, it is possible to restrict variables, class members, and function and method parameters to certain data types. This allows programmers to write safer code, as many more errors can be caught at parse time that would otherwise be caught at run time. Furthermore, providing type information to the parser allows Qore to implement performance optimizations by performing lookups and resolutions once at parse time rather than every time a variable or class member is accessed at run time.
When types are declared in a parameter list, functions and methods can be overloaded as well.
The types in the following table can be used as well as any class name or '*classname'
(i.e. an asterix followed by the class name), meaning either the given class or NOTHING (no value).
Data Type Declaration Names
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
int | Integer | Integer | Restricts values Integer values |
float | Float or Integer | Float | Restricts values to Float values |
number | Number, Float, or Integer | Number | Restricts values to Number values |
bool | Boolean | Boolean | Restricts values to Boolean values |
string | String | String | Restricts values to String values |
date | Date | Date | Restricts values to Date values; values may be either absolute or relative |
binary | Binary | Binary | Restricts values to Binary values |
hash | Hash | Hash | Restricts values to Hash values without any key type information |
hash<...> | Hash | Hash | Restricts values to values of the referenced type-safe hash |
hash<string, ...> | Hash | Hash | Restricts key values to the declared type |
list | List | List | Restricts values to List values |
list<...> | List | List | Restricts list values to the declared type |
object | Object | Object | Restricts values to Object values |
object<...> | Object | Object | Restricts values to objects of the specific class |
<classname> | Object | Object | Restricts values to objects of the specific class given; either the class name can be given (ex: Mutex or a qualified path to the class: Qore::Thread::Mutex) |
null | NULL | NULL | Restricts values to Qore's NULL type; this type has few (if any) practical applications and has been included for completeness' sake |
nothing | NOTHING | NOTHING | Restricts values to Qore's NOTHING type; this type is mostly useful for declaring that a function or method returns no value |
timeout | Integer, Date | Integer | Accepts Integer, Date and converts dates to an integer value representing milliseconds and returns the integer; incoming integers are assumed to represent milliseconds |
base64binary | String, NULL | Float | Accepts String, NULL and converts a base-64 encoded string to a binary value and returns the new value |
hexbinary | String, NULL | Float | Accepts String, NULL and converts a string of hex digits to a binary value and returns the new value |
softbinary | String, NULL | Float | Accepts String, NULL and converts non-binary values to a binary value and returns the new value |
softint | Integer, Float, Number, Boolean, String, NULL | Integer | Accepts Integer, Float, Boolean, String, NULL and converts non-integer values to an integer and returns the integer |
softfloat | Integer, Float, Number, Boolean, String, NULL | Float | Accepts Integer, Float, Boolean, String, NULL and converts non-float values to a float and returns the new value |
softnumber | Integer, Float, Number, Boolean, String, NULL | Float | Accepts Integer, Float, Boolean, String, NULL and converts non-number values to a float and returns the new value |
softbool | Integer, Float, Number, Boolean, String, NULL | Boolean | Accepts Integer, Float, Boolean, String, NULL and converts non-boolean values to a boolean and returns the new value |
softstring | Integer, Float, Number, Boolean, String, NULL | String | Accepts Integer, Float, Boolean, String, NULL and converts non-string values to a string and returns the new value |
softdate | Integer, Float, Number, Boolean, String, Date, NULL | Date | Accepts Integer, Float, Boolean, String, Date, and NULL and converts non-date values to a date and returns the new value |
softlist | all types | List | Accepts all types; NOTHING is returned as an empty list; a list is returned unchanged, and any other type is returned as the first element of a new list |
softlist<...> | all types | List | Accepts all data types; NOTHING is returned as an empty list; a list is returned with its elements processed by the subtype declaration, and any other type is returned as the first element of a new list, also processed by the subtype declaration |
data | String or Binary | same as received | Restricts input to String and Binary and returns the same type |
code | Closures, Call References | same as received | Restricts values to closures and call references |
reference | References | the type the reference points to | Restricts values to references to lvalues |
reference<...> | References | the type given as an argument | Restricts values to references to lvalues compatible with the given type |
*int | Integer, NULL, or NOTHING | Integer or NOTHING | Restricts values to Qore's Integer or NOTHING types; if NULL is passed then NOTHING is returned |
*float | Float, NULL, or NOTHING | Float or NOTHING | Restricts values to Qore's Float or NOTHING types; if NULL is passed then NOTHING is returned |
*number | Number, NULL, or NOTHING | Number or Number | Restricts values to Qore's Number or NOTHING types; if NULL is passed then NOTHING is returned |
*bool | Boolean, NULL, or NOTHING | Boolean or NOTHING | Restricts values to Qore's Boolean or NOTHING types; if NULL is passed then NOTHING is returned |
*string | String, NULL, or NOTHING | String or NOTHING | Restricts values to Qore's String or NOTHING types; if NULL is passed then NOTHING is returned |
*date | Date, NULL, or NOTHING | Date or NOTHING | Restricts values to Qore's Date or NOTHING type; values may be either absolute or relative date/time values; if NULL is passed then NOTHING is returned |
*binary | Binary, NULL, or NOTHING | Binary or NOTHING | Restricts values to Qore's Binary or NOTHING types; if NULL is passed then NOTHING is returned |
*hash | Hash, NULL, or NOTHING | Hash or NOTHING | Restricts values to Qore's Hash or NOTHING types; if NULL is passed then NOTHING is returned |
*hash<...> | Hash, NULL, or NOTHING | Hash or NOTHING | Restricts values to values of the referenced type-safe hash or NOTHING types; if NULL is passed then NOTHING is returned |
*hash<string, ...> | Hash, NULL, or NOTHING | Hash or NOTHING | Restricts key values to the declared complex hash or NOTHING types; if NULL is passed then NOTHING is returned |
*list | List, NULL, or NOTHING | List or NOTHING | Accepts either a List or NOTHING; if NULL is passed then NOTHING is returned |
*list<...> | List, NULL, or NOTHING | List or NOTHING | Restricts list values to the declared complex list type or NOTHING; if NULL is passed then NOTHING is returned |
*object | Object, NULL, or NOTHING | Object or NOTHING | Accepts either an Object or NOTHING; if NULL is passed then NOTHING is returned |
*<classname> | Object of the given class, NULL, or NOTHING | Object of the given class or NOTHING | Restricts values to objects of the specific class given or NOTHING; either the class name can be given (ex: *Mutex or a qualified path to the class: *Qore::Thread::Mutex); if NULL is passed then NOTHING is returned |
*object<...> | Object of the given class, NULL, or NOTHING | Object of the given class or NOTHING | Restricts values to objects of the specific class given or NOTHING; if NULL is passed then NOTHING is returned |
*null | NULL or NOTHING | NULL or NOTHING | Restricts input to NULL or NOTHING and returns the same type |
*data | String, Binary, NULL, or NOTHING | String, Binary, or NOTHING | Restricts input to String, Binary, or NOTHING and returns the same type; if NULL is passed then NOTHING is returned |
*code | Closures, Call References, NULL, or NOTHING | Closures, Call References, or NOTHING | Restricts values to closures, call references and NOTHING; if NULL is passed then NOTHING is returned |
*timeout | Integer, Date, NULL, or NOTHING | Integer or NOTHING | Accepts Integer, Date and converts dates to an integer value representing milliseconds and returns the integer; incoming integers are assumed to represent milliseconds. If no value or NULL is passed, then NOTHING is returned |
*reference | References, NULL, or NOTHING | the type the reference points to and NOTHING | Restricts values to references to lvalues and NOTHING; if NULL is passed then NOTHING is returned |
*reference<...> | References, NULL, or NOTHING | the type given as an argument and NOTHING | Restricts values to references to lvalues compatible with the given type and NOTHING; if NULL is passed then NOTHING is returned |
*softint | Integer, Float, Number, Boolean, String, NULL or NOTHING | Integer or NOTHING | Accepts Integer, Float, Number, Boolean, String, NULL and converts non-integer values to an integer and returns the integer. If no value or NULL is passed, then NOTHING is returned |
*softfloat | Integer, Float, Number, Boolean, String, NULL or NOTHING | Float or NOTHING | Accepts Integer, Float, Number, Boolean, String, NULL and converts non-float values to a float and returns the new value. If no value or NULL is passed, then NOTHING is returned |
*softnumber | Integer, Float, Number, Boolean, String, NULL or NOTHING | Number or NOTHING | Accepts Integer, Float, Number, Boolean, String, NULL and converts non-number values to a number and returns the new value. If no value or NULL is passed, then NOTHING is returned |
*softbool | Integer, Float, Number, Boolean, String, NULL or NOTHING | Boolean or NOTHING | Accepts Integer, Float, Number, Boolean, String, NULL and converts non-boolean values to a boolean and returns the new value. If no value or NULL is passed, then NOTHING is returned |
*softstring | Integer, Float, Number, Boolean, String, NULL or NOTHING | String or NOTHING | Accepts Integer, Float, Number, Boolean, String, NULL and converts non-string values to a string and returns the new value. If no value or NULL is passed, then NOTHING is returned |
*softdate | Integer, Float, Number, Boolean, String, Date, NULL or NOTHING | Date or NOTHING | Accepts Integer, Float, Number, Boolean, String, Date, and NULL and converts non-date values to a date and returns the new value. If no value or NULL is passed, then NOTHING is returned |
*softlist | all types | List or NOTHING | Accepts all types; NOTHING and list values are returned as the same value; NULL is returned as NOTHING, any other type is returned as the first element of a new list |
*softlist<...> | all types | List or NOTHING | Accepts all data types; NOTHING and NULL are returned as NOTHING; a list is returned with its elements processed by the declared subtype, and any other type is returned as the first element of a new list with its element processed by the declared subtype |
any | any | same as received | Provides no restrictions on the type of value it receives and returns the same value, however complex type information is stripped on assignment for backwards compatibility; note that the any type restriction is the same as using no type restriction; to assign any type without stripping complex types, use the auto type restriction instead |
auto | all data types | all data types | Provides no restrictions on the type of value it receives and returns the same value; does not strip complex types on assignment like any |
int Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
int | Integer | Integer | Restricts values to Qore's Integer type |
float Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
float | Float or Integer | Float | Restricts values to Qore's Float type |
number Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
number | Number, Float, or Integer | Number | Restricts values to Qore's Number type |
bool Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
bool | Boolean | Boolean | Restricts values to Qore's Boolean type |
string Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
string | String | String | Restricts values to Qore's String type |
date Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
date | Date | Date | Restricts values to Qore's Date type; date/time values can be either absolute or relative |
binary Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
binary | Binary | Binary | Restricts values to Qore's Binary type |
hash Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
hash | Hash (all) | Hash (untyped) | Restricts values to Qore's Hash type; if a typed hash is received, type information is removed for the lvalue assignment |
hashdecl Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
hash | hash<hashdecl> | hash<hashdecl>> | Restricts values to hashes created from the given hashdecl |
The hash type takes a single type-safe hash name (or namespace- prefixed path) in angle brackets after "hash"
which results in a type declaration restricted to the declared type-safe hash as in the following example.
This type is supported at parse-time and at runtime; to convert such values to an untyped hash, assign it to a hash lvalue, use cast<hash>(...) on the value, call the hash() function on the value, or assign it to an untyped lvalue. Each of these options can be used to convert a type-safe hash to an untyped hash.
Complex type information is lost when assigning to an lvalue with a compatible but more generic type or by assigning to an untyped lvalue; this was necessary to allow complex types to be introduced in Qore without breaking backwards compatibility.
However, a special single argument, "auto"
, allows for the lvalue to maintain the complex hash type as in the following example:
Complex hash Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
hash | hash<string, type> | hash<string, type> | Restricts values to hashes with the given declared key type; use cast<>(...) to convert values to this type at runtime. |
The hash type also supports two arguments in angle brackets to specify the key and value types, however the key type currently must always be string. This results in a hash where the keys and values must always be of the declared type. See the following example for more information.
This type is supported at parse-time and at runtime; to convert such values to an untyped hash, assign it to a hash lvalue, use cast<hash>(...) on the value, call the hash() function on the value, or assign it to an untyped lvalue. Each of these options can be used to convert a type-safe hash to an untyped hash.
Complex type information is lost when assigning to an lvalue with a compatible but more generic type or by assigning to an untyped lvalue; this was necessary to allow complex types to be introduced in Qore without breaking backwards compatibility.
However, a special single argument, "auto"
, allows for the lvalue to maintain the complex hash type as in the following example:
list Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
list | List | List | Restricts values to Qore's List type |
Complex list Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
list | list<type> | list<type> | Restricts values to lists with the given declared value type; use cast<>(...) to convert values to this type at runtime. |
The list type supports one type argument in angle brackets to specify the value type. This results in a list where the values must always be of the declared type. See the following example for more information.
This type is supported at parse-time and at runtime; to convert such values to an untyped list, assign it to a list lvalue, use cast<list>(...) on the value, call the list() function on the value, or assign it to an untyped lvalue. Each of these options can be used to convert a type-safe list to an untyped list.
Complex type information is lost when assigning to an lvalue with a compatible but more generic type or by assigning to an untyped lvalue; this was necessary to allow complex types to be introduced in Qore without breaking backwards compatibility.
However, a special single argument, "auto"
, allows for the lvalue to maintain the complex list type as in the following example:
object Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
object | Object | Object | Restricts values to Qore's Object type; note that any class name can also be used as a type restriction directly |
Complex object Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
object | object<class> | object<class> | Restricts values to objects of the given class |
The object type declaration takes a single class name (or namespace- prefixed path) in angle brackets after "object"
which results in a type declaration restricted to the declared class as in the following example.
<classname> Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
any class name | Object of the particular class given | Object of the particular class given | Restricts values to objects of the particular class given; subclasses are also accepted |
null Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
null | NULL | NULL | Restricts values to Qore's NULL type; this type has few (if any) practical applications and has been included for completeness' sake |
nothing Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
nothing | NOTHING | NOTHING | Restricts values to Qore's NOTHING type; this type is mostly useful for declaring that a function or method returns no value |
timeout Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
timeout | Integer, Date | Integer | Accepts Integer, Date values and converts dates to an integer value representing milliseconds and returns the integer; incoming integers are assumed to represent milliseconds |
base64binary Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
base64binary | String, Binary | Binary | Accepts String values by converting base64-encoded strings to a binary value and returns the binary |
hexbinary Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
hexbinary | String, Binary | Binary | Accepts String values by converting hex strings to a binary value and returns the binary |
softbinary Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
softbinary | String, Binary | Binary | Accepts String values and converts non-binary values to a binary directly and returns the binary |
softint Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
softint | Integer, Float, Number, Boolean, String, NULL | Integer | Accepts Integer, Float, Number, Boolean, String, and NULL values and converts non-integer values to an integer and returns the integer |
softfloat Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
softfloat | Integer, Float, Number, Boolean, String, NULL | Float | Accepts Integer, Float, Number, Boolean, String, and NULL values and converts non-float values to a float and returns the float |
softnumber Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
softnumber | Integer, Float, Number, Boolean, String, NULL | number | Accepts Integer, Float, Number, Boolean, String, and NULL values and converts non-number values to a number and returns the number |
softbool Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
softbool | Integer, Float, Number, Boolean, String, NULL | Boolean | Accepts Integer, Float, Number, Boolean, String, and NULL values and converts non-boolean values to a boolean and returns the boolean |
softstring Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
softstring | Integer, Float, Number, Boolean, String, NULL | String | Accepts Integer, Float, Number, Boolean, String, and NULL values and converts non-string values to a string and returns the string |
softdate Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
softdate | Integer, Float, Number, Boolean, String, Date, NULL | Date | Accepts Integer, Float, Number, Boolean, String, Date, and NULL values and converts non-date values to a date and returns the date |
softlist Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
softlist | all data types | List | Accepts all data types; NOTHING is returned as an empty list; a list is returned unchanged, and any other type is returned as the first element of a new list |
Complex list Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
softlist | all data types | List | Accepts all data types; NOTHING is returned as an empty list; a list is returned with its elements processed by the subtype declaration, and any other type is returned as the first element of a new list, also processed by the subtype declaration |
The softlist type supports one type argument in angle brackets to specify the value type. This results in a list where the values must always be of the declared type. See the following example for more information.
This type is supported at parse-time and at runtime; to convert such values to an untyped list, assign it to a list lvalue, use cast<list>(...) on the value, call the list() function on the value, or assign it to an untyped lvalue. Each of these options can be used to convert a type-safe list to an untyped list.
Complex type information is lost when assigning to an lvalue with a compatible but more generic type or by assigning to an untyped lvalue; this was necessary to allow complex types to be introduced in Qore without breaking backwards compatibility.
However, a special single argument, "auto"
, allows for the lvalue to maintain the complex list type as in the following example:
data Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
data | String or Binary | same as received | Restricts values to String and Binary |
code Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
code | Closures, Call References | same as received | Restricts values to Closures and Call References |
"closure"
and "callref"
are accepted as synonyms for "code"
(they are not more specific than "code"
but rather provide identical type restrictions)reference Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
reference | References | the type the reference points to | Requires a reference to an lvalue to be assigned |
Complex reference Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
reference | reference<type> | type as given as the arg | Restricts values to references to lvalues with a type compatible to that given as the type argument |
The reference type supports one type argument in angle brackets to specify a compatible lvalue type. See the following example for more information.
*int Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*int | Integer, NULL, or NOTHING | Integer or NOTHING | Restricts values to Integer and NOTHING; if NULL is passed then NOTHING is returned |
*float Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*float | Float, NULL, or NOTHING | Float or NOTHING | Restricts values to Float and NOTHING; if NULL is passed then NOTHING is returned |
*number Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*number | Number, NULL, or NOTHING | Number or NOTHING | Restricts values to Number and NOTHING; if NULL is passed then NOTHING is returned |
*bool Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*bool | Boolean, NULL, or NOTHING | Boolean or NOTHING | Restricts values to Boolean and NOTHING; if NULL is passed then NOTHING is returned |
*string Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*string | String, NULL, or NOTHING | String or NOTHING | Restricts values to String and NOTHING; if NULL is passed then NOTHING is returned |
*date Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*date | Date, NULL, or NOTHING | Date or NOTHING | Restricts values to Date and NOTHING; if NULL is passed then NOTHING is returned |
*binary Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*binary | Binary, NULL, or NOTHING | Binary or NOTHING | Restricts values to Binary and NOTHING; if NULL is passed then NOTHING is returned |
*hash Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*hash | Hash, NULL, or NOTHING | Hash or NOTHING | Restricts values to Hash and NOTHING; if NULL is passed then NOTHING is returned |
Complex Hashdecl or Nothing Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*hash<...> | Hash, NULL, or NOTHING | Hash or NOTHING | Restricts values to values of the referenced type-safe hash or NOTHING types; if NULL is passed then NOTHING is returned |
Complex Hash or Nothing Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*hash<string, ...> | Hash, NULL, or NOTHING | Hash or NOTHING | Restricts key values to the declared complex hash or NOTHING types; if NULL is passed then NOTHING is returned |
*list Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*list | List or NOTHING | List or NOTHING | Restricts values to List and NOTHING; if NULL is passed then NOTHING is returned |
Complex List or Nothing Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*list<...> | List, NULL, or NOTHING | List or NOTHING | Restricts list values to the declared complex list type or NOTHING; if NULL is passed then NOTHING is returned |
*list Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*list | Object, NULL, or NOTHING | Object or NOTHING | Restricts values to Object and NOTHING; if NULL is passed then NOTHING is returned |
*<classname> Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
* any class name | Object of the particular class given, NULL, or NOTHING | Object of the particular class given or NOTHING | Restricts values to objects of the particular class given or NOTHING; subclasses are also accepted; if NULL is passed then NOTHING is returned |
null Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
null | NULL or NOTHING | NULL or NOTHING | Restricts values to Qore's NULL and NOTHING types; this type has few (if any) practical applications and has been included for completeness' sake |
*data Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*data | String, Binary, NULL, or NOTHING | String, Binary, or NOTHING | Restricts values to String, Binary, and NOTHING; if NULL is passed then NOTHING is returned |
*code Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*code | Closures, Call References, NULL, or NOTHING | Closures, Call References, or NOTHING | Restricts values to Closures, Call References, and NOTHING; if NULL is passed then NOTHING is returned |
*timeout Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*timeout | Integer, Date, NULL, or NOTHING | Integer or NOTHING | converts dates to an integer value representing milliseconds and returns the integer; incoming integers are assumed to represent milliseconds; also accepts NOTHING and returns NOTHING; if NULL is passed then NOTHING is returned |
*reference Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
reference | References, NULL, or NOTHING | the type the reference points to | Requires a reference to an lvalue to be assigned or NOTHING; if NULL is passed then NOTHING is returned |
complex Reference or Nothing Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*reference<...> | References, NULL, or NOTHING | the type given as an argument and NOTHING | Restricts values to references to lvalues compatible with the given type and NOTHING; if NULL is passed then NOTHING is returned |
*softint Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*softint | Integer, Float, Number, Boolean, String, NULL, NOTHING | Integer or NOTHING | Accepts Integer, Float, Number, Boolean, String, and NULL values and converts non-integer values to an integer and returns the integer; also accepts NOTHING and NULL and returns NOTHING |
*softfloat Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*softfloat | Integer, Float, Number, Boolean, String, NULL, NOTHING | Float or NOTHING | Accepts Integer, Float, Number, Boolean, String, and NULL values and converts non-float values to a float and returns the float; also accepts NOTHING and NULL and returns NOTHING |
*softnumber Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*softnumber | Integer, Float, Number, Boolean, String, NULL, NOTHING | Number or NOTHING | Accepts Integer, Float, Number, Boolean, String, and NULL values and converts non-number values to a number and returns the number; also accepts NOTHING and NULL and returns NOTHING |
*softbool Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*softbool | Integer, Float, Number, Boolean, String, NULL, NOTHING | Boolean or NOTHING | Accepts Integer, Float, Number, Boolean, String, and NULL values and converts non-boolean values to a boolean and returns the boolean; also accepts NOTHING and NULL and returns NOTHING |
*softstring Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*softstring | Integer, Float, Number, Boolean, String, NULL, NOTHING | String or NOTHING | Accepts Integer, Float, Number, Boolean, String, and NULL values and converts non-string values to a string and returns the string; also accepts NOTHING and returns NOTHING |
*softdate Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*softdate | Integer, Float, Number, Boolean, String, Date, NULL, NOTHING | String or NOTHING | Accepts Integer, Float, Number, Boolean, String, Date, and NULL values and converts non-date values to a date and returns the date; also accepts NOTHING and NULL and returns NOTHING |
*softlist Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*softlist | all data types | List or NOTHING | Accepts all data types; NOTHING and NULL are returned as NOTHING; a list is returned unchanged, and any other type is returned as the first element of a new list |
Complex Softlist or Nothing Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
*softlist | all data types | List or NOTHING | Accepts all data types; NOTHING and NULL are returned as NOTHING; a list is returned with its elements processed by the declared subtype, and any other type is returned as the first element of a new list with its element processed by the declared subtype |
any Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
any | all data types | all data types | Provides no restrictions on the type of value it receives and returns the same value, however complex type information is stripped on assignment for backwards compatibility |
auto Type Restriction
Name | Accepts Qore Type(s) | Returns Qore Type(s) | Description |
auto | all data types | all data types | Provides no restrictions on the type of value it receives and returns the same value; does not strip complex types on assignment like any |
auto
is recommended over any