Skip to content

Commit

Permalink
Can't just make those subtypes non-lexical in Temporal or they leak o…
Browse files Browse the repository at this point in the history
…ut and break spectest; just comment out the type annotations instead.
  • Loading branch information
jnthn committed Aug 21, 2009
1 parent 44ab31b commit b545108
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/setting/Temporal.pm
Expand Up @@ -2,17 +2,18 @@
#enum dayOfWeek <Sunday Monday Tuesday Wednesday Thursday Friday Saturday>;
#enum DayOfWeek <Sunday Monday Tuesday Wednesday Thursday Friday Saturday>;

subset Month of Int where { 1 <= $^a <= 12 };
subset Day of Int where { 1 <= $^a <= 31 };
subset DayOfWeek of Int where { 1 <= $^a <= 7 };
subset Hour of Int where { 0 <= $^a <= 23 };
subset Minute of Int where { 0 <= $^a <= 59 };
subset Second of Num where { 0 <= $^a <= 60 };
my subset Month of Int where { 1 <= $^a <= 12 };
my subset Day of Int where { 1 <= $^a <= 31 };
my subset DayOfWeek of Int where { 1 <= $^a <= 7 };
my subset Hour of Int where { 0 <= $^a <= 23 };
my subset Minute of Int where { 0 <= $^a <= 59 };
my subset Second of Num where { 0 <= $^a <= 60 };

role Temporal::Date {
## XXX Rakudo bug - can not use lexical subset types in a class yet
has Int $.year;
has Month $.month = 1;
has Day $.day = 1;
has #`(Month) $.month = 1;
has #`(Day) $.day = 1;

method day-of-week { # returns DayOfWeek {
my ( $a, $y, $m, $jd ); # algorithm from Claus Tøndering
Expand Down Expand Up @@ -55,9 +56,10 @@ role Temporal::Date {
}

role Temporal::Time {
has Hour $.hour = 0;
has Minute $.minute = 0;
has Second $.second = 0;
## XXX Rakudo bug - can not use lexical subset types in a class yet
has #`(Hour) $.hour = 0;
has #`(Minute) $.minute = 0;
has #`(Second) $.second = 0;

our Str method iso8601 {
given self {
Expand Down

0 comments on commit b545108

Please sign in to comment.