Skip to content

Commit

Permalink
Some reflow, also adds subtitle
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed Apr 11, 2019
1 parent fb1dbc9 commit b2367a3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
18 changes: 13 additions & 5 deletions doc/Language/typesystem.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -705,10 +705,10 @@ Enumerations provide constant key-value-pairs with an associated type. Any key
is of that type and injected as a symbol into the current scope. If the symbol
is used, it is treated as a constant expression and the symbol is replaced with
the value of the enum-pair. Any Enumeration inherits methods from the role
L<C<Enumeration>|/type/Enumeration>. Complex expressions for generating key-value pairs are not
supported. In general, an C<enum> is a L<Map|/type/Map> whose elements have the
C<Enumeration> role mixed in; this role includes, for each element, an index
which creates an order on the map.
L<C<Enumeration>|/type/Enumeration>. Complex expressions for generating
key-value pairs are not supported. In general, an C<enum> is a L<Map|/type/Map>
whose elements have the C<Enumeration> role mixed in; this role includes, for
each element, an index which creates an order on the map.
Stringification of the symbol, which is done automatically in string context and
is exactly equal to its name, which is also the key of the enum-pair.
Expand Down Expand Up @@ -738,6 +738,14 @@ All keys have to be of the same type.
say Mass.enums;
# OUTPUT: «Map.new((g => 1, kg => 1000, mg => 0.001))␤»
And you can use any kind of symbol:
enum Suit <♣ ♦ ♥ ♠>;
say Suit::<♣>; # OUTPUT: «♣␤»
However, while you can use directly enums that follow the bare-identifier syntax
(as above), you always need to qualify this kind of enum values.
If no value is given C<Int> will be assumed as the values type and incremented
by one per key starting at zero. As enum key types C<Int>, C<Num>, C<Rat> and
C<Str> are supported.
Expand All @@ -755,7 +763,7 @@ A different starting value can be provided.
# OUTPUT: «Map.new((four => 4, one => 1, three => 3, two => 2))␤»
Enums can also be anonymous, with the only difference with named C<enum>s being
that you cannot use it in Signatures or to declare variables.
that you cannot use it in C<Signature>s or to declare variables.
my $e = enum <one two three>;
say two; # OUTPUT: «two␤»
Expand Down
14 changes: 8 additions & 6 deletions doc/Type/Encoding.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
=TITLE role Encoding
=SUBTITLE ...
=SUBTITLE Support for character encodings.
role Encoding { ... }
The C<Encoding> role is implemented by objects that provide a character
encoding, such as ASCII or UTF-8. Besides being implemented by the
built-in character encodings, it may also be implemented by users to
provide new encodings. Instances of objects doing this role are
typically obtained using L<Encoding::Registry>. For a list of supported
encodings, see L<IO::Handle|/type/IO::Handle#method_encoding>
encoding, such as ASCII or UTF-8. Besides being used by the built-in character
encodings, it may also be implemented by users to provide new encodings.
Instances of objects doing this role are typically obtained using
L<Encoding::Registry>. For a list of supported encodings, see
L<IO::Handle|/type/IO::Handle#method_encoding>.
=head1 Methods
Expand All @@ -38,6 +38,8 @@ C<\n> while decoding.
=head2 method encoder
Defined as:
method encoder(Encoding:D: *%options --> Encoding::Encoder)
Gets a character encoder instance for this encoding, configured with the
Expand Down

0 comments on commit b2367a3

Please sign in to comment.