modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
453 stars 165 forks source link

Mismatching order in package.order #4232

Closed eshmoylova closed 3 months ago

eshmoylova commented 8 months ago

In Directory Hierarchy Mapping section of the Specification, it says:

Classes and constants that are stored in package.mo are also present in package.order but their relative order should be identical to the one in package.mo (this ensures that the relative order between classes and constants stored in different ways is preserved).

There are two cases where the order of classes in package.mo and package.order do not match: Media/IdealGases/Common/package.mo does not match Media/IdealGases/Common/package.mo, in particular, DataRecord is not followed by SingleGasNasa in package.order

Math/package.mo does not match Math/package.order: classes defined outside of package.mo are interspersed with classes defined in package.mo.

If the the order given in package.order is preferred, the classes in package.mo need to be taken out into stand-alone files.

HansOlsson commented 8 months ago

In Directory Hierarchy Mapping section of the Specification, it says:

Classes and constants that are stored in package.mo are also present in package.order but their relative order should be identical to the one in package.mo (this ensures that the relative order between classes and constants stored in different ways is preserved).

There are two cases where the order of classes in package.mo and package.order do not match: Media/IdealGases/Common/package.mo does not match Media/IdealGases/Common/package.mo, in particular, DataRecord is not followed by SingleGasNasa in package.order

I don't know if the text is unclear, some misunderstanding, or the variants have diverged but what I see is that package.order contains

package.mo contains the ones in bold in the following order:

So, the sub-set of classes in package.mo keep their relative order from package.order; the other classes Functions, FluidData, SingleGasesData are defined in other files. This allows you to freely order all of the classes (and constants) - regardless of whether they are stored in package.mo or in a separate file (or directory); and without having the weird situation that you have one order in package.mo and then shuffle them in package.order.

Math/package.mo does not match Math/package.order: classes defined outside of package.mo are interspersed with classes defined in package.mo. If the the order given in package.order is preferred, the classes in package.mo need to be taken out into stand-alone files.

I believe it is similar here, but didn't go through all of them.

eshmoylova commented 8 months ago

I submitted a separate issue against the specification https://github.com/modelica/ModelicaSpecification/issues/3438 to clarify what relative order is. Will update here, depending on the decision there.

eshmoylova commented 3 months ago

Closing. The Language group agreement was that this should be allowed.