In article <20050204150754.GA2662 / ensemble.local>, Sam Roberts <sroberts / uniserve.com> writes: > Maybe you haven't seen how unuseful the behaviour of == is because you > use it inside resolv.rb, and all names you see are absolute? > > Outside of resolv.rb (including input/output values of the common Resolv > class methods) names are non-absolute strings, and the DNS Name objects > can't be compared to them. It is caused by the absolute/relative difference is not cared outside of a resolver. The unusefulness comes from you need supply omitted absoluteness information for conversion from string to name, and Resolv::DNS::Name#to_s omit the absoluteness information. I believe Resolv::DNS::Name's absoluteness sensitive behavior prevents a kind of bugs. So I don't want to introduce absoluteness insensitive behavour such as your comparison. Adding some conversion methods may be a solution. I don't have concrete idea, though. > The code I posted included the method #lt?, you could include it as is, > or change its name. For consistency with #eql?, you may want to make it > NOT convert its argument from String to Name, or you may want to change > both to allow comparison to String. I don't think lt? is a good name. Because it may mean comparison in lexical order and other orders. -- Tanaka Akira