-
Notifications
You must be signed in to change notification settings - Fork 44
Proposal for improving pure situation, #3755
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
base: master
Are you sure you want to change the base?
Conversation
…valid and that users can update. Closes modelica#3719 Note that in addition to the changes in the issue reordered the items and changed "must" to "should" for the deprecated semantic, and clearly indicated that the exception is the deprecated case. (Having a "must"-requirement and then have exceptions for it just seems wrong.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way I read the proposal, a tool should generate a deprecation warning for every function not explicitly declared pure or impure. This makes it hard to make sense of the "normally" rule in the beginning.
Am I getting the intention right if I think the goal is to:
- Lack of explicit purity of an external function is deprecated.
- For a function not declared
impure, it is deprecated to call an external function not declaredpure. (Hence, making theimpureof an external function explicit will address one deprecation warning without leading to new ones.) - For a function without explicit purity, it is deprecated to call any function declared
impure. (Making theimpureof an external function explicit will cause an error if called from a function explicitly declaredpure.) - A function is assumed impure in the following cases (applied recursively):
- It is declared
impure - It is an external function without explicit purity
- It calls another function assumed impure
- It is declared
- (A function not assumed impure is assumed pure.)
What I am trying to capture above is that the deprecation rules have only to do with the explicit declaration of functions as pure or impure, whereas the reasoning about impure behavior is based on rules which are formulated so that they make sense regardless of deprecated (lack of) purity declaration.
Co-authored-by: Henrik Tidefelt <[email protected]>
That wasn't the intention, the new semantics was only intended to kick in if:
That is a bad combination, and shouldn't be common. The proposed semantics ensure that MSL 4.1.0 is kind of valid. And even more importantly, it also avoids breaking user libraries/models in the same way that rely on those functions in MSL. |
This has now been clarified even further. |
To ensure that current MSL is valid and that users can update.
Closes #3719
Note that in addition to the changes in the issue reordered the items and changed "must" to "should" for the deprecated semantic, and clearly indicated that the exception is the deprecated case.
(Having a "must"-requirement and then have exceptions for it just seems wrong.)