Skip to content
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

Allow extends-clauses in package.order. #3635

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

HansOlsson
Copy link
Collaborator

Closes #3438

The reasons for not making it more required are:

  • For backwards compatibility reasons we should be able to read packages where "package.order" doesn't include extends.
  • If extends-clauses must be included in "package.order" tools would anyway need a compatibility setting when working with libraries using an older version.
    Thus it makes sense that we only add them when needed.

@HansOlsson HansOlsson requested a review from eshmoylova January 3, 2025 15:13
chapters/packages.tex Outdated Show resolved Hide resolved
Copy link
Collaborator

@henrikt-ma henrikt-ma left a comment

Choose a reason for hiding this comment

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

It is not strong enough to say should. It needs to be:

…, but must be omitted if…

Also, I think "normal classes" can be explained more clearly as something like non-extends entries in the package.order.

@henrikt-ma
Copy link
Collaborator

henrikt-ma commented Jan 7, 2025

I think the entire paragraph needs to be rewritten with extends-clauses in mind, and why not deprecate the case of a stray extends-clauses?:

In order to preserve the order of sub-entities it is advisable to create a file \filename{package.order} where each line contains the name of one class or constant (in Modelica \lstinline!IDENT! form), or \lstinline!extends!-clause (in the form \lstinline!extends A.B! -- one space, no semicolon).
An \lstinline!extends!-clause entry shall be omitted from \filename{package.order} if it would appear before any non-\lstinline!extends!-clause entry.
If a \filename{package.order} is present when reading a structured entity, the classes, constants, and base classes are added in this order, following the non-listed base classes; if the \filename{package.order} content does not exactly match the package content, the resulting order is tool specific and a warning may be given.
A deprecated behavior is that an \lstinline!extends!-clause may be omitted anywhere in the \filename{package.order}.
The relative order of classes, constants, and \lstinline!extends!-clauses that are stored in \filename{package.mo} must be consistent with the relative order of the corresponding entries in \filename{package.order} (that is, the \filename{package.order} only adds information regarding the ordering of classes not stored in \filename{package.mo}).

@HansOlsson HansOlsson added this to the 2025-January milestone Jan 8, 2025
@HansOlsson
Copy link
Collaborator Author

HansOlsson commented Jan 9, 2025

To illustrate:

package P
  constant Real p=2;
  extends PBase;
  constant Real q=2;
  model B end B;
end P;

Language group: can find order of PBase even without package.order.

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.

Clarification on matching relative order between package.mo and package.order
2 participants