O'Reilly logo

The “Oslo” Modeling Language by Don Box, Brad Lovering, David Langworthy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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]

Computed Value Declaration

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

ComputedValueDeclaration:
  Identifier FormalParameters ReturnTypeopt ExpressionBody
FormalParameters:
  ( Parametersopt )
Parameters:
  Parameter
  Parameters ,  Parameter
Parameter:
  Identifier TypeAscriptionopt
ReturnType: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required