[Rbrainz-users] InvalidDate questions
nigel at maven-group.org
Mon Jul 9 07:05:10 EDT 2007
Nigel Graham wrote:
> Philipp Wolfer wrote:
>>> Why do you think it needs a different eql? The one in range wil work
>>> both incomplete dates and ranges and since we treat IncompleDate as a
>>> special kind of Range I don't see a problem. What could be confusing
>>> though is if we have 2 different value comparisons. (== and eql?).
>> No, I just wondered why we need to re-implement eql? since it is
>> already defined in Range. See
> Oh thats what you mean. Actually my implementation accepts both Ranges
> and scalars (meaning the value types used for the endpoints of the
> When it gets a Range it acts just like the existing implementation in
> Range but when it gets a scalar like 1 it treats it as a range with a
> length of 1.
Further reading and testing just showed me that the above statement
isn't entirely correct. First of my implementation of eql? never made it
into Range since the eql? defined in Range tok precedent over the one I
defined in the module. So I have now fixed this.
Second my implementation when comparing two Ranges doesn't do the same
as the builtin one. The builtin eql? considers 1..12 and 1...13 as two
different ranges. Mine considers them equal since they span the same values.
>> But as I see now the difference is that the original Range only
>> accepts other Range objects for comparison while you implementation
>> allows other types as well. I hope we don't break anything in other's
>> people code when we overwrite eql?
> Rbrainz-users mailing list
> Rbrainz-users at rubyforge.org
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 163 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/rbrainz-users/attachments/20070709/b0b0640c/attachment.vcf
More information about the Rbrainz-users