Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Pair and Blob literals
  • Loading branch information
moritz committed Apr 4, 2015
1 parent b7d5b91 commit 0e60c9a
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions lib/Language/syntax.pod
Expand Up @@ -128,6 +128,8 @@ of comment
say 'code again';
=end code
=comment TODO: identifiers
=head1 Statements and Expressions
Perl 6 programs are made of lists of statements. A special case of a statement
Expand Down Expand Up @@ -212,6 +214,12 @@ String literals are surrounded by quotes:
See L<quoting|/language/quoting> for many more options.
=head3 Blob literals
Binary data of L<type Blob|/type/Blob> can be written as C<:base{data}>, so
:16<DE AD BE EF>
=head3 Number literals
Number literals are generally specified in base ten, unless a prefix like
Expand Down Expand Up @@ -266,11 +274,40 @@ a real and an imaginary number:
1+2i
6.123e5i
=begin comment
=head3 Pair literals
TODO
Pairs are made of a key and a value, and there are two basic forms for
constructing them: C<< key => 'value' >> and C<:key('value')>.
=head4 Arrow pairs
Arrow pairs can have an expression or an identifier on the left-hand side:
identifer => 42
"identifier" => 42
('a' ~ 'b') => 1
=head4 Adverbial pairs (colon pairs)
Short forms without explicit values:
my $thing = 42;
:$thing # same as thing => $thing
:thing # same as thing => True
:!thing # same as thing => False
The variable form also works with other sigils, like C<:&callback> or
C<:@elements>.
Long forms with explicit values:
:thing($value) # same as thing => $value
:thing<quoted list> # same as thing => <quoted list>
:thing['some', 'values'] # same as thing => ['some', 'values']
:thing{a => 'b'} # same as thing => { a => 'b' }
=begin comment
=head3 Array literals
Expand Down

0 comments on commit 0e60c9a

Please sign in to comment.