Dave Thomas <Dave / PragmaticProgrammer.com> wrote: > >Yasushi Shoji <yashi / yashi.com> writes: > > > I realized the other day, when I tried to create class Version, that > > creating class Version which is generic enough to satisfy all the > > version scheme we have is very close to impossible. > > > > So I ended up with a class for Ruby versioning scheme with only what I > > need. constructor for a String, an Array, and Integers, #major, > > #minor, #teeny, and #<=> for Comparable. > > > any one has better idea? > >Not better, but perhaps additional. To a big extent with versioning it is better to be consistent than allow arbitrariness. The x.y.z notation is standard enough and works well enough to settle on. In that spirit should the idea that "odd minor versions are development" be given official substance? >Should a library's version information also be used to record >dependencies? Yes. > module Wombat > > Version "1.2.3" { > requires "marsupial" # no qualifier means any >version > requires "eucalyptus" :> "1.0" # at least this version > requires "sleep" :> "0.9" :< "1.5" # in range > requires "skippy" "5.4" # exact (same as :== "5.4") > } > > end > Note that the "at least" will be the most common. "In range" will be inefficient to implement. Is it really needed in general? What happens if Foo needs Bar, and both support intersecting ranges? However if someone specifies a version, it may make sense to by default not let them cross major versions. So perhaps a range of major versions make sense? > >We can query a module's version information from the outside > > Wombat.version #=> Version(1.2.3) > > Wombat.requirements.each {|req| ... > >and so on. I _think_ this can all be implemented at the Ruby level. > IMHO it would be extremely good to have a standard naming scheme so that multiple versions can co-exist in the same file-system. I think it is acceptable for such a naming scheme to assume that you are not limited by the old 8.3 rule. > >Looks scary, but it puts all the dependency stuff in one place, which >will greatly help in the grand unified library project (gulp). > Yup. Debian has it. Perl does not. Having used both I think it is important to have ways to track versioning requirements beyond just, "Upgrade everything and hope that the current versions play well together." Cheers, Ben _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com