Just to clear up ahead of time, the consensus both here and on IRC seemed to be that in the core, we put a basic Temporal::Instant object that about powerful enough to deal with:
-       localtime/gmtime functionality
-       ctime, mtime, etc, in stat()
-       nanoseconds or whatever needed for (I think) alarm() and things

There is bucketloads of other functionality that could be implemented, and I've included a few of what I consider to be the most important (ie. make it work with operators), but we hope to leave most other stuff to CPAN. Even the naming of months, etc, can be left to CPAN. I've got a few hooks in there to deal with things that CPAN will want, but hopefully that's all.

On Thu, 19 Feb 2009, Martin D Kealey wrote:

On Wed, 18 Feb 2009, Timothy S. Nelson wrote:
I'll try and design an API that does what DateTime does, but:

1. Uses more variables, of which I expect the getters and setters to be
overridden.

Please let's NOT have setters on "time" objects.  They're a source of subtle
bugs in such client code AND having mutable objects means you can't use them
in otherwise pure code. (See the separate thread on immutability and
purity.)

Rather, let's have immutable time "values", and methods which return other
"values" where various computations (*1) have been applied. Provide
constructors which take the Y/M/D/h/m/s/dst_now/dst_rule tuple.

I followed the bits about the computations, and I think I see what you're saying about the constructor, but I don't know what you mean by 'immutable time "values"'. Could you expand on this a bit?

And please let's not have any implied "default" timezone. That's not to say
it has to be difficult or cumbersome, just explicit, perhaps something like
one of these:

 my &localtime = DateTime::Gregorian.localize( :host_default );
 my &localtime = DateTime::Gregorian.localize( :user_env );
 my &localtime = DateTime::Gregorian.localize( 
:http_client(%http_client_headers) );
 my &localtime = DateTime::Gregorian.localize( :db_server($odbc_handle) );
 my &gmtime    = DateTime::Gregorian.localize( :utc );
 my &swatch    = DateTime::Gregorian.localize( :tz('Europe/Geneva'), :no_dst );

Actually, I admit I'd love to get rid of gmtime and localtime altogether, while keeping the functionality. It seems to me that each is really a constructor with a different default timezone. Likewise I'd like to get rid of the time() function.

I snipped the comments about the complexity of calculations. I figure that for most purposes, people don't want the complexity, and as long as CPAN can supply something that implements the same role, I'm happy to leave it to them.

        :)


---------------------------------------------------------------------
| Name: Tim Nelson                 | Because the Creator is,        |
| E-mail: wayl...@wayland.id.au    | I am                           |
---------------------------------------------------------------------

----BEGIN GEEK CODE BLOCK----
Version 3.12
GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI++++ D G+ e++>++++ h! y-
-----END GEEK CODE BLOCK-----

Reply via email to