Alex headshot

AlBlue’s Blog

Macs, Modularity and More

JSR294 Fantasy Version Series - Roman Numerals

2009 Eclipse Osgi

To paraphrase Mark Twain, “The reports of JSR 294's death are greatly exaggerated.” Alex Buckley confirmed that JSR 294 is alive and well, and automated bureaucratic processes were to blame for the reported inactivation. Or, as Dave Savage would have it, #jsr294isUndead.

With that in mind, and in the anticipation of the new JSR 294 EDR due RSN, I thought I'd take the time to explore a few fantasy version schemes which will all be possible under the new implementation. The first in the series is Roman Numerals. (The next in the series is now available.)

Roman Numerals are a way of encoding numbers with a handful of characters, with the following meaning:

  • M 1000
  • D 500
  • C 100
  • L 50
  • X 10
  • V 5
  • I 1

Conventionally, a maximum of 3 repeated characters can be used and a smaller number prior to a bigger number results in subtraction of that smaller number. So VIII is 8, whilst IX is 9. Technically, IIX is also 8, but if it can be written in non-subtraction form, then it should be. Various on-line converters exist to aid you with the encoding.

This allows us to define a version system which uses Roman Numerals as their encoding, with MUST, SHOULD etc. taken from RFC 2119. Note that because Roman Numerals have no decimal point, there are no sub-version ranges in this specification.

Specification

An version number is represented as a construction from the following regular expression: “(MDCLXVI)+”. Clients SHOULD only generate valid Roman Numerals; parsers MUST accept invalid constructions as well. For example, IM is a degenerate form of CMXCIX, which is CLEARLY easier to understand.

Case is significant; encodings exist where i has a different meaning than I so clients MUST use the correct capitalisation. In the absence of systems without capitalisation (where the shift key is broken, or if it's known that it comes from mainframe-based systems), then the server MAY assume that the it was supposed to be in upper case.

Versions are compared with their decoded Roman Numeral versions. Version numbers MUST be positive, non-zero integers, since there is no way of representing zero (constructs like IIIIIV are disallowed as above). Following that each letter may be repeated a maximum of three times, the longest version number that can be represented is 3888 (MMMDCCCLXXXVIII) although the largest value is represented at 3999 (MMMCMXCIX) without going into the upper region (not defined or used here).

We may use this to define module requirements as in the following non-normative example:

module Nodule @ I {
	requires Copyright @ MMIX,
	provides Fox @ MCMI,
	permits Henry @ VIII,
}

Update: The next in the series, Linux is now available.