David Wheeler wrote:
But all I'm really interested in is whether the Duration object has a different duration than another object. IOW, are they identical to each other? The time that they're assigned to is not really relevant to me.

The time they're assigned to is *always* relevent for testing 'equality'. One month from now will be Feb 7th. 31 days from now will be Feb 7th. So from now, they're equal. However 1 month from Feb 7th will be March 7th whereas 31 days from Feb 7th will be March 10th.

Now, if perl had an '===' operator for 'identical' then we could use that to determine if both durations are *always* equal (so maybe we need to add a comparison function for it:

        1 second === 1000000000 nanoseconds
        1 year   === 12 months
        N units  === N units

I'm happy to work on a patch if people want to see this functionality?

Cheers!
Rick Measham

--
 "War is God's way of teaching Americans geography."
                             -- Ambrose Bierce

Reply via email to