-
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
import Modelica.SIunits #2960
Comments
I think this is a very good idea! I am in favor of improving the quality of the Modelica Standard Library that way! |
Compare 3 styles:
|
Sorry, but NEVER EVER use wildcard imports. We even write in the specs to not use them as they are dangerous since there is a huge danger of variable collision. So for imports only ever use implicit imports. They (i.e., wildcard imports) are simply bad programming style in any language. |
What about copy a model out of the MSL for applying own changes? |
I see three possible solutions:
|
The solution would definitely be on the tool side in this case. And Dymola does this already by recognising the imported definitions and replacing them by full qualified class names upon duplication. So it really is a non-issue. And if it is then it is a missing tool feature. I know that OpenModelica for example doesn't even recognise relative name lookup on duplication at the moment. But they are working on it and the recognition of imports would just be another such feature that needs then to be worked on by the tool (@adrpo FYI). |
ok you're right |
The recommendation is to use unnamed import statements, i.e., parameter SIunits.Mass m=100 "Total mass";
import Modelica.SIunits; |
In my opinion, the usage of
import SI=Modelica.SIunits;
at some place in a sublibrary to shorten parameter definitions is really bad style:Much better style would be:
import Modelica.SIunits.*;
in every model.The question is:
Should we go through the whole MSL and change the style (resp. location) of such import statements?
The text was updated successfully, but these errors were encountered: