On Wed, 9 Jun 2004, Matt Sisk wrote: > I understand that division can be expressed as multiplication, but is > there any particular reason why division (/) is not overloaded but > multiplication is for durations? Then you could say: > > $midpoint = ($dt2 - $dt1)/2; > > rather than > > $midpoint = ($dt2 - $dt1) * 0.5; > > Small thing. Just curious.
Thinking about this more, I'm considering maybe just requiring that multiplication be passed an integer, because if you do this: my $dur = DateTime::Duration->new( months => 1, days => 1, minutes => 1 ); $dur->multiple(.5); print DateTime->now->add_duration($dur)->datetime; The results are kind of weird, and certainly not what anyone would expect. -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/
