Darren Duncan wrote on 2009 Feb 17:
Timothy S. Nelson wrote:
Agreed, and that's kinda what I'm doing. But I still think there's room for improvement. I'll try and design an API that does what DateTime does, but:

Talking about dates and times, I have some suggestions.

Second of all, I think a more generic term than DateTime should be used to name an object that represents an instant in time; for example I suggest calling it "Instant". The name "Instant" fits in a lot better in the company of other generic sounding temporal data types like "Duration" etc. Then, you can say that things like DateTime, Date, Time, etc are subtypes of Instant.

See also http://search.cpan.org/dist/Muldis-D/lib/Muldis/D/Ext/Temporal.pod where I've specced out such matters, and that illustrates something I recommend for you. My Instant types very closely resemble both the Perl DateTime library as well as the SQL temporal types, which are actually very similar, though I've generalized it a bit. This spec explicitly does not support time zones (it has UTC or floating, that's it) and it doesn't include conversions with strings, but it has the foundation on which such could be built. And yours doesn't have to be the same of course.

As a follow-up to my initial 2009 Feb 17 post that first suggested the name "Instant" and cited my Muldis D language as a specced example ...

I'll start off by saying that the evolving design of Muldis D in general seeks a happy medium between the evolving design of Perl 6 and the established design of SQL, while being guided especially by The Third Manifesto's abstract concept of a "D" language. Over time, a significant portion of the input I've been making into the design of Perl 6 has been based on my prior work hashing out the same ideas in Muldis D, and similarly, ideas hashed out for Perl 6 have been attracting me to continue changing Muldis D to more closely resemble Perl 6. It's the whirlpool attractor development model but on a multi-language scale.

And so, if anyone is interested in this tangent, I just released Muldis D version 0.60.0 on CPAN, whose feature change is an evolution of the language's temporal types and operators. The types named 'Instant' and 'Duration' now are in the language core rather than an optional extension, and are defined to mean exactly what the same-named types of Perl 6 do (see S02), a point on the TAI timeline measured in seconds, and a difference between 2 of those. I also kept my prior meanings, defined in terms of YMDHIS, as disjoint types UTCInstant and UTCDuration etc, in a language extension which would correspond to a CPAN module like DateTime. The TAI seconds and UTC YMDHIS are kept as disjoint types rather than being representations for the same types because there is no fixed rate of conversion between the two representations in general, with UTC leap seconds of the future being unknown; instead there are mapping functions that people can use between the types, that apply what we known sans future leap seconds, and so aren't expected to be consistent over time. The most relevant 2 files in the spec for this change are http://search.cpan.org/dist/Muldis-D/lib/Muldis/D/Core/Types.pod and http://search.cpan.org/dist/Muldis-D/lib/Muldis/D/Ext/Temporal.pod . So at this point, practically every Muldis D core type directly maps to a Perl 6 core type, and in most cases the types have the same names and semantics.

-- Darren Duncan

Reply via email to