FAQ
Author: Darren_Duncan
Date: 2009-07-05 06:23:44 +0200 (Sun, 05 Jul 2009)
New Revision: 27414

Modified:
docs/Perl6/Spec/S02-bits.pod
docs/Perl6/Spec/S03-operators.pod
docs/Perl6/Spec/S04-control.pod
docs/Perl6/Spec/S05-regex.pod
docs/Perl6/Spec/S17-concurrency.pod
docs/Perl6/Spec/S28-special-names.pod
docs/Perl6/Spec/S32-setting-library/Abstraction.pod
docs/Perl6/Spec/S32-setting-library/Basics.pod
docs/Perl6/Spec/S32-setting-library/Callable.pod
docs/Perl6/Spec/S32-setting-library/Containers.pod
docs/Perl6/Spec/S32-setting-library/Exception.pod
docs/Perl6/Spec/S32-setting-library/IO.pod
docs/Perl6/Spec/S32-setting-library/Rules.pod
docs/Perl6/Spec/S32-setting-library/Str.pod
docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
P6 Synopsis : ws changes - all tabs to spaces

Modified: docs/Perl6/Spec/S02-bits.pod
===================================================================
--- docs/Perl6/Spec/S02-bits.pod 2009-07-05 03:43:57 UTC (rev 27413)
+++ docs/Perl6/Spec/S02-bits.pod 2009-07-05 04:23:44 UTC (rev 27414)
@@ -3092,11 +3092,11 @@

You may also put one or more decimal numbers inside the square brackets:

- "\c[13,10]" # CRLF
+ "\c[13,10]" # CRLF

Any single decimal number may omit the brackets:

- "\c8" # backspace
+ "\c8" # backspace

(Within a regex you may also use C<\C> to match a character that is
not the specified character.)

Modified: docs/Perl6/Spec/S03-operators.pod
===================================================================
--- docs/Perl6/Spec/S03-operators.pod 2009-07-05 03:43:57 UTC (rev 27413)
+++ docs/Perl6/Spec/S03-operators.pod 2009-07-05 04:23:44 UTC (rev 27414)
@@ -1062,8 +1062,8 @@

Note that these differ:

- 0 ..^ 10 # 0 .. 9
- 0 .. ^10 # 0 .. (0..9)
+ 0 ..^ 10 # 0 .. 9
+ 0 .. ^10 # 0 .. (0..9)

(It's not yet clear what the second one should mean, but whether it
succeeds or fails, it won't do what you want.)
@@ -1702,23 +1702,23 @@
operator must track internally). Demonstration of this falls to the
lot of the venerable Fibonacci sequence:

- 1, 1 ... { $^y + $^z } # 1,1,2,3,5,8...
- 1, 1 ... &infix:<+> # 1,1,2,3,5,8...
+ 1, 1 ... { $^y + $^z } # 1,1,2,3,5,8...
+ 1, 1 ... &infix:<+> # 1,1,2,3,5,8...

More typically the function is unary, in which case any extra values
in the list may be construed as human-readable documentation:

- 0,2,4 ... { $_ + 2 } # same as 1..*:by(2)
- <a b c> ... { .succ } # same as 'a'..*
+ 0,2,4 ... { $_ + 2 } # same as 1..*:by(2)
+ <a b c> ... { .succ } # same as 'a'..*

The function need not be monotonic, of course:

- 1 ... { -$_ } # 1, -1, 1, -1, 1, -1...
- False ... &prefix:<!> # False, True, False...
+ 1 ... { -$_ } # 1, -1, 1, -1, 1, -1...
+ False ... &prefix:<!> # False, True, False...

The function can be 0-ary as well:

- () ... { rand } # list of random numbers
+ () ... { rand } # list of random numbers

The function may also be slurpy (*-ary), in which case all the
preceding values are passed in (which means they must all be cached
@@ -1732,8 +1732,8 @@
If the right operand is C<*> (Whatever) and the sequence is obviously
arithmetic or geometric, the appropriate function is deduced:

- 1, 3, 5 ... * # odd numbers
- 1, 2, 4 ... * # powers of 2
+ 1, 3, 5 ... * # odd numbers
+ 1, 2, 4 ... * # powers of 2

Conjecture: other such patterns may be recognized in the future,
depending on which unrealistic benchmarks we want to run faster. C<:)>
@@ -3152,8 +3152,8 @@
List Seq Array
KeySet KeyBag KeyHash Hash
named values created with
- Class, Enum, or Role,
- or generic type binding Type
+ Class, Enum, or Role,
+ or generic type binding Type
Subst Regex
Char Cat Str
Int UInt etc. Num
@@ -3481,7 +3481,7 @@

