Skip to content

Clarify simple function call. - #3897

Open
HansOlsson wants to merge 11 commits into
modelica:masterfrom
HansOlsson:FunctionCallSemantics
Open

Clarify simple function call.#3897
HansOlsson wants to merge 11 commits into
modelica:masterfrom
HansOlsson:FunctionCallSemantics

Conversation

@HansOlsson

Copy link
Copy Markdown
Collaborator

I noticed that the issue had milestone 3.7 so I thought it best to have at least a proposal for a solution; even if we decide to postpone it.

Closes #3632

Future possibilities:

  • Could group reinit, assert, terminate in a sub-section of their own (and thus move them down one level), and put this explanation at that place (but still referenced from simple equation).
  • Modify the grammar as it currently contains:
some-equation :
( equation-or-procedure
  | if-equation
  | for-equation
  | connect-equation
  | when-equation
)
description

equation-or-procedure :
simple-equation
| function-call

connect-equation :
connect "(" component-reference "," component-reference ")"

To me it would be logical to group function-call and connect-equation after each other inside equation-or-procedure. However, we cannot view connect-equation as a kind of function-call as connect is a keyword and break connect-equation is used for selective model extension.

@HansOlsson HansOlsson added this to the ModelicaSpec3.7 milestone May 6, 2026
@HansOlsson HansOlsson added the clarification Specification of feature is unclear, but not incorrect label May 6, 2026
@henrikt-ma

Copy link
Copy Markdown
Collaborator

To me it would be logical to group function-call and connect-equation after each other inside equation-or-procedure. However, we cannot view connect-equation as a kind of function-call as connect is a keyword and break connect-equation is used for selective model extension.

The only use of equation-or-procedure and statement-or-procedure that I see is that they are mentioned non-normatively when talking about how to write a recursive descent parser. If we omitted that non-normative section, we wouldn't have to draw an artificial line between what goes directly into some-equation (statement) and what goes into equation-or-procedure (statement-or-procedure).

Comment thread chapters/equations.tex Outdated
Comment thread chapters/equations.tex Outdated
@HansOlsson

Copy link
Copy Markdown
Collaborator Author

Delay

@HansOlsson HansOlsson removed this from the ModelicaSpec3.7 milestone May 7, 2026
@HansOlsson HansOlsson added this to the 2026-June milestone Jun 4, 2026
@HansOlsson
HansOlsson requested a review from henrikt-ma June 4, 2026 15:40
Comment thread chapters/equations.tex Outdated
Comment thread chapters/equations.tex Outdated
Comment thread chapters/equations.tex

@henrikt-ma henrikt-ma left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Among other remaining issues, the statement aspect of #3632 is still not addressed.

Now that 3.7 has been released and we don't have to try to rush things, I think we should also take the time to make the discussed improvements of the grammar.

Comment thread chapters/equations.tex Outdated
Comment thread chapters/equations.tex Outdated
Comment thread chapters/equations.tex Outdated
@HansOlsson
HansOlsson requested a review from henrikt-ma August 24, 2026 15:07

@henrikt-ma henrikt-ma left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remarks as on July 7:

Among other remaining issues, the statement aspect of #3632 is still not addressed.

Now that 3.7 has been released and we don't have to try to rush things, I think we >should also take the time to make the discussed improvements of the grammar.

@HansOlsson HansOlsson modified the milestones: 2026-June, 2026-September Sep 2, 2026
@HansOlsson

Copy link
Copy Markdown
Collaborator Author

I have now also updated the grammar. The non-normative section was updated as well.

@HansOlsson

Copy link
Copy Markdown
Collaborator Author

The equation and statement sections have also been updated.
Having reinit under side-effect equations also implied a restructuring.

In general it would be good to have the sections somewhat match the order in the grammar I think. Now we have:

Equations:
Sections:

  • Simple equations
  • Side-effect equations
  • For-equations
  • Connect-equations
  • If-equations
  • When-equations

Grammar:

  • simple-equation
  • function-call (side-effect)
  • connect-equation
  • if-equation
  • for-equation
  • when-equation

Statements:

  • Simple assignments
  • Side-effect statements
  • For-statements
  • Break-statements
  • Return-statements
  • While-statements
  • If-statements
  • When-statements

Grammar:

  • Assignment statements
  • break-statement
  • return-statement
  • if-statement
  • for-statement
  • while-statement
  • when-statement

However, to me reordering that should be a separate PR as it is not about simple function calls anymore; and we might consider different variants. Note that break and return currently aren't grouped with side-effect statements as they aren't function calls, but it would be possible.

I don't know the best order for if, for, while, when - but I think we should only have one.

HansOlsson and others added 8 commits September 2, 2026 14:00
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
@HansOlsson
HansOlsson force-pushed the FunctionCallSemantics branch from 0623e60 to 8a4a532 Compare September 2, 2026 12:08
@HansOlsson

Copy link
Copy Markdown
Collaborator Author

It should now be ready for review.
The problematic merging indicates that restructuring above should really be in a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clarification Specification of feature is unclear, but not incorrect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Semantics of function call equations and statements

2 participants