Skip to content

Update purity exception for Streams.print #3706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

henrikt-ma
Copy link
Collaborator

In https://specification.modelica.org/master/functions.html#pure-modelica-functions there is the following exception for print:

A deprecated semantics is that external functions (and functions defined in Modelica directly or indirectly calling them) without pure or impure keyword are assumed to be impure, but without any restriction on calling them. Except for the function Modelica.Utilities.Streams.print, a diagnostic must be given if called in a simulation model.

The problem is that Modelica.Utilities.Streams.print is nowadays explicitly marked impure, so the exception is only causing confusion at the moment.

This PR updates the specification so that it applies to the current MSL. The most important part, that there is a loophole for calling print anywhere, still applies to older MSL where print is not explicitly declared impure. The only change for older MSL is that the deprecated semantics demands a diagnostic in this case – I find it better that tools act on their own on this matter than to elaborate the rules for diagnostics in the specification.

Reformulating to match the current MSL where 'print' is declared impure.
@henrikt-ma henrikt-ma requested review from casella and HansOlsson July 8, 2025 07:16
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.

1 participant