Skip to content

Definition of backwards-compatibile for Modelica libraries #3209

Open

Description

@casella

Modelica library developers are converting their libraries to MSL 4.0.0, after almost 10 years of backwards-compatible MSL, when nobody bothered. This raises one fundamental question: what does backwards compatible actually mean for Modelica libraries?

Based on some discussion on modelica-design, there are two possible definitions

  • Weak backwards compatibility: library MyLib v.x is backwards-compatible with library MyLib v.y if there is no need of a conversion script specific to library MyLib to convert existing libraries that use MyLib v.x to use MyLib v.y. In other words, there is no need to change how you define or instantiate classes of MyLib in your models between v.x and v.y.
  • Strong backwards compatibility library MyLib v.x is backwards compatible with MyLib v.y if there is no need of any conversion script whatsoever to convert existing libraries that use MyLib v.x to use MyLib v.y. In other words there is no need to change anything in your models to use MyLib v.y instead of MyLib v.x

Based on what I see in https://github.com/modelica-3rdparty, there are many libraries which have been converted to MSL 4.0.0, withouth changing their own interfaces (so no conversion script needed), _except for the MSL uses annotation, which requires to run the conversion script of MSL 4.0.0 on your own model. Some of then are adopting the weak definition, so they bump a minor release number, while others adopt the strong definition and they bump the major release number.

It would be good if we could reach some consensus of the community on what is the preferred interpretation, even though this might be too late already for the majority of MSL 3.2.3 -> 4.0.0 conversions. At least we'd be ready for the next MSL 5.0.0 in 10 years from now, and we would help getting package managers into the mainstream with shared conventions among tools.

The outcome of this discussion should eventually become part of MCP-0016.

