Skip to content

Add promote to Modelica #2568

@sjoelund

Description

@sjoelund

The function \lstinline!promote! cannot be used in Modelica, because
the number of dimensions of the returned array cannot be determined at
compile time if \lstinline!n! is a variable. Below, \lstinline!promote! is only used for
constant \lstinline!n!.
suggests that the reason promote is not a builtin function in Modelica is because a variable can have an unknown number of dimensions. Restricting n itself to be constant should not be a problem, right?
However, I believe that all such holes in the specification are resolved. If-expressions, etc are required to have the same types in all branches and I cannot seem to construct any expression where the number of dimensions would be unknown.

The minimum change needed would be to remove this rationale, but I believe it is a useful operator to have in the language anyway since MCP 0031 (Flat Modelica) probably needs it anyway. It should be very straight forward to get test implementations of it and into ModelicaSpec 3.5 since all tools probably already use the operator internally.

Metadata

Metadata

Labels

decidedA decision has been made (label added before the spec is changed)

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions