On Thu, 19 Feb 2009, pugs-comm...@feather.perl6.nl wrote:
Author: autarch
Date: 2009-02-19 19:14:48 +0100 (Thu, 19 Feb 2009)
New Revision: 25445

Modified:
  docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
This is a very drastic revision (hopefully this won't turn into a revert war ;)
	I hope not.  My plan is to argue about them on the mailing list, and 
hope that we'll come to some reasonable consensus :).
	I'd also like to say a mea culpa -- I had a commit ready to go before 
I asked Dave/autarch to make the appropriate changes, but I forgot to commit 
it :).  So some of the stupid things are things I should've done myself.
	I've noticed that a number of my objections were scattered various 
places throughout my reply, so I'm taking the liberty of grouping a few things 
together by argument :).
Formatters
==========

removed all references to ...
[snip]
Format specifiers - this could come from locales (CLDR specifies this)
or strftime, but again, it's more complicated than is needed
[snip]
Added iso8601 output for every role, and made that the
stringification. ISO8601 is unambiguous world-wide, easy to read, and
easy to output.
	I'm quite keen to have something here as a formatter.  I was hoping 
for CLDR, but I'd be happy with even a subset of CLDR that does what we want. 
Or even, failing that, with the ISO8601 part being implemented as a formatter.
+        # These always return the long English names
+        method month-name () returns Str; # "January"
+        method day-name () returns Str;   # "Tuesday"
	This is one reason I was wanting a formatter -- then we wouldn't need 
all these functions.  People could just go $time.format('MMMM') and get what 
they want.  Like I said though, the core might be better off with a subset of 
CLDR that does month name, day name, and the ISO8601 stringification.
+        # returns the date formatted in ISO8601 style - 2008-01-25
+       method iso8601 () returns Str
+            { [ self.year, self.month, self.date ].join('-') };
	I was hoping we could leave this also to a formatter that would be 
called upon by infix:{'~'}.

DateTime math
=============

removed all references to ...
[snip]
Any sort of date or time math
[snip]
Got rid of all mutating operators on everything. The built-ins should
be immutable for simplicity.
	Date/time math was something else I'm also very keen to have.  The 
other built-ins play happily with operators -- why wouldn't the temporal ones? 
By "mutating operators", do you mean "multi operators"?  If so, I urge you to:
-       Read my comments lower down in this e-mail about the infix:<~>
        operator, which will give you some appropriate background
-       See http://perlcabal.org/syn/S03.html#Smart_matching which appears to
        me to make the ~~ operator do all kinds of things (although I could be
        wrong here).  Actually, the point I'm making is much more easily seen
        by finding "=head1 Smart matching" in
        http://svn.pugscode.org/pugs/docs/Perl6/Spec/S03-operators.pod

Other things
============

Here's the changes in summary:

removed all references to ...

Locales, including eras, which come from a locale - this is a vast and 
complicated domain

Alternate calendars - also vast and complicated

String parsing of any sort - ditto, see the pattern here? ;)

Comparing dates or times to durations - this just doesn't make
sense. Is 2009-02-23 greater or less than 5 days?
        I agree, this was stupid :).

Renamed Temporal::Instant to Temporal::DateTime
	Hmm.  We had some mailing list discussion about this, and agreed on 
Instant.  I'd like to see your reasons in favour of DateTime.
	One of my (unmentioned) reasons for not calling it DateTime is that I 
was expecting the CPAN module to be called DateTime, and didn't want to stamp 
on any names.  But that's not as high a priority.
Got rid of Temporal::Subsecond and just made Temporal::Time allow for
sub-second resolutions. Not sure if this is best done with an
$.attosecond attribute or as a decimal number.
        See other discussions on the mailing list.

Renamed Temporal::Timezone to Temporal::TimeZone::Observance. The
latter is a simple thing which represents the offset, isdst flag, and
short name for a given local time. This information should be
available on all supported platforms. TimeZones themselves are
complicated and very much platform-dependent. Better to leave this as
a separate CPAN6 distro.
	Bewdy mate!  :)  [to translate that into non-Australian, it's 
"Beauty, mate", or "I'm pleased, friend"].
Added numification overloading for Temporal::DateTime, which gives us
comparison for free.
        Cool :).

In case I didn't say this elsewhere, I'd be happy to see localtime and gmtime disappear in favour of other temporal constructors. And surely time() could be merged in as well?
+        method infix:{'~'} return Str { self.iso8601 };
	Also, while I may be wrong, my reading of S13 says that operator 
overloading is not attached to an object (although maybe it's allowed to be 
defined in it.  That means that instead of
        method infix:{'~'} return Str { self.iso8601 };

        ...you'd need to write one of:

        Temporal::Date multi sub infix:{'~'}(Temporal::Date $self, 
Temporal::Date $other)
        multi sub infix:{'~'}(Temporal::Date $self, Temporal::Date $other --> 
Temporal::Date)

Note also that I've been quite sloppy in not declaring return values on a lot of these functions; if you'd like to fix that, feel free. Oh, and it may also be that the first of those above should have the multi before the Temporal::Date.
+role   Temporal::DateTime {
+        has Temporal::Date $!date handles <year month day day-of-week>;
	Can't do this, I think; this would require an instance of 
Temporal::Date, which is a role and can't be instantiated.  That's why I was 
using "does" instead.  I don't know what the alternative is, but I'll leave 
that to you :).
+        has Temporal::Time $!time handles <hour minute second 
fractional-second>;
+        has Temporal::TimeZone::Observance $!timezone handles <offset isdst>;
        Ditto :).

        HTH,


---------------------------------------------------------------------
| 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