Skip to content

Define when-clause clearly#3841

Open
casella wants to merge 1 commit intomodelica:masterfrom
casella:casella-patch-1
Open

Define when-clause clearly#3841
casella wants to merge 1 commit intomodelica:masterfrom
casella:casella-patch-1

Conversation

@casella
Copy link
Collaborator

@casella casella commented Feb 19, 2026

Fixes #3840

@HansOlsson
Copy link
Collaborator

Good, but not complete.

The when-clause can be traced back to version 1.1 of the specification that in the grammar had when_clause_e (for when-equation) and when_clause_a (for when-algorithm). Thus (non-clocked) when-clause almost certainly is intended to cover both (when applicable).

Section 8.5 even implicitly states this:

All equations and assignment statements within when-clauses and all assignment statements within
function classes are implicitly treated with noEvent, i.e., relations within the scope of these operators never induce state or time events...

@HansOlsson HansOlsson self-requested a review February 20, 2026 09:22
Copy link
Collaborator

@HansOlsson HansOlsson left a comment

Choose a reason for hiding this comment

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

It should be clear that when-clauses also include when-statements in some way.

\subsection{When-Equations}\label{when-equations}

The \lstinline!when!-equations\index{when@\robustinline{when}!equation}\index{then@\robustinline{then}!when-equation@\robustinline{when}-equation}\index{elsewhen@\robustinline{elsewhen}!when-equation@\robustinline{when}-equation} have the following syntax:
The \lstinline!when!-equations\index{when@\robustinline{when}!equation}\index{then@\robustinline{then}!when-equation@\robustinline{when}-equation}\index{elsewhen@\robustinline{elsewhen}!when-equation@\robustinline{when}-equation}, also known as \lstinline!when!-clauses, have the following syntax:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The \lstinline!when!-equations\index{when@\robustinline{when}!equation}\index{then@\robustinline{then}!when-equation@\robustinline{when}-equation}\index{elsewhen@\robustinline{elsewhen}!when-equation@\robustinline{when}-equation}, also known as \lstinline!when!-clauses, have the following syntax:
When-clauses\index{when@\robustinline{when}!clause} refer to both \lstinline!when!-equations and \lstinline!when!-statements, \cref{when-statements}.
The \lstinline!when!-equations\index{when@\robustinline{when}!equation}\index{then@\robustinline{then}!when-equation@\robustinline{when}-equation}\index{elsewhen@\robustinline{elsewhen}!when-equation@\robustinline{when}-equation} have the following syntax:

I know that it should preferably be rewritten, but at least this ensures that both when-equations and when-statements are mentioned.

Copy link
Collaborator

Choose a reason for hiding this comment

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

With rewritten I primarily mean that it should be placed somewhere else (in this section, or possible some other one), but I cannot easily do that as a comment.

@HansOlsson HansOlsson added this to the 2026-March milestone Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarify meaning of when-clause

2 participants