Subject: | NOTDATE - DATE should stringify DATE and let Perl handle things. |
This is broken in 1.08, but that version is still missing from the list.
The subtract function currently dies when SWAP is set. SWAP is set when
perl encounters an expression like NOTDATE - DATE, where Perl doesn't
have a subtraction function overloaded for NOTDATE and DATE is a
Time::Piece object.
This seems to go against the Perl philosophy. If the `-' operator had
not been overloaded in Time::Piece, Perl would have automatically
stringified the DATE, then numified that string, and then attempted to
subtract that from NOTDATE.
This is important in the context of any subclass of Time::Piece which
attempts to change the stringify function to something that makes more
sense as a number. If Time::Piece allowed Perl to handle the
subtraction with the stringified object, then the subclass would not
need to override Time::Piece's subtraction function to enable
subtraction, assuming there were not other attributes of the subclass
that needed to be preserved across subtraction.
For an example of preserving Perl's standard stringify behavior in the
event that SWAP is set in the subtraction function, please see the
Time::Piece::Adaptive module on CPAN.