On Thu, 19 Feb 2009, Darren Duncan wrote:
As per my previous post, I recommend having both, like this:
role Instant {
has Int $.year;
...
has Rat $.second;
}
role DateTime is Instant where defined $.year ... and defined $.second;
role Date is Instant where defined $.year ... and defined $.day;
role Time is Instant where defined $.hour ... and defined $.second;
So something like that. So Date and Time mean all Date|Time details, and
DateTime means all details of both. And Instant means any combination of
defined or not of said member attributes. And that's actually why I
advocated Instant as a name for that more-broad-than-DateTime thing.
Is there a way in which a class which does the Date role could change the
type $.year so it was "Int|Undef"?
I'd prefer to leave the notion of an incomplete Date(|Time|DateTime) out
of the core, because it makes everything more complicated.
If, OTOH, I couldn't make OnCPAN6::DateTime::Incomplete do the DateTime
interface, that'd be a good argument for changing the core interface.
-dave
/*============================================================
http://VegGuide.org http://blog.urth.org
Your guide to all that's veg House Absolute(ly Pointless)
============================================================*/