Ampersand
Ampersand copied to clipboard
Check for required Ampersand version
Like with dependency management system, I would like to specify the version (range) of the Ampersand compiler that works with my script. This allows to transfer projects and work together on code more easily.
Just to keep things simple, I suggest to add a switch, which then can also be set in the config yaml. As our versioning systems follows semantic versioning, we can parse the specified required version and let the compiler check if it matches that version (range).
The switch can be called something like ampersandVersion
To specify the required version (range) we can look how others have done this, e.g.:
- Haskell
- PHP composer
- NPM Maybe there’s a Haskell library to fit our needs?
First things first. Let’s implement a basic scenario first:
Exact version
ampersandVersion: 3.17.2
A specific minor release
ampersandVersion: 3.17.x (any 3.17 patch version) ampersandVersion: ^3.17.2 (>= 3.17.2, <3.18)
A specific major release
ampersandVersion: 3.x (any 3 minor version) ampersandVersion: ^3.17 (>= 3.17, < 4)
The important construct here, which I think we will appreciate is the carrot (^).