Skip to content

Commit 13ad58c

Browse files
authored
Miscellaneous p6/raku changes plus grammar tweaks
1 parent 0e1beb3 commit 13ad58c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

doc/Language/temporal.pod6

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ X<|Date and time functions>
88
99
Raku includes several classes that deal with temporal information: L<Date|/type/Date>, L<DateTime|/type/DateTime>, L<Instant|/type/Instant> and L<Duration|/type/Duration>. The three first are I<dateish>, so they mix in the L<Dateish|/type/Dateish> role, which defines all methods and properties that classes that deal with date should assume. It also includes a class hierarchy of exceptions rooted in L<X::Temporal|/type/X::Temporal>.
1010
11-
We will try to illustrate these classes in the next (somewhat extended) example, which can be used to process all files in a directory (by default C<.>) with a particular extension (by default C<.p6>) in a directory, sort them according to their age, and compute how many files have been created per month and how many were modified in certain periods expressed in ranges of months:
11+
We will try to illustrate these classes in the next (somewhat extended) example, which can be used to process all files in a directory (by default C<.>) with a particular extension (by default C<.raku>) in a directory, sort them according to their age, and compute how many files have been created per month and how many were modified in certain periods expressed in ranges of months:
1212
1313
=begin code
14-
sub MAIN( $path = ".", $extension = "p6" ) {
14+
sub MAIN( $path = ".", $extension = "raku" ) {
1515
my DateTime $right = DateTime.now;
1616
my %metadata;
1717
my %files-month;
@@ -58,11 +58,11 @@ sub MAIN( $path = ".", $extension = "p6" ) {
5858
5959
C<DateTime> is used in line 2 to contain the current date and time returned by L<C<now>|/routine/now>.
6060
61-
A CATCH phaser is declared in lines 7 to 11. Its main mission is to distinguish between C<DateTime>-related exceptions and other types. These kind of exception can arise from L<invalid formats|/type/X::Temporal::InvalidFormat> or L<timezone clashes|/type/X::DateTime::TimezoneClash>. Barring some corruption of the file attributes, both are impossible, but in any case they should be caught and separated from other types of exceptions.
61+
A CATCH phaser is declared in lines 7 to 11. Its main mission is to distinguish between C<DateTime>-related exceptions and other types. These kinds of exception can arise from L<invalid formats|/type/X::Temporal::InvalidFormat> or L<timezone clashes|/type/X::DateTime::TimezoneClash>. Barring some corruption of the file attributes, both are impossible, but in any case they should be caught and separated from other types of exceptions.
6262
63-
We use L<Instant|/type/Instant>s in lines 12-13 to represent the moment in which the files where accessed and modified. An Instant is measured in atomic seconds, and is a very low-level description of a time event; however, the L<Duration|/type/Duration> declared in line 14 represent the time transcurred among two different C<Instant>s, and we will be using it to represent the age.
63+
We use L<Instant|/type/Instant>s in lines 12-13 to represent the moment in which the files where accessed and modified. An Instant is measured in atomic seconds and is a very low-level description of a time event; however, the L<Duration|/type/Duration> declared in line 14 represents the time transcurred among two different C<Instant>s and we will be using it to represent the age.
6464
65-
For some variables we might be interested in dealing with them with some I<dateish> traits. C<$time-of-day> contains the time of the day the file was changed; C<changed> will return an Instant, but it is converted into a Date (which is C<Dateish> while C<Instant> is not) and then the time of day is extracted from that. C<$time-of-day> will have C< «Str+{Dateish}␤» > type.
65+
For some variables, we might be interested in dealing with them with some I<dateish> traits. C<$time-of-day> contains the time of the day the file was changed; C<changed> will return an Instant, but it is converted into a Date (which is C<Dateish> while C<Instant> is not) and then the time of day is extracted from that. C<$time-of-day> will have C< «Str+{Dateish}␤» > type.
6666
6767
X<|Date ranges>
6868
We will use the date in this variable to find out the period when the files were changed.

0 commit comments

Comments
 (0)