From: Rick DeNatale Date: 2006-08-04T04:22:27+09:00 Subject: Re: Next Major Version (was Re: Different semantics of Proc and method call -- bug or feature?) On 8/3/06, James Edward Gray II wrote: > On Aug 3, 2006, at 10:26 AM, Rick DeNatale wrote: > > >> The version letters will be stay in one letter each, so that 1.a will > >> be more likely than 1.10. > > I hesitate to ask YOU this, but are you really sure you want to go > > that way. > > > > Almost every software package I've run across keeps each level of the > > version "number" as a number, so 1.10 would be much more in line with > > standard practice than 1.a > > But it can't be compared properly using Ruby operators: > > >> "1.8.5" < "1.10.0" > => false Ah, but doing the comparison correctly in Ruby isn't that hard, in a few minutes I came up with: irb(main):023:0> class Version irb(main):024:1> include Comparable irb(main):025:1> irb(main):026:1* def initialize(string) irb(main):027:2> @value = string.split('.').collect { | i | i.to_i } irb(main):028:2> end irb(main):029:1> irb(main):030:1* def <=>(another) irb(main):031:2> @value <=> another.to_ary irb(main):032:2> end irb(main):033:1> irb(main):034:1* def to_ary irb(main):035:2> @value irb(main):036:2> end irb(main):037:1> end => nil irb(main):038:0> Version.new("1.8.5") => # irb(main):039:0> Version.new("1.8.5") < Version.new("1.10.0") => true I'd strongly suggest, that it's much better for Ruby if it tries to stay in line as much as possible with how things are done in the open source community. There's a lot of software outside of Ruby which depends on having versions being a tuple of numbers. Since Ruby makes it easy to meet things like that more than halfway, I think that it's better to do so. -- Rick DeNatale IPMS/USA Region 12 Coordinator http://ipmsr12.denhaven2.com/ Visit the Project Mercury Wiki Site http://www.mercuryspacecraft.com/