Skip to content

Commit cf4a9be

Browse files
committed
Try to avoid line wraps in examples
1 parent 5c78c26 commit cf4a9be

File tree

1 file changed

+34
-33
lines changed

1 file changed

+34
-33
lines changed

doc/Language/syntax.pod6

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ to entities/objects such as constants, variables (e.g. Scalars) and routines
229229
(e.g. Subs and Methods). In a L<variable name|/language/variables>, any sigil
230230
(and twigil) precedes the identifier and does not form a part thereof.
231231
232-
constant c = 299792458; # identifier "c" names an Int
233-
my $a = 123; # identifier "a" in the name "$a" of a Scalar
234-
sub hello { say "Hello!" }; # identifier "hello" names a Sub
232+
constant c = 299792458; # identifier "c" names an Int
233+
my $a = 123; # identifier "a" in the name "$a" of a Scalar
234+
sub hello { say "Hello!" }; # identifier "hello" names a Sub
235235
236236
Identifiers come in different forms: ordinary identifiers, extended
237237
identifiers, and compound identifiers.
@@ -266,7 +266,7 @@ piece_of_π
266266
42 # identifier does not start with alphabetic character
267267
with-numbers1234-5 # embedded hyphen not followed by alphabetic character
268268
is-prime? # question mark is not alphanumeric
269-
x² # superscript 2 is not alphanumeric (in the sense explained above)
269+
x² # superscript 2 is not alphanumeric (explained above)
270270
=end code
271271
272272
=head3 Extended identifiers
@@ -278,14 +278,13 @@ to be identifiable individually. For example, you might use a module whose short
278278
name is C<Dog>, while its long name includes its naming authority and version:
279279
280280
=begin code :skip-test<identifiers only>
281-
Dog:auth<Somebody>:ver<1.0> # long module names including author and version
281+
Dog:auth<Somebody>:ver<1.0> # long module names including author and version
282282
Dog:auth<Somebody>:ver<2.0>
283283
284284
use Dog:auth<Somebody>:ver<2.0>;
285-
286-
# Selection of second module causes its full name to be aliased to the short
287-
# name for the rest of # the lexical scope, allowing a declaration like
288-
# this.
285+
# Selection of second module causes its full name to be aliased to the
286+
# short name for the rest of # the lexical scope, allowing a declaration
287+
# like this.
289288
my Dog $spot .= new("woof");
290289
=end code
291290
@@ -296,9 +295,9 @@ The long name is what constitutes the extended identifier, and includes this
296295
syntactic category; the short name will be included in quotes in the definition:
297296
298297
=begin code :skip-test<identifiers only>
299-
infix:<+> # the official name of the operator in $a + $b
300-
infix:<*> # the official name of the operator in $a * $b
301-
infix:«<=» # the official name of the operator in $a <= $b
298+
infix:<+> # the official name of the operator in $a + $b
299+
infix:<*> # the official name of the operator in $a * $b
300+
infix:«<=» # the official name of the operator in $a <= $b
302301
=end code
303302
304303
For all such uses, you can append one or more colon-separated string to an
@@ -313,16 +312,16 @@ or C<[' ']> which quotes one or more arbitrary characters C<value>:
313312
314313
=begin code :skip-test<Identifiers good and bad>
315314
# exemplary valid extended identifiers:
316-
postfix:<²> # the official long name of the operator in $x²
315+
postfix:<²> # the official long name of the operator in $x²
317316
WOW:That'sAwesome
318317
WOW:That's<<🆒>>
319318
party:sweet<16>
320319
321320
# exemplary invalid extended identifiers:
322-
party:16<sweet> # 16 is not an ordinary identifier
321+
party:16<sweet> # 16 is not an ordinary identifier
323322
party:16sweet
324-
party:!a # ...and neither is !a
325-
party:$a # ...nor $a
323+
party:!a # ...and neither is !a
324+
party:$a # ...nor $a
326325
=end code
327326
N<Starting with Perl 6 language version 6.d, colon pairs with C<sym> as the
328327
C<key> (e.g. C«:sym<foo>») are reserved for possible future use.>
@@ -345,8 +344,8 @@ Similarly, all of this works:
345344
=begin code
346345
my $foo:bar<baz> = 'quux';
347346
say $foo:bar«baz»; # OUTPUT: «quux␤»
348-
my $take-me:<home> = 'When the glory has no end';
349-
say $take-me:['home']; # OUTPUT: «When the [...]␤»
347+
my $take-me:<home> = 'Where the glory has no end';
348+
say $take-me:['home']; # OUTPUT: «Where [...]␤»
350349
my $foo:bar<2> = 5;
351350
say $foo:bar(1+1); # OUTPUT: «5␤»
352351
=end code
@@ -355,9 +354,9 @@ Where an extended identifier comprises two or more colon pairs, their order
355354
is generally significant:
356355
357356
=begin code
358-
my $a:b<c>:d<e> = 100;
359-
my $a:d<e>:b<c> = 200;
360-
say $a:b<c>:d<e>; # OUTPUT: «100␤», NOT: «200␤»
357+
my $a:b<c>:d<e> = 100;
358+
my $a:d<e>:b<c> = 200;
359+
say $a:b<c>:d<e>; # OUTPUT: «100␤», NOT: «200␤»
361360
=end code
362361
363362
An exception to this rule is I<module versioning>; so these identifiers
@@ -373,9 +372,9 @@ requires the use of L<constants|/language/terms#Constants> for the interpolation
373372
values:
374373
375374
=begin code
376-
constant $c = 42; # Constant binds to Int; $-sigil enables interpolation
375+
constant $c = 42; # Constant binds to Int; $-sigil enables interpolation
377376
my $a:foo<42> = "answer";
378-
say $a:foo«$c»; # OUTPUT: «answer␤»
377+
say $a:foo«$c»; # OUTPUT: «answer␤»
379378
=end code
380379
381380
Although quoting bracketing constructs are generally interchangeable
@@ -388,7 +387,8 @@ names.
388387
constant $what = 'are';
389388
my @we:<are>= <the champions>;
390389
say @we:«$what»; # OUTPUT: «[the champions]␤»
391-
say @we:<$what>; # Compilation error: Variable '@we:<$what>' is not declared
390+
say @we:<$what>;
391+
# Compilation error: Variable '@we:<$what>' is not declared
392392
=end code
393393
394394
=head3 Compound identifiers
@@ -419,8 +419,8 @@ packages:
419419
420420
=begin code
421421
my $foo::bar = 1;
422-
say OUR::.keys; # OUTPUT: «(foo)␤»
423-
say OUR::foo.HOW # OUTPUT: «Perl6::Metamodel::PackageHOW.new␤»
422+
say OUR::.keys; # OUTPUT: «(foo)␤»
423+
say OUR::foo.HOW # OUTPUT: «Perl6::Metamodel::PackageHOW.new␤»
424424
=end code
425425
426426
The last lines shows how the C<foo> package was created automatically, as a
@@ -595,13 +595,14 @@ number:
595595
Integers default to signed base-10, but you can use other bases. For details,
596596
see L<Int|/type/Int>.
597597
598-
=begin code :skip-test
599-
-2 # actually not a literal, but unary - operator applied to numeric literal 2
600-
12345
601-
0xBEEF # base 16
602-
0o755 # base 8
603-
:3<1201> # arbitrary base, here base 3
604-
=end code
598+
=begin code :skip-test
599+
# actually not a literal, but unary - operator applied to numeric literal 2
600+
-2
601+
12345
602+
0xBEEF # base 16
603+
0o755 # base 8
604+
:3<1201> # arbitrary base, here base 3
605+
=end code
605606
606607
=head4 Rat literals
607608

0 commit comments

Comments
 (0)