classes - Raesangur/PascalScript_Reference GitHub Wiki
Classes are named objects that regroup data and ways to access and edit the data in a single package. In PascalScript, every object, from functions to types to variables, has an underlying class.
Detailed Syntax
-
(optional) class_attributes
(optional) class_template_decl
(optional) class_access_specifiersclass
class_name: {class_body)} -
- See Class Attributes.
- Any of:
#weak
#virtual
#singleton
#inherits
#partial
- Any other general attribute.
-
- See Templates.
#template
<template_parameter_list>
(optional)#valid_if
(template_constraint (optional), template_constraint_message) -
- See Access Specifiers
- One of:
public
protected
private
-
- One or more comma-separated list of named [template_parameter](#template parameter) declarators.
-
- A template parameter can be either a type-specific template parameter, or a value-specific template parameter:
type
template_parameter_name (optional) = template_parameter_initializer- OR
type template_parameter_name (optional) = template_parameter_initializer
- A template parameter can be either a type-specific template parameter, or a value-specific template parameter:
-
- A compile-time boolean expression, using the values and/or types from the template parameter lists.
- If the boolean expression resolves to
false
, an error is produced and the template_constraint_message is displayed if provided.
-
- A compile-time string literal to be displayed to the programmer if the template_constraint expression was to resolve to
false
.
- A compile-time string literal to be displayed to the programmer if the template_constraint expression was to resolve to
-
- Variable name declarator
-
template_parameter_initializer:
- A default value or type to be assigned to template_parameter_name if none is provided.
- If the associated template_parameter_name is a type-specific template, needs to be a type.
std.type_traits.is_type(template_parameter_initializer) == true
- If the associated template_parameter_name is a value-specific template, needs to be of the same type as template_parameter_name.
template_parameter_name.type() == template_parameter_initializer.type()
-
- Contains a list of access specifier sections, method definitions and properties.
- (1 ... n) class_member
-
- One of:
- class_access_specifier:
- class_method
- class_property
- [other declarative statement]
- One of:
-
- One of:
-
variable definition (optional) managed_property_definition
-
{(0 ... n) managed_property_method}
-
- TODO
-
- TODO