Skip to content

Type for array subscripting #3410

Description

@HansOlsson

The specification has integer subscripts (which is the default), but also enumeration and Boolean subscripts https://specification.modelica.org/master/arrays.html#boolean-or-enumeration-indices

The latter two are not well-supported, and looking more closely array declarations explicitly states that:

An array indexed by Boolean or enumeration type can only be used in the following ways:

  • Subscripted using expressions of the appropriate type (i.e., Boolean or the enumerated type).
  • Binding equations of the form x1 = x2 are allowed for arrays independent of whether the index types of dimensions are subtypes of Integer, Boolean, or enumeration types.

We could generalize it (to support general subscripting), and then we have the following issues:

Note that enumeration and Boolean subscripts for arrays are not used much. It can be used to define "truth-tables" for 9 and 4-valued logic as in Modelica.Electrical.Digital.Tables; but I don't know many additional uses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions