-
Notifications
You must be signed in to change notification settings - Fork 164
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
Reorganise SIunits into Units package #3379
Conversation
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 overall quality of the PR is very good. However there are two issues we need to discuss, being a design issue and a naming issue.
-
Naming: Modelica.Units.Other looks odd or incomplete when you have something like
import Modelica.Units.Other; Other.Time_day v;
. Since there still isimport NonSI = Modelica.Units.Other;
in the MSL, why do not we rename Other to NonSI? -
Design: b2b8ae2 imports Modelica.Units.SI everywhere. This kind of global namespace pollution is considered bad practice in software engineering and I strongly prefer to avoid it here. A compromise would be to add this import statement for every package where it actually is required. For example, it is not needed for Modelica.UsersGuide, thus there is no need to import it there.
@christiankral @HansOlsson @MartinOtter It would be very hepful if we can discuss my concerns tomorrow (31st of Jan.) during day-time. Thanks a lot. |
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.
My comments:
- If we want to change this - it is clear that this is the time.
- I agree with the concern regarding Other.
- I agree that a top-level import used everywhere is a bit odd style, and often I find that the full name is often good enough. However, I don't have strong feelings about this.
- I noticed that we internally recognize "Modelica.SIunits" and will need to update that - I assume it might be similar for other tool vendors; but I don't see this as a blocking concern. (E.g., Ctrl-Shift-U inserts "Modelica.SIUnits." and starts text-completion.)
One compromise would be to remove the top-level import from package Modelica and add it as second-level import where required. This way, we can avoid the import for Modelica.UsersGuide, Modelica.Icons and Modelica.Units itself. |
Strictly following BIPM, there is defined a limited number of non-SI units accepted for use with the SI Units. See #712 (comment). |
I fully agree with this.
I may agree in principle here. However, I don't see much of a problem in having On the other hand, a global import statement makes it very clear that we are using the same import symbol throughout the Modelica standard library, and also that we are implicitly recommending other library developers to do so. After all, many libraries have an SI import statement, which I guess is a pattern borrowed from the MSL. So I'm slightly in favour of keeping it like this, but I have no strong opinion on this topic. |
Proposals for tonight and Alpha.1.
What do you think? |
b96f8e3
to
b2b12d7
Compare
TODO: - [X] add conversion script entries - [ ] update all references in MSL - [ ] update all references and simplify import statements in - [ ] Complex - [ ] ObsoleteModelica4 - [ ] ModelicaTestOverdetermined - [ ] update the documentation of the package
…e is no point in keep Temp_K
b2b12d7
to
fba372d
Compare
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.
OK, looks like a sound solution now
This fixes #712 by reorganising the SIunits package into a Units package
I checked the following libraries (Dymola 2020, non-pedantic mode, see #3378 why) :