it is more or less equivalent to:

- $x = [-]() unless defined $x; # 0 for [-]()
+ $x = [-]() unless defined $x; # 0 for [-]()
$x = $x - 1;

and $x ends up with -1 in it, as expected.
@@ -3490,7 +3490,7 @@

my Num $prod;
for @factors -> $f {
- $prod *= $f;
+ $prod *= $f;
}

While this may seem marginally useful in the scalar variable case,

Modified: docs/Perl6/Spec/S04-control.pod
===================================================================
--- docs/Perl6/Spec/S04-control.pod 2009-07-05 03:43:57 UTC (rev 27413)
+++ docs/Perl6/Spec/S04-control.pod 2009-07-05 04:23:44 UTC (rev 27414)
@@ -575,22 +575,22 @@
If you wish to return a closure from a function, you must use an
explicit prefix such as C<return> or C<sub> or C<< -> >>.

- sub f1
- {
- # lots of stuff ...
- { say "I'm a closure." }
- }
-
- my $x1= f1; # fall-off return is result of the say, not the closure.
-
- sub f2
- {
- # lots of stuff ...
- return { say "I'm a closure." }
- }
-
- my $x2= f2; # returns a Block object.
+ sub f1
+ {
+ # lots of stuff ...
+ { say "I'm a closure." }
+ }

+ my $x1= f1; # fall-off return is result of the say, not the closure.
+
+ sub f2
+ {
+ # lots of stuff ...
+ return { say "I'm a closure." }
+ }
+
+ my $x2= f2; # returns a Block object.
+
Use of a placeholder parameter in statement-level blocks triggers a
syntax error, because the parameter is not out front where it can be
seen. However, it's not an error when prefixed by a C<do>, or when
@@ -700,11 +700,11 @@
pseudo package. For example, Perl forces generic C<eq> to coerce to
string comparison, like this:

- proto infix:<eq> (Any $a, Any $b) { lift ~$a eq ~$b } # user's eq, user's ~
- multi infix:<eq> (Whatever, Any $b) { -> $a { lift $a eq $b } } # user's eq
- multi infix:<eq> (Any $a, Whatever) { -> $b { lift $a eq $b } } # user's eq
- multi infix:<eq> (&f:($), Any $b) { -> $a { lift f($a) eq $b } } # user's eq
- multi infix:<eq> (Str $a, Str $b) { !Str::leg($a, $b) } # primitive leg, primitive !
+ proto infix:<eq> (Any $a, Any $b) { lift ~$a eq ~$b } # user's eq, user's ~
+ multi infix:<eq> (Whatever, Any $b) { -> $a { lift $a eq $b } } # user's eq
+ multi infix:<eq> (Any $a, Whatever) { -> $b { lift $a eq $b } } # user's eq
+ multi infix:<eq> (&f:($), Any $b) { -> $a { lift f($a) eq $b } } # user's eq
+ multi infix:<eq> (Str $a, Str $b) { !Str::leg($a, $b) } # primitive leg, primitive !


Note that in each piece of lifted code there are references to
@@ -1270,9 +1270,9 @@
is taking, so if you mean 0 arguments, you must parenthesize the
argument list to force the block to appear after a term:

- if caller {...} # WRONG, parsed as caller({...})
- if caller() {...} # okay
- if (caller) {...} # okay
+ if caller {...} # WRONG, parsed as caller({...})
+ if caller() {...} # okay
+ if (caller) {...} # okay

Note that common idioms work as expected though:

@@ -1466,7 +1466,7 @@
possibly deferred.)

