Chapter 4. Computed and Stored Values

M provides two primary means for values to come into existence: computed values and stored values (aka fields). Computed and stored values may occur with both module and entity declarations and are scoped by their container.

A computed value is derived from evaluating an expression. In contrast, a field stores a value and the contents of the field may change over time. 1

4.1 Computed Value Declaration

A ComputedValueDeclaration binds a name to an expression that is used to compute the resultant value.

ComputedValueDeclaration:  Identifier FormalParameters ReturnTypeopt ExpressionBodyFormalParameters:  ( Parametersopt )Parameters:  Parameter  Parameters ,  ParameterParameter:  Identifier TypeAscriptionopt ...

Get The “Oslo” Modeling Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.