Author: lwall
Date: 2009-04-28 06:14:10 +0200 (Tue, 28 Apr 2009)
New Revision: 26511
Modified:
docs/Perl6/Spec/S03-operators.pod
docs/Perl6/Spec/S12-objects.pod
Log:
[S12] doc syntax for exporting subset and enum
[S12] enum uses (...) rather than [...], since <...> is defined as ()-like
[S03] mention temp and let as named unary ops
Modified: docs/Perl6/Spec/S03-operators.pod
===================================================================
--- docs/Perl6/Spec/S03-operators.pod 2009-04-28 04:11:21 UTC (rev 26510)
+++ docs/Perl6/Spec/S03-operators.pod 2009-04-28 04:14:10 UTC (rev 26511)
@@ -40,7 +40,7 @@
X Concatenation ~
X Junctive and & also
X Junctive or | ^
- L Named unary sleep abs sin
+ L Named unary sleep abs sin temp let
N Nonchaining infix but does <=> leg cmp .. ..^ ^.. ^..^
C Chaining infix != == < <= > >= eq ne lt le gt ge ~~ === eqv !eqv
X Tight and &&
Modified: docs/Perl6/Spec/S12-objects.pod
===================================================================
--- docs/Perl6/Spec/S12-objects.pod 2009-04-28 04:11:21 UTC (rev 26510)
+++ docs/Perl6/Spec/S12-objects.pod 2009-04-28 04:14:10 UTC (rev 26511)
@@ -12,9 +12,9 @@
Maintainer: Larry Wall <[email protected]>
Date: 27 Oct 2004
- Last Modified: 19 Mar 2009
+ Last Modified: 27 Apr 2009
Number: 12
- Version: 79
+ Version: 80
=head1 Overview
@@ -1335,6 +1335,10 @@
preferred if the constraint matches, and otherwise the second is
preferred.
+To export a subset type, put the export trait just before the C<where>:
+
+ subset Positive of Int is export where * > 0;
+
=head2 Multiple constraints
[Conjecture: This entire section is considered a guess at our
@@ -1461,9 +1465,10 @@
An enum is a low-level class that can function as a role or property.
A given enum value can function as a subtype, a method, or as an ordinary
-value. The names of the values are specified as a list:
+value. The names of the values are specified as a parenthesized list, or
+an equivalent angle bracket list:
- my enum Day ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
+ my enum Day ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
my enum Day <Sun Mon Tue Wed Thu Fri Sat>;
If the first value is unspecified, it defaults to 0. To specify the
@@ -1476,7 +1481,7 @@
The type can be specified:
my bit enum maybe <no yes>;
- my Int enum day ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
+ my Int enum day ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
my enum day of uint4 <Sun Mon Tue Wed Thu Fri Sat>;
For any enum value of an object type, the object itself knows its own
@@ -1522,10 +1527,10 @@
Quebec Romeo Sierra Tango Uniform
Victor Whiskey X-ray Yankee Zulu»;
- enum roman [i => 1, v => 5,
+ enum roman (i => 1, v => 5,
x => 10, l => 50,
c => 100, d => 500,
- m => 1000];
+ m => 1000);
my Item enum hex «:zero(0) one two three four five six seven eight nine
:ten<a> eleven twelve thirteen fourteen fifteen»;
@@ -1641,6 +1646,10 @@
is done without replacement. (If it I<does> return Five Aces,
it's time to walk away. Or maybe run.)
+To export an enum, place the export trait just before the list:
+
+ enum Maybe is export <No Yes Dunno>;
+
=head1 Open vs Closed Classes
By default, all classes in Perl are non-final, which means