Initializing help system before first use

Package version management


Type: Programming
Rating: 3 (intermediate)
Description: A package can define annotations to overwrite Mosel's default version compatibility rules, specifying minimum required versions, initial versions, or deprecation versions.
File(s): versionedpkg_v1.mos (library, compile separately), versionedpkg_v2.mos (library, compile separately), versionedpkg.mos (library, compile separately), versionedpkg_test.mos

versionedpkg_v1.mos
(!******************************************
   Mosel Example Problems
   ======================

   File versionedpkg_v1.mos
   ````````````````````````
   Example package with versioning annotations.
   -- Initial version --

   Compile into versionpkg.bim via:
     mosel comp versionedpkg_v1.mos -o versionedpkg.bim

   Then compile versionpkg_test.mos:
     mosel comp versionpkg_test.mos

   Display minimum required package version stored in the model BIM file:
     mosel exam -h versionpkg_test.bim 
   (Optionally, generate the versionedpkg.bim from another 
   package source version and re-display the output of the 'exam' command.)

   Run the model with the current package version on the BIM search path
   (this may be different from the package version used for compilation):
      mosel run versionpkg_test.bim

   (c) 2023 Fair Isaac Corporation
       author: S. Heipcke, Jun. 2023
*******************************************!)
package versionedpkg
 version 1.0

!@mc.version.since 1.0.0
 public procedure showpkgver
   writeln("Using version ", getparam("model_version"), " of package 'versionedpkg'.")
 end-procedure
 
end-package

versionedpkg_v2.mos
(!******************************************
   Mosel Example Problems
   ======================

   File versionedpkg_v2.mos
   ````````````````````````
   Example package with versioning annotations.
   -- Second version --

   Compile into versionpkg.bim via:
     mosel comp versionedpkg_v2.mos -o versionedpkg.bim

   Then run versionpkg_test.mos (with or without recompilation)

   (c) 2023 Fair Isaac Corporation
       author: S. Heipcke, Jun. 2023
*******************************************!)
package versionedpkg
 version 2.0
!@mc.version.compatible 1.0.0

!@mc.version.since 2.0
 public procedure myproc2
  writeln("Output from proc2")
 end-procedure

!@mc.version.since 2.0
 public procedure myoldproc
  writeln("This subroutine is deprecated with v3.0.1")
 end-procedure

!@mc.version.since 1.0.0
 public procedure showpkgver
   writeln("Using version ", getparam("model_version"), " of package 'versionedpkg'.")
 end-procedure
 
end-package

versionedpkg.mos
(!******************************************
   Mosel Example Problems
   ======================

   File versionedpkg.mos
   `````````````````````
   Example package with versioning and
   deprecation annotations.
   -- Third version --

   Compile into versionpkg.bim
 
   Then run versionpkg_test.mos (with or without recompilation)

   (c) 2023 Fair Isaac Corporation
       author: S. Heipcke, Jun. 2023
*******************************************!)
package versionedpkg
 version 3.1
!@mc.version.compatible 1.0.0
!@mc.version.atleast 3.0

!@mc.version.since 2.0
 public procedure myproc2
  writeln("Output from proc2")
 end-procedure

!@mc.version.since 3.0.2
 public procedure myproc3
  writeln("Output from proc3")
 end-procedure

!@mc.version.deprecated 3.0.1
!@mc.version.since 2.0
 public procedure myoldproc
  writeln("This subroutine is deprecated with v3.0.1")
 end-procedure

! Unversioned subroutine (defaults to current package version)
 public procedure mynewproc
  writeln("Output from newproc")
 end-procedure

!@mc.version.since 1.0.0
 public procedure showpkgver
   writeln("Using version ", getparam("model_version"), " of package 'versionedpkg'.")
 end-procedure
 
end-package

versionedpkg_test.mos
(!******************************************************
   Mosel Example Problems
   ======================

   File versionedpkg_test.mos
   ``````````````````````````
   Using the package 'versionedpkg'

   *** Compile one version of versionedpkg[_v*].mos into versionedpkg.bim
       before running this model ****

   Display minimum required package version stored in the model BIM file:
     mosel exam -h versionpkg_test.bim 
   (Optionally, generate the versionedpkg.bim from another 
   package source version and re-display the output of the 'exam' command.)

   Run the model with the current package version on the BIM search path
   (this may be different from the package version used for compilation):
      mosel run versionpkg_test.bim

   (c) 2023 Fair Isaac Corporation 
       author: S. Heipcke, Jun. 2023
*******************************************************!)
model "test package versioning"
 uses "versionedpkg"

 writeln("Start test model run")

!!! Uncomment one or several of the following subroutine calls 
!!! to explore their effect on the required package version number

! Subroutine requiring package version 2.0
!  myproc2

! Subroutine requiring package version 3.0.2
!  myproc3
! Subroutine deprecated starting from package version 3.0.1
! A warning is displayed if 'myproc3' or 'newproc' is also called
  myoldproc

! Unversioned subroutine (=defaults to current package version)
  mynewproc

 showpkgver

end-model

© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.