#1456 Version/Depend API

vkuzkokov Wed 23 Mar 2011

I'm not sure whether anyone used subj for production purposes. I found at least one quite common use-case missing for Depend: exclusive ranges.

E.g. 1.0.58-<1.1 or 1.0.58-1.0.inf means 1.0 with build number 58 or greater.

I prefer something like the latter syntax as it better describes the intention.

Also, sys::Depend docs have

<version>       := <digit> ["." <digit>]*
<digit>         := "0" - "9"

I think it's

<version>       := <number> ["." <number>]*
<number>        := "0" | "1" - "9" ["0" - "9"]*

brian Wed 23 Mar 2011

I fixed the docs - thanks.

E.g. 1.0.58-<1.1 or 1.0.58-1.0.inf means 1.0 with build number 58 or greater.

That particular scenario can be specified as 1.0.58-1.0

fansh> d := Depend("foo 1.0.58-1.0")
foo 1.0.58-1.0
fansh> d.match(Version("1.0.57"))
false
fansh> d.match(Version("1.0.58"))
true
fansh> d.match(Version("1.0.99"))
true

I don't particularly love current syntax and I doubt it is used much at all yet. So if there was a desire to change dependency syntax, now would be the time. I can't remember where current syntax came come (maybe some mid-design version of Java modules).

qualidafial Thu 24 Mar 2011

How about a range syntax using a DSL?

Depend<|foo 1.0.58..1.0|>
Depend<|foo 1.0.58..<2.0|>

brian Thu 24 Mar 2011

How about a range syntax using a DSL?

Interesting idea, but in this case Depend should never contain any chars that would require escaping so not sure it buys us anything:

Depend<|foo 1.0.58..1.0|>
Depend("foo 1.0.58..1.0")

Same length too. I guess you could optimize it a bit to check syntax and create a hidden field to make it a bit more efficient. But doesn't seem worth that much trouble.

qualidafial Fri 25 Mar 2011

Using a dsl buys you compile time checking of the dependency string, however since we are compiling and building all at once it probably doesn't matter

Login or Signup to reply.