Activity

  1. added
    clarificationSpecification of feature is unclear, but not incorrect
    on Jun 22, 2022
  2. dietmarw commented on Jun 22, 2022

    @dietmarw
    Member

    @casella using your "v.x" and "v.y" notation makes it difficult to identify what you are trying to describe (especially since I think you got a typo in the strong backward compatibility). As a first step when discussing this, one needs to agree to start by using semver in order to make any statement of the definitions. Libraries that have not used it so far should implement it with the next release and can then decide on the compatibility.

    Example:

    • Definitions:
      • MyLib: library that is getting a new release
      • UserLib: user library that is using MyLib

    Let's say that MyLib has not been following semver so far and had a version 5.3 which uses MSL 3.2.3.

    • The very first thing they should do is to first of all switch to semver (without that any discussion of how to organise the backward compatibility is pretty much pointless since the version number then has no meaning again).
    • The new version then has to be either 5.4.0 or 6.0.0. The meaning would be the following:
      • 5.4.0 (uses MSL3.2.3): User models using 5.3 can use 5.4.0 without any conversion.
      • 5.4.0 (uses MSL4.0.0): In case none of the classes inside MyLib are impacted by the conversion to MSL 4.0.0 one could make the case that this is a backwards-compatible version with no conversion of the MyLib components (!) used in the UserLib. However, since MyLib now uses (and loads) MSL 4.0.0 the tool would trigger the conversion script of the MSL to 4.0.0 which might do changes to UserLib (we said that MyLib did not have any changes that affect UserLib)
      • 6.0.0 (uses MSL4.0.0):
      1. You have no changes inside MyLib that are touched by the MSL conversion but like to make clear to the user that just by loading MyLib 6.0.0 a conversion of UserLib would be triggered that changes UserLib in such a way that it can no longer be used with MSL 3.2.3 (and the old 5.3 for that matter). This I think is the cleanest and most user-friendly variant since it signals to the users that there are likely to be changes to UserLib (even though not triggered by the new MyLib itself but the use of MSL 4.0.0).
      2. You have changes inside MyLib that require a conversion script. This is the typical MAJOR version and always triggers the change of the X digit in the semver X.Y.Z definition.
      • (6.0.0 (uses MSL3.2.3) would of course also be possible due to non-backwards changes in MyLib with still the same MSL 3.2.3 dependency, but this is not the focus here)
  3. dietmarw commented on Jun 22, 2022

    @dietmarw
    Member

    One case I forgot:

    • 5.3.1 (uses MSL 3.2.3): Should the developers decide on a new bugfix release without any new features and changes to the libraries used then they can adopt semver right away. But should then state that no conversion is needed.
  4. casella commented on Jun 22, 2022

    @casella
    CollaboratorAuthor

    @casella using your "v.x" and "v.y" notation makes it difficult to identify what you are trying to describe

    Sorry, what I meant with v.x is some version (e.g. version 5.2.3) and v.y is some other version (e.g. version 5.3.1, or 6.0.0-beta.1). The only thing that matters is that they are different.

    (especially since I think you got a typo in the strong backward compatibility).

    I think I now corrected that, thanks! 😅

    As a first step when discussing this, one needs to agree to start by using semver in order to make any statement of the definitions. Libraries that have not used it so far should implement it with the next release and can then decide on the compatibility.

    I agree we should all use semver and propose an orderly path to migrate to that, but that's beyond the scope of this discussion. Ockham's razor here. I would just like to get a consensus on a single issue in this ticket: what do we mean as backwards compatible, which then will have obvious consequences on semver version numbers, that we need not discuss here. Hence, again, I'm using v.x and v.y and not getting into the intricacies of semver numbering, because they are not relevant to the discussion.

    To summarize even further, the question is the following:

    Is the set of used libraries of MyLib also considered as a part of its interface, so that a non-backwards compatible change of that and that alone is sufficient ground to declare a new version of MyLib as non-backwards compatible, even if it doesn't require a library-specific conversion script?

    As I understand from your previous comment, your answer to this question is YES, hence you suggest to switch to 6.0.0 if using semver, just to point out to the user that there is no way back, even if there is no need to run MyLib-specific conversion scripts, only MSL 4.0.0 conversions.

    I understand that also @GallLeo shared this opinion, on the ground that it should be clear to the end user that something irreversible happens to UserLib if it switches to this new version.

    It was also shared by @sjoelund on the grounds that the set of used libraries is integral part of the interface of MyLib.

  5. dietmarw commented on Jun 22, 2022

    @dietmarw
    Member

    @casella This is where I think you have a typo:

    Strong backwards compatibility library MyLib v.y is backwards compatible with MyLib v.y

  6. casella commented on Jun 22, 2022

    @casella
    CollaboratorAuthor

    OMG, sometimes I'm really dumb 😄. That's fixed now.

  7. henrikt-ma commented on Jun 23, 2022

    @henrikt-ma
    Collaborator

    To summarize even further, the question is the following:

    Is the set of used libraries of MyLib also considered as a part of its interface, so that a non-backwards compatible change of that and that alone is sufficient ground to declare a new version of MyLib as non-backwards compatible, even if it doesn't require a library-specific conversion script?

    I also agree that this must be considered a backwards incompatible change. It makes good sense to me that a library author who is wary about introducing backwards incompatible changes needs to think carefully before changing library dependencies in a backwards incompatible way.

    In the future, there could be ways of saying that there are multiple (major) versions of a used library that all work with the authored library, and this would then open up for sometimes being able to allow a new major version of a used library as an alternative to the old version, without the need to consider this a backwards incompatible change in the authored library.

  8. casella commented on Jun 23, 2022

    @casella
    CollaboratorAuthor

    Good to see some consensus building up, it would be good to have other opinions, e.g. @mtiller, @MartinOtter, @beutlich, @AHaumer.

  9. HansOlsson commented on Jun 23, 2022

    @HansOlsson
    Collaborator

    To me focusing solely on changes caused by conversions of other libraries seems a bit odd; and I believe we first need to establish what we mean with compatibility of the library itself - and then this follow automatically.

    So for versioning in general the practical problems are in terms of priority (most impacting at the top):

    1. The classes are redesigned without conversion scripts.
    2. A class that may be used as a base-class has a new element, which may collide with existing use of it.
    3. Some public element is removed from the library with convertMessage indication - but that only indicates what to fix, it doesn't automatically fix it.
    4. Some model behavior has changed, it doesn't matter whether it is viewed as a bug-fix or an enhancement.
    5. Some elements are changed and it will be automatically handled using conversion scripts.
    6. Documentation and/or some equations are rewritten without possibly impacting the results; or just a change of version.

    Only 6 is real backward compatibility, and in practice almost every release is at 4 or lower - and thus users need to verify that it is compatible. Claiming otherwise will only be seen as attempting to trick our users.

    For conversion in general and convertMessage in particular we see that we need a more refined concept than whether MSL 4.0.0 is backwards compatible with MSL 3.2.3, since it depends on what features of MSL 3.2.3 were used, and we can actually check that.

  10. henrikt-ma commented on Jun 23, 2022

    @henrikt-ma
    Collaborator

    To me focusing solely on changes caused by conversions of other libraries seems a bit odd; and I believe we first need to establish what we mean with compatibility of the library itself - and then this follow automatically.

    I think that conversions is just one example of something that would require the new version of the used library to be considered non-backwards compatible with its previous version. The discussion we're having here is meaningful without knowing exactly what is meant by "backwards incompatible"; if the dependency library has determined that its new version isn't a backwards compatible release for one reason or another, could the dependent library change its uses annotation to require the new version without it being considered a backwards incompatible change?

    To me, this seems like something that shouldn't be left to the author of the dependent library to decide. In other words, I see such a change of library dependency as one of the things that should be on our list of changes that definitely requires bumping the major version.

  11. casella commented on Jun 23, 2022

    @casella
    CollaboratorAuthor

    Only 6 is real backward compatibility

    This is really too strict. If you really want this kind of backward compatibility, then you have to stick to the same version forever. I guess it is well understood that if you upgrade to a newer version of a library you may get different results, hopefully more accurate, robust, fast, or whatever. That (together with getting new models) is the whole point of upgrading to a new version of a library

    and in practice almost every release is at 4 or lower - and thus users need to verify that it is compatible.

    Sure, I guess everybody understands that. The question is: "can I compile the model or not?". Maybe for the purposes of this discussion we could stick to that as definition of backwards compatibility.

    For conversion in general and convertMessage in particular we see that we need a more refined concept than whether MSL 4.0.0 is backwards compatible with MSL 3.2.3, since it depends on what features of MSL 3.2.3 were used, and we can actually check that.

    Sorry, I don't get this. MSL 4.0.0 as whole is not backwards compatible with MSL 3.2.3. Of course if you don't use SI units you may have models using MSL 3.2.3 that can actually also run with MSL 4.0.0 without any change, but that doesn't make MSL 4.0.0 backwards compatible with MSL 3.2.3.

    If at some point I decide do migrate a certain user library to MSL 4.0.0, I need to migrate all its dependencies to it as well. Counting on the fact that the specific models I'm using and all their dependencies can work without any conversions (by sheer luck) doesn't seem to me something that I should rely upon. BTW, I could add some more models to my user library that require new features of MSL 4.0.0 that are not backwards-compatible, and getting an error only then would be a bit odd.

  12. HansOlsson commented on Jun 27, 2022

    @HansOlsson
    Collaborator

    Only 6 is real backward compatibility

    This is really too strict.

    Yes, the point is that there are trade-offs.

    and in practice almost every release is at 4 or lower - and thus users need to verify that it is compatible.

    Sure, I guess everybody understands that. The question is: "can I compile the model or not?". Maybe for the purposes of this discussion we could stick to that as definition of backwards compatibility.

    That's sort of the relevant question (with the caveat - will it give about the same result?) - but it is depends on the model as seen below.

    For conversion in general and convertMessage in particular we see that we need a more refined concept than whether MSL 4.0.0 is backwards compatible with MSL 3.2.3, since it depends on what features of MSL 3.2.3 were used, and we can actually check that.

    Sorry, I don't get this. MSL 4.0.0 as whole is not backwards compatible with MSL 3.2.3. Of course if you don't use SI units you may have models using MSL 3.2.3 that can actually also run with MSL 4.0.0 without any change, but that doesn't make MSL 4.0.0 backwards compatible with MSL 3.2.3.

    True, but what is more interesting case is that if your library uses MSL 3.2.3 it is not guaranteed that it can be automatically converted to MSL 4.0.0.

    If you used a few specific models (tests and internal models) e.g., Modelica.Fluid.Fittings.BaseClasses.QuadraticTurbulent.TestWallFriction the automatic conversion didn't work (well, it generated a message saying that it didn't). I assume no-one used them so they don't care - so we shouldn't be afraid to remove them; and similarly correcting the behavior even if that strictly breaks some models.

  13. casella commented on Jun 27, 2022

    @casella
    CollaboratorAuthor

    True, but what is more interesting case is that if your library uses MSL 3.2.3 it is not guaranteed that it can be automatically converted to MSL 4.0.0.

    If you used a few specific models (tests and internal models) e.g., Modelica.Fluid.Fittings.BaseClasses.QuadraticTurbulent.TestWallFriction the automatic conversion didn't work (well, it generated a message saying that it didn't). I assume no-one used them so they don't care - so we shouldn't be afraid to remove them; and similarly correcting the behavior even if that strictly breaks some models.

    When we decided to start MSL 4.0.0, the agreement was that we were OK with it under the assumption that automatic conversion would always work.

    If there are some exception to this rule regarding some test models, I would not to be worried; I don't think this is enough cause to say that we don't have automatic conversions.

    This has already been the case in the past with MSL 3.2.x backwards compatibility - there were a few exceptions, but as long as they were clearly documented, it was ok to declare newer versions as backwards compatible.

    Apparently, package management is not an exact science 😄

  14. HansOlsson commented on Mar 26, 2026

    @HansOlsson
    Collaborator

    See also the proposed version compatibility for MSL in modelica/ModelicaStandardLibrary#4698

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    clarificationSpecification of feature is unclear, but not incorrect

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions