develooper Front page | perl.datetime | Postings from April 2017

Re: Subclassing DateTime?

Thread Previous | Thread Next
From:
Zefram
Date:
April 30, 2017 00:09
Subject:
Re: Subclassing DateTime?
Message ID:
20170430000858.GR6765@fysh.org
Thomas (HFM) Wyant wrote:
>It seems to me that in at least some such cases subclassing
>DateTime would be a better alternative.

You've run into the terrible factoring of the DateTime system.  All three
of the modules you named already suffer from it, but subclassing DateTime
would make things worse.  For subclassing to be the right answer,
the objects of your classes would have to be everything that DateTime
objects are, plus something that you're adding.  But one of the things
that DateTime objects are is Gregorian, which your objects are not.

-zefram

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About