Ordering of versions

cowwoc cowwoc at bbs.darktech.org
Mon Nov 14 10:20:37 PST 2011


On 14/11/2011 11:17 AM, Neil Bartlett [via jigsaw-dev] wrote:
> Brian,
>
> You're right that a module need not be compared against other modules
> for versioning purposes. But for this idea to work, each module would
> have to provide its own implementation of a Version class, which has a
> number of very challenging implications. First, where would that class
> be loaded from?
>
> It could not be loaded from the module itself because it is needed at
> build, install and resolve time, i.e. well before any class from the
> module could possibly be executed. So it would have to be loaded via
> some means external to or alongside the module system.

     Borrowing an analogy from Maven, you'd load the pom.xml file 
separately from the main artifact. The pom.xml provides you with the 
module metadata (version comparison in this case) and if you decide to 
proceed to fetch the rest of the module.


> Then how would
> the implementation of the Version itself be evolved? Suppose I found a
> bug in my compareTo() method, how would I provide a fix to the bug?
> Potentially each version of a module would end up with its own version
> *scheme*, which would be nonsense.

     Two solutions come to mind:

1) Treat the version comparator as a first-class citizen. There is one 
comparator across all versions of a module and developers may replace it 
as needed.
2) Each version has its own comparator. The first version that matches 
the desired version-range gets used. In my opinion, the ability to 
specify arbitrary version schemes is worth the risk of asymmetric 
results similar to Objects.equals().

> The whole idea reminds me of the "module resolution scripts" that were
> suggested back in the days of JSR 277. They would have been a disaster
> as well, not least because they would have made it impossible to
> statically reason about the dependency graph.

     You could mandate that the Comparator operate deterministically, 
and then cache the results.

Gili


--
View this message in context: http://jigsaw-dev.1059479.n5.nabble.com/Ordering-of-versions-tp4970773p4991929.html
Sent from the jigsaw-dev mailing list archive at Nabble.com.


More information about the jigsaw-dev mailing list