Skip to content

Commit a346d81

Browse files
committed
Adds preference for non-texas syntax
And also substitutes `Inf` for `∞` in a bunch of places. Refs #1520, but does not really close it. Lot of work to do, and maybe some discussion
1 parent 327d859 commit a346d81

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

doc/Type/Iterator.pod6

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ should return the sentinel value C<IterationEnd>. Otherwise it should return
9696
C<$count>.
9797
9898
my @array;
99-
say (1 .. Inf).iterator.push-exactly(@array, 3); # OUTPUT: «3␤»
99+
say (1 .. ).iterator.push-exactly(@array, 3); # OUTPUT: «3␤»
100100
say @array; # OUTPUT: «[1 2 3]␤»
101101
102102
The Iterator role implements this method in terms of C<pull-one>.
@@ -119,7 +119,7 @@ iterators without side effects (such as L<Range|/type/Range> iterators) can
119119
produce more elements to achieve better performance.
120120
121121
my @array;
122-
say (1 .. Inf).iterator.push-at-least(@array, 10); # OUTPUT: «10␤»
122+
say (1 .. ).iterator.push-at-least(@array, 10); # OUTPUT: «10␤»
123123
say @array; # OUTPUT: «[1 2 3 4 5 6 7 8 9 10]␤»
124124
125125
The Iterator role implements this method in terms of C<pull-one>.
@@ -165,7 +165,7 @@ Built-in operations that know that they can produce infinitely many values
165165
return C<True> here, for example C<(1..6).roll(*)>.
166166
167167
say (1 .. 100).is-lazy; # OUTPUT: «False␤»
168-
say (1 .. Inf).is-lazy; # OUTPUT: «True␤»
168+
say (1 .. ).is-lazy; # OUTPUT: «True␤»
169169
170170
The Iterator role implements this method returning C<False>, indicating a
171171
non-lazy iterator.

doc/Type/List.pod6

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,9 @@ NUMBER <= 0. Defaults to the first element seen if no NUMBER specified.
445445
Examples:
446446
447447
say ^10 .head(5); # OUTPUT: «(0 1 2 3 4)␤»
448-
say ^Inf .head(5); # OUTPUT: «(0 1 2 3 4)␤»
448+
say ^ .head(5); # OUTPUT: «(0 1 2 3 4)␤»
449449
say ^10 .head; # OUTPUT: «0␤»
450-
say ^Inf .head; # OUTPUT: «0␤»
450+
say ^ .head; # OUTPUT: «0␤»
451451
452452
=head2 method tail
453453
@@ -463,9 +463,9 @@ Examples:
463463
464464
=for code
465465
say ^10 .tail(5); # OUTPUT: «(5 6 7 8 9)␤»
466-
say ^Inf .tail(5); # Cannot tail a lazy list
466+
say ^ .tail(5); # Cannot tail a lazy list
467467
say ^10 .tail; # OUTPUT: «(9)␤»
468-
say ^Inf .tail; # Cannot tail a lazy list
468+
say ^ .tail; # Cannot tail a lazy list
469469
470470
=head2 routine categorize
471471

doc/Type/Signature.pod6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ The C<is copy> trait causes the argument to be copied, and allows it
780780
to be modified inside the routine
781781
782782
sub count-up($x is copy) {
783-
$x = Inf if $x ~~ Whatever;
783+
$x = if $x ~~ Whatever;
784784
.say for 1..$x;
785785
}
786786

writing-docs/STYLEGUIDE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,18 @@ stick to easily understandable names:
8484
If you want to add some fancy characters, please stick to
8585
[well-known characters from our Unicode set](https://docs.perl6.org/language/unicode_ascii).
8686

87+
### Prefer non-Texas (non-ASCII) syntax in examples
88+
89+
my @infinite-sequence = 1,3...∞ # GOOD
90+
my @infinite-sequence = 1,3...Inf # OK, but rather not
91+
<a b c > ⊖ <c d e> # Good
92+
<a b c > (^) <c d e> # OK, but don't do that
93+
94+
All operators have a ASCII (or Texas) equivalent, but they are more
95+
verbose and do not correspond exactly to the mathematical operator or constant
96+
they often represent. Please use that syntax whenever possible.
97+
98+
8799
### Prefer the %() form of declaring hashes
88100

89101
my %hash := { this => "is", a => "hash" }; # Correct, but BAD

0 commit comments

Comments
 (0)