sub foo {
- # conceptual cloning happens to both blocks below
+ # conceptual cloning happens to both blocks below
my $x = 1;
my sub bar { print $x } # already conceptualy cloned, but can be lazily deferred
my &baz := { bar(); print $x }; # block is cloned immediately, forcing cloning of bar

Modified: docs/Perl6/Spec/S05-regex.pod
===================================================================
--- docs/Perl6/Spec/S05-regex.pod 2009-07-05 03:43:57 UTC (rev 27413)
+++ docs/Perl6/Spec/S05-regex.pod 2009-07-05 04:23:44 UTC (rev 27414)
@@ -725,8 +725,8 @@
what the following code is trying to parse:

token postfix:sym<[ ]> {
- :dba('array subscript')
- '[' ~ ']' <expression>
+ :dba('array subscript')
+ '[' ~ ']' <expression>
}

Then instead of getting a message like:
@@ -2463,18 +2463,18 @@

The currently defined methods are

- $/.from # the initial match position
- $/.to # the final match position
- $/.chars # $/.to - $/.from
- $/.orig # the original match string
- $/.Str # substr($/.orig, $/.from, $/.chars)
+ $/.from # the initial match position
+ $/.to # the final match position
+ $/.chars # $/.to - $/.from
+ $/.orig # the original match string
+ $/.Str # substr($/.orig, $/.from, $/.chars)
$/.ast # the abstract result associated with this node
$/.caps # sequential captures
$/.chunks # sequential tokenization

Within the regex the current match state C<$¢> also provides

- .pos # the current match position
+ .pos # the current match position

This last value may correspond to either C<$¢.from> or C<$¢.to> depending
on whether the match is proceeding in a forward or backward direction

Modified: docs/Perl6/Spec/S17-concurrency.pod
===================================================================
--- docs/Perl6/Spec/S17-concurrency.pod 2009-07-05 03:43:57 UTC (rev 27413)
+++ docs/Perl6/Spec/S17-concurrency.pod 2009-07-05 04:23:44 UTC (rev 27414)
@@ -37,11 +37,11 @@

The %*SIG variable contains a Hash of Proc::Signals::Signal.

-class Proc::Signals::Signal {
- has $exception; # This specifies what exception will be raised when this signal is received
- has $interrupt; # See siginterrupt(3)
- has $blocked; # Is this signal blocked? cf. sigprocmask
-}
+ class Proc::Signals::Signal {
+ has $exception; # This specifies what exception will be raised when this signal is received
+ has $interrupt; # See siginterrupt(3)
+ has $blocked; # Is this signal blocked? cf. sigprocmask
+ }

The @*SIGQUEUE array contains a queue of the signals that are blocked and queued.


Modified: docs/Perl6/Spec/S28-special-names.pod
===================================================================
--- docs/Perl6/Spec/S28-special-names.pod 2009-07-05 03:43:57 UTC (rev 27413)
+++ docs/Perl6/Spec/S28-special-names.pod 2009-07-05 04:23:44 UTC (rev 27414)
@@ -136,7 +136,7 @@

These are classes defined especially for the benefit of the Special Variables.

- class SoftwarePackage {
+ class SoftwarePackage {
has Str $name;
has Version $version;
}

Modified: docs/Perl6/Spec/S32-setting-library/Abstraction.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/Abstraction.pod 2009-07-05 03:43:57 UTC (rev 27413)
+++ docs/Perl6/Spec/S32-setting-library/Abstraction.pod 2009-07-05 04:23:44 UTC (rev 27414)
@@ -27,19 +27,19 @@

=head2 Abstraction

-role Abstraction {...}
+ role Abstraction {...}

=head1 Classes

-class Class does Abstraction {...}
+ class Class does Abstraction {...}

-class Role does Abstraction {...}
+ class Role does Abstraction {...}

-class Grammar does Abstraction {...}
+ class Grammar does Abstraction {...}

-class Module does Abstraction {...}
+ class Module does Abstraction {...}

-class Package does Abstraction {...}
+ class Package does Abstraction {...}

=head1 Additions


Modified: docs/Perl6/Spec/S32-setting-library/Basics.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/Basics.pod 2009-07-05 03:43:57 UTC (rev 27413)
+++ docs/Perl6/Spec/S32-setting-library/Basics.pod 2009-07-05 04:23:44 UTC (rev 27414)
@@ -34,7 +34,7 @@

The following are defined in the C<Object> role:

- role Object {
+ role Object {
our Bool multi method defined ($self:) is export {...}
our Bool multi method defined ($self: ::role ) is export {...}

@@ -100,7 +100,7 @@

The following are defined in the C<Any> role:

- role Any does Object does Pattern {
+ role Any does Object does Pattern {
our Bool multi sub eqv (Ordering @by, $a, $b) {...}
our Bool multi sub eqv (Ordering $by = &infix:<eqv>, $a, $b) {...}

@@ -194,7 +194,7 @@

=head2 Pattern

- role Pattern {
+ role Pattern {
method ACCEPTS($self:, $other) {...}
method REJECTS($self:, $other) {...}
}

Modified: docs/Perl6/Spec/S32-setting-library/Callable.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/Callable.pod 2009-07-05 03:43:57 UTC (rev 27413)
+++ docs/Perl6/Spec/S32-setting-library/Callable.pod 2009-07-05 04:23:44 UTC (rev 27414)
@@ -29,21 +29,21 @@

=head2 Callable

-role Callable {...}
+ role Callable {...}

The C<Callable> role implies the ability
to support C<< postcircumfix:<( )> >>.

=head2 Code

-# Base class for all executable objects
-role Code {
- method Signature signature() {...}
- method Code assuming(...) {...}
- method do() {...} # See L<S12/Introspection>
- method Bool defined {...}
- # XXX What does do() return? I mean, it's a "method body", but what's that?
-}
+ # Base class for all executable objects
+ role Code {
+ method Signature signature() {...}
+ method Code assuming(...) {...}
+ method do() {...} # See L<S12/Introspection>
+ method Bool defined {...}
+ # XXX What does do() return? I mean, it's a "method body", but what's that?
+ }

For C<Code>, the C<.defined> method returns whether a body has
been defined. A body consisting only of C<...>, C<!!!>, or C<???>
@@ -54,35 +54,35 @@

=head2 Block

-# Executable objects that have lexical scopes
-role Block does Code does Callable {
- method next() {...}
- method last() {...}
- method redo() {...}
- method leave() {...}
- method labels() {...}
- method as() {...} # See L<S12/Introspection> and L<S02/Value types>
-}
+ # Executable objects that have lexical scopes
+ role Block does Code does Callable {
+ method next() {...}
+ method last() {...}
+ method redo() {...}
+ method leave() {...}
+ method labels() {...}
+ method as() {...} # See L<S12/Introspection> and L<S02/Value types>
+ }

=head2 Signature

-# Function parameters (left-hand side of a binding)
-role Signature {...}
+ # Function parameters (left-hand side of a binding)
+ role Signature {...}

=head2 Capture

-# Function call arguments (right-hand side of a binding)
-role Capture does Positional does Associative {...}
+ # Function call arguments (right-hand side of a binding)
+ role Capture does Positional does Associative {...}

=head2 WrapHandle

-role WrapHandle {...}
+ role WrapHandle {...}

=head1 Classes

=head2 Routine

- class Routine does Block {
+ class Routine does Block {
method WrapHandle wrap(Code $code) {...}
method Routine unwrap(Wraphandle $original) {...}
method Str name() {...}
@@ -101,19 +101,19 @@

=head2 Sub

-class Sub isa Routine {...}
+ class Sub isa Routine {...}

=head2 Method

-class Method isa Routine {...}
+ class Method isa Routine {...}

=head2 Submethod

-class Submethod isa Routine {...} # XXX or should this be isa Sub
+ class Submethod isa Routine {...} # XXX or should this be isa Sub

=head2 Macro

-class Macro isa Routine {...}
+ class Macro isa Routine {...}

=head1 Additions


Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-07-05 03:43:57 UTC (rev 27413)
+++ docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-07-05 04:23:44 UTC (rev 27414)
@@ -514,9 +514,9 @@
the old array's elements; however, you can use this to get
any of three different semantic behaviors:

- @a.=rotate # @a is rotated in place
- @b = @a.rotate # @b contains copied elements of rotated @a
- @b := @a.rotate # @b contains aliased elements of rotated @a
+ @a.=rotate # @a is rotated in place
+ @b = @a.rotate # @b contains copied elements of rotated @a
+ @b := @a.rotate # @b contains aliased elements of rotated @a

If additional rotations are specified via the slurpy, they are
applied to subdimensions of multidimensional arrays. (To perform
@@ -728,11 +728,11 @@
=head2 Range

class Range does Positional {
- method from() {...}
- method to() {...}
- method min() {...}
- method max() {...}
- method List minmax() {...}
+ method from() {...}
+ method to() {...}
+ method min() {...}
+ method max() {...}
+ method List minmax() {...}
}

=head2 Buf

Modified: docs/Perl6/Spec/S32-setting-library/Exception.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/Exception.pod 2009-07-05 03:43:57 UTC (rev 27413)
+++ docs/Perl6/Spec/S32-setting-library/Exception.pod 2009-07-05 04:23:44 UTC (rev 27414)
@@ -25,26 +25,26 @@

=head1 Roles

-role Exception does Positional {
-# XXX How do we tell the difference between a warning and a fatal error?
-}
+ role Exception does Positional {
+ # XXX How do we tell the difference between a warning and a fatal error?
+ }

-role Resumeable {
- method resume() {...}
-}
+ role Resumeable {
+ method resume() {...}
+ }

-role Failure {
- method Bool {...} # XXX I'm hoping this worries about .defined and .true
- method handled {...}
-}
+ role Failure {
+ method Bool {...} # XXX I'm hoping this worries about .defined and .true
+ method handled {...}
+ }

=head1 Classes

-class Failure does Failure {
- has $.handled;
-}
+ class Failure does Failure {
+ has $.handled;
+ }

-class ControlExceptionSigHUP does Exception does Resumeable {}
+ class ControlExceptionSigHUP does Exception does Resumeable {}

=head1 Additions


Modified: docs/Perl6/Spec/S32-setting-library/IO.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/IO.pod 2009-07-05 03:43:57 UTC (rev 27413)
+++ docs/Perl6/Spec/S32-setting-library/IO.pod 2009-07-05 04:23:44 UTC (rev 27414)
@@ -43,13 +43,13 @@
X<open>

multi open (Str $name,
- Bool :$rw = False,
- Bool :$bin = False,
- Str :$enc = "Unicode",
- Any :$nl = "\n",
- Bool :$chomp = True,
- ...
- --> IO
+ Bool :$rw = False,
+ Bool :$bin = False,
+ Str :$enc = "Unicode",
+ Any :$nl = "\n",
+ Bool :$chomp = True,
+ ...
+ --> IO
) is export

A convenience method/function that hides most of the OO complexity.
@@ -569,7 +569,7 @@
This does file input and output.

class IO::File does IO::Streamable {
- ...
+ ...
}

=over
@@ -803,7 +803,7 @@
# Unsupported values may (or may not) throw
# UnsupportedPermission when set or read
has IO::FSNode $.owningObject;
- ...
+ ...
}

The permissions used in C<%permissions> are:
@@ -847,20 +847,20 @@

method lines ($handle:
Any $limit = *,
- Bool :$bin = False,
- Str :$enc = "Unicode",
- Any :$nl = "\n",
- Bool :$chomp = True,
- --> List
+ Bool :$bin = False,
+ Str :$enc = "Unicode",
+ Any :$nl = "\n",
+ Bool :$chomp = True,
+ --> List
) is export

multi lines (Str $filename,
Any $limit = *,
- Bool :$bin = False,
- Str :$enc = "Unicode",
- Any :$nl = "\n",
- Bool :$chomp = True,
- --> List
+ Bool :$bin = False,
+ Str :$enc = "Unicode",
+ Any :$nl = "\n",
+ Bool :$chomp = True,
+ --> List
)

Returns some or all the lines of a file as a C<List> regardless of context.
@@ -889,14 +889,14 @@
=item slurp

method slurp ($handle:
- Bool :$bin = False,
- Str :$enc = "Unicode",
- --> Str|Buf
+ Bool :$bin = False,
+ Str :$enc = "Unicode",
+ --> Str|Buf
) is export
multi slurp (Str $filename,
- Bool :$bin = False,
- Str :$enc = "Unicode",
- --> Str|Buf
+ Bool :$bin = False,
+ Str :$enc = "Unicode",
+ --> Str|Buf
)

Slurps the entire file into a C<Str> (or C<Buf> if C<:bin>) regardless of context.
@@ -912,9 +912,9 @@

=item open

- $dir.open(
- Str :$enc = "Unicode",
- );
+ $dir.open(
+ Str :$enc = "Unicode",
+ );

Opens a directory for processing, if the C<new> method was passed the C<NoOpen> option.
Makes the directory looks like
@@ -949,15 +949,15 @@
Creates a new link in the filesystem.

IO::LinkNode.new(
- Name => '/home/wayland/symlink.txt'
- Target => '/home/wayland/realfile.txt',
- Type => 'Hard', # Default is Symbolic
+ Name => '/home/wayland/symlink.txt'
+ Target => '/home/wayland/realfile.txt',
+ Type => 'Hard', # Default is Symbolic
);

Reads in the previously created symlink.

$link = IO::LinkNode.new(
- Name => '/home/wayland/symlink.txt',
+ Name => '/home/wayland/symlink.txt',
);
print $link.target; # prints /home/wayland/realfile.txt

@@ -992,7 +992,7 @@
Bool :$Blocking, # Passed to IO::Streamable.new()
Bool :$NoOpen, # Passed to IO::Streamable.new()

- --> IO::Socket::INET
+ --> IO::Socket::INET
) {...}

=back
@@ -1138,7 +1138,7 @@
Bool :$Blocking, # Passed to IO::Streamable.new()
Bool :$NoOpen, # Passed to IO::Streamable.new()

- --> IO::Socket::Unix
+ --> IO::Socket::Unix
) {...}

=item pair

Modified: docs/Perl6/Spec/S32-setting-library/Rules.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/Rules.pod 2009-07-05 03:43:57 UTC (rev 27413)
+++ docs/Perl6/Spec/S32-setting-library/Rules.pod 2009-07-05 04:23:44 UTC (rev 27414)
@@ -28,24 +28,24 @@

=head2 Regex

-role Regex {...}
+ role Regex {...}

=head2 Match

-role Match {
- method Int from() {...}
- method Int to() {...}
- method Int chars() {...}
- method orig() {...}
- method Str() {...}
-}
+ role Match {
+ method Int from() {...}
+ method Int to() {...}
+ method Int chars() {...}
+ method orig() {...}
+ method Str() {...}
+ }

=head2 Cursor

-role Cursor {
- method Int pos() {...}
- method orig() {...}
-}
+ role Cursor {
+ method Int pos() {...}
+ method orig() {...}
+ }

=head2 Grammar


Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2009-07-05 03:43:57 UTC (rev 27413)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2009-07-05 04:23:44 UTC (rev 27414)
@@ -509,7 +509,7 @@
Examples:

sprintf "%ld a big number, %lld a bigger number, %mf complexity\n",
- 4294967295, 4294967296, 1+2i);
+ 4294967295, 4294967296, 1+2i);

=item fmt


Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod 2009-07-05 03:43:57 UTC (rev 27413)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod 2009-07-05 04:23:44 UTC (rev 27414)
@@ -73,38 +73,38 @@

You probably want to use the Temporal::DateTime object instead.

-role Temporal::Date {
+ role Temporal::Date {
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 };

- has Int $.year;
- has Month $.month = 1;
- has Day $.day = 1;
+ has Int $.year;
+ has Month $.month = 1;
+ has Day $.day = 1;

# This can be cached internally, but it's a calculated value,
# not an attribute.
- our DayOfWeek method day-of-week ();
+ our DayOfWeek method day-of-week ();

# These always return the long English names
our Str method month-name () ; # "January"
our Str method day-name (); # "Tuesday"

# returns the date formatted in ISO8601 style - 2008-01-25
- our Str method iso8601 () {
+ our Str method iso8601 () {
[ self.year, self.month, self.date ].join('-');
}

method Str { self.iso8601 };

- multi method infix:{'<=>'} (Temporal::Date $self, Temporal::Date $other) {
+ multi method infix:{'<=>'} (Temporal::Date $self, Temporal::Date $other) {
$self.year <=> $other.year
$self.month <=> $other.month
$self.day <=> $other.day;
}
-}
+ }

Example:

@@ -115,28 +115,28 @@

You probably want to use the Temporal::DateTime object instead.

-role Temporal::Time {
+ role Temporal::Time {
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 };

- has Hour $.hour = 0;
- has Minute $.minute = 0;
- has Second $.second = 0;
+ has Hour $.hour = 0;
+ has Minute $.minute = 0;
+ has Second $.second = 0;

- our Str method iso8601 ()
+ our Str method iso8601 ()
{ [ self.hour, self.minute, self.second ].join(':') }

method Str { self.iso8601() };

- multi method infix:{'<=>'} (Temporal::Time $self, Temporal::Time $other) {
+ multi method infix:{'<=>'} (Temporal::Time $self, Temporal::Time $other) {
$self.hour <=> $other.hour
$self.minute <=> $other.minute
$self.second <=> $other.second
}
-}
+ }

=head2 Temporal::TimeZone::Observance

@@ -173,12 +173,12 @@

=head2 Temporal::DateTime

-role Temporal::DateTime {
+ role Temporal::DateTime {
has Temporal::Date $!date handles <year month day day-of-week>;
has Temporal::Time $!time handles <hour minute second fractional-second>;
has Temporal::TimeZone::Observance $!timezone handles <offset isdst>;

- our Str method iso8601 () {
+ our Str method iso8601 () {
self.date.iso8601 ~ 'T' ~ self.time.iso8601 ~ self.timezone.iso8601;
}

@@ -191,7 +191,7 @@
method Int { self.epoch.truncate }

method Num { self.epoch }
-}
+ }

=head1 Additions

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl6-language @
categoriesperl
postedJul 5, '09 at 4:23a
activeJul 5, '09 at 4:23a
posts1
users1
websiteperl6.org

1 user in discussion

Pugs-commits: 1 post

People

Translate

site design / logo © 2021 Grokbase