Functional Meta-types
Overview
A small number of meta-types are defined that correspond to functional programming primitives, otherwise known as 'closures', 'lambda expressions' and so on. These concepts are supported in most modern programming languages now, and the types defined here are intended to provide a minimal formal basis to enable other openEHR specification to defined function-related elements. Since UML does not contain native functional elements, the semantics here are approximated using normal class facilities.
The following illustrates the functional package.
Two key abstractions are required, namely 'function as a type', and 'tuple', which enables arguments to be formalised. To provide a 'function' type, a 'routine' type is also required. For completeness, a 'procedure' type is also defined. The 'tuple' type is defined as a generic meta-type whose descendants may additionally define any number of generic parameter types, corresponding to a type list.
Class Definitions
ROUTINE Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
ROUTINE<ARGS> |
|
|---|---|---|
Description |
Type representing a function with a return type and 0 or more arguments represented as a TUPLE. |
|
| ROUTINE<ARGS> | |
|---|---|
Type representing a function with a return type and 0 or more arguments represented as a TUPLE. |
{
"name": "ROUTINE",
"documentation": "Type representing a function with a return type and 0 or more arguments represented as a TUPLE.",
"generic_parameter_defs": {
"ARGS": {
"name": "ARGS",
"conforms_to_type": "TUPLE"
}
}
}
FUNCTION Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
FUNCTION<ARGS,RESULT> |
|
|---|---|---|
Description |
Type representing a function with a return type and 0 or more arguments represented as a TUPLE. |
|
Inherit |
||
| FUNCTION<ARGS,RESULT> | |
|---|---|
Type representing a function with a return type and 0 or more arguments represented as a TUPLE. |
|
Inherits: ROUTINE |
{
"name": "FUNCTION",
"documentation": "Type representing a function with a return type and 0 or more arguments represented as a TUPLE.",
"ancestors": [
"ROUTINE"
],
"generic_parameter_defs": {
"ARGS": {
"name": "ARGS",
"conforms_to_type": "TUPLE"
},
"RESULT": {
"name": "RESULT",
"conforms_to_type": "Any"
}
}
}
PROCEDURE Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
PROCEDURE<ARGS> |
|
|---|---|---|
Description |
Type representing a procedure with 0 or more arguments represented as a TUPLE. |
|
Inherit |
||
| PROCEDURE<ARGS> | |
|---|---|
Type representing a procedure with 0 or more arguments represented as a TUPLE. |
|
Inherits: ROUTINE |
{
"name": "PROCEDURE",
"documentation": "Type representing a procedure with 0 or more arguments represented as a TUPLE.",
"ancestors": [
"ROUTINE"
],
"generic_parameter_defs": {
"ARGS": {
"name": "ARGS",
"conforms_to_type": "TUPLE"
}
}
}
TUPLE Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
TUPLE |
|
|---|---|---|
Description |
Parent type of all TUPLE types. |
|
| TUPLE | |
|---|---|
Parent type of all TUPLE types. |
{
"name": "TUPLE",
"documentation": "Parent type of all TUPLE types."
}
TUPLE1 Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
TUPLE1<A> |
|
|---|---|---|
Description |
A Tuple type used, among other things, for representing a single typed argument within a Routine signature. |
|
Inherit |
||
| TUPLE1<A> | |
|---|---|
A Tuple type used, among other things, for representing a single typed argument within a Routine signature. |
|
Inherits: TUPLE |
{
"name": "TUPLE1",
"documentation": "A Tuple type used, among other things, for representing a single typed argument within a Routine signature.",
"ancestors": [
"TUPLE"
],
"generic_parameter_defs": {
"A": {
"name": "A",
"conforms_to_type": "Any"
}
}
}
TUPLE2 Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
TUPLE2<A,B> |
|
|---|---|---|
Description |
A Tuple type used, among other things, for representing two typed arguments within a Routine signature. |
|
Inherit |
||
| TUPLE2<A,B> | |
|---|---|
A Tuple type used, among other things, for representing two typed arguments within a Routine signature. |
|
Inherits: TUPLE |
{
"name": "TUPLE2",
"documentation": "A Tuple type used, among other things, for representing two typed arguments within a Routine signature.",
"ancestors": [
"TUPLE"
],
"generic_parameter_defs": {
"A": {
"name": "A",
"conforms_to_type": "Any"
},
"B": {
"name": "B",
"conforms_to_type": "Any"
}
}
}