Skip to content

Commit 5c25606

Browse files
committed
Merge branch 'master' into supplied
Conflicts: htmlify.p6
2 parents 8d8fd30 + edef417 commit 5c25606

File tree

187 files changed

+2246
-199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+2246
-199
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ html/routine/
66
html/type/
77
html/op/
88
html/language/
9-
html/misc/
9+
html/syntax/
1010
html/images/type-graph*
1111
html/js/search.js

bin/p6doc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ sub locate-module(Str $modulename) {
4747
}
4848

4949
sub show-docs(Str $path, :$section) {
50-
my $pager = %*ENV<PAGER> // ($*OS eq 'MSWin32' ?? 'more' !! 'less');
50+
my $pager = %*ENV<PAGER> // ($*OS eq 'mswin32' ?? 'more' !! 'less');
5151
if not open($path).lines.grep( /^'=' | '#|' | '#='/ ) {
5252
say "No Pod found in $path";
5353
return;

html/css/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pre a:hover, pre a:link:hover {
4343
color: inherit;
4444
}
4545

46-
img {
46+
img, svg {
4747
max-width: 100%;
4848
}
4949

htmlify.p6

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,19 @@ sub svg-for-file($file) {
120120
$str;
121121
}
122122

123-
# --sparse=5:
123+
# --sparse=5: only process 1/5th of the files
124+
# mostly useful for performance optimizations, profiling etc.
124125
sub MAIN(
125126
Bool :$debug,
126127
Bool :$typegraph = False,
127-
Int :$sparse
128-
#=[ only process 1/Nth of the files
129-
mostly useful for performance optimizations, profiling etc. ]
128+
Int :$sparse,
129+
Bool :$disambiguation = True,
130+
Bool :$search-file = True,
130131
) {
131132
$*DEBUG = $debug;
132133

133134
say 'Creating html/ subdirectories ...';
134-
for '', <type language routine images misc> {
135+
for '', <type language routine images syntax> {
135136
mkdir "html/$_" unless "html/$_".IO ~~ :e;
136137
}
137138

@@ -148,24 +149,23 @@ sub MAIN(
148149
})
149150
}
150151

151-
tap-disambiguation-files;
152-
tap-search-file;
152+
tap-disambiguation-files if $disambiguation;
153+
tap-search-file if $search-file;
153154
tap-index-files;
154155

155-
for <routine misc> -> $kind {
156+
for <routine syntax> -> $kind {
156157
tap-kind $kind;
157158
}
158159

159-
160160
process-pod-dir 'Type', :sorted-by{ %h{.key} // -1 }, :$sparse;
161161
#process-pod-dir 'Language', :$sparse;
162162

163163
say 'Composing doc registry ...';
164164
$DR.compose;
165165

166166
say 'Processing complete.';
167-
if $sparse {
168-
say "This is a sparse run. DO NOT SYNC WITH doc.perl6.org!";
167+
if $sparse || !$search-file || !$disambiguation {
168+
say "This is a sparse or incomplete run. DO NOT SYNC WITH doc.perl6.org!";
169169
}
170170
}
171171

@@ -229,6 +229,7 @@ sub process-type-source(:$pod, :$podname, :$pod-is-complete) {
229229
:kind<type>,
230230
:subkinds($type ?? $type.packagetype !! 'class'),
231231
:categories($type ?? $type.categories !! Nil),
232+
:$summary,
232233
:$pod,
233234
:$pod-is-complete,
234235
:name($podname),
@@ -368,17 +369,24 @@ sub find-definitions (:$pod, :$origin, :$min-level = -1) {
368369
:categories($subkinds),
369370
}
370371
when 'class'|'role' {
372+
my $summary = '';
373+
if @c[$i+1] ~~ {$_ ~~ Pod::Block::Named and .name eq "SUBTITLE"} {
374+
$summary = @c[$i+1].contents[0].contents[0];
375+
} else {
376+
note "$name does not have an =SUBTITLE";
377+
}
371378
%attr = :kind<type>,
372379
:categories($tg.types{$name}.?categories//''),
380+
:$summary,
373381
}
374382
when 'variable'|'sigil'|'twigil'|'declarator'|'quote' {
375383
# TODO: More types of syntactic features
376-
%attr = :kind<misc>,
384+
%attr = :kind<syntax>,
377385
:categories($subkinds),
378386
}
379387
when $unambiguous {
380388
# Index anything from an X<>
381-
%attr = :kind<misc>,
389+
%attr = :kind<syntax>,
382390
:categories($subkinds),
383391
}
384392
default {
@@ -417,7 +425,7 @@ sub find-definitions (:$pod, :$origin, :$min-level = -1) {
417425
# Determine proper subkinds
418426
my Str @subkinds = first-code-block($chunk)\
419427
.match(:g, /:s ^ 'multi'? (sub|method)»/)\
420-
.>>[0]>>.Str.uniq;
428+
.>>[0]>>.Str.unique;
421429

422430
note "The subkinds of routine $created.name() in $origin.name() cannot be determined."
423431
unless @subkinds;
@@ -441,8 +449,8 @@ sub find-definitions (:$pod, :$origin, :$min-level = -1) {
441449

442450
sub write-type-graph-images(:$force) {
443451
unless $force {
444-
my $dest = 'html/images/type-graph-Any.svg'.path;
445-
if $dest.e && $dest.modified >= 'type-graph.txt'.path.modified {
452+
my $dest = 'html/images/type-graph-Any.svg'.IO;
453+
if $dest.e && $dest.modified >= 'type-graph.txt'.IO.modified {
446454
say "Not writing type graph images, it seems to be up-to-date";
447455
say "To force writing of type graph images, supply the --typegraph";
448456
say "option at the command line, or delete";
@@ -519,7 +527,7 @@ sub tap-search-file () {
519527
( $DR.lookup('language', :by<kind>),
520528
$DR.lookup('type', :by<kind>),
521529
$DR.lookup('routine', :by<kind>),
522-
$DR.lookup('misc', :by<kind>),
530+
$DR.lookup('syntax', :by<kind>),
523531
).reduce({merge $^a: $^b}).map({
524532
.unique(:as{.name}).map({
525533
.subkinds.map(*.wordcase).map: -> $subkind {
@@ -690,6 +698,8 @@ sub footer-html() {
690698
incomplete. Your contribution is appreciated.
691699
</p>
692700
<p>
701+
This documentation is provided under the terms of the Artistic
702+
License 2.0.
693703
The Camelia image is copyright 2009 by Larry Wall.
694704
</p>
695705
];

lib/HomePage.pod

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
=begin Html
2-
<img style="float: right; margin: 0 0 1em 1em" src="/images/camelia.png"/>
2+
<img style="float: right; margin: 0 0 1em 1em" src="/images/camelia.png" alt =""/>
33
Welcome to the official documentation of the <a href="http://perl6.org">Perl 6</a>
44
programming language!
55
Besides online browsing and searching, you can also
@@ -34,10 +34,15 @@ Z<<
3434

3535
<hr>
3636

37+
38+
<p>The Perl 6 homepage offers <a href="http://perl6.org/documentation/">a
39+
comprehensive list of Perl 6 documentation</a>, including tutorials, HowTos
40+
and <a href="http://faq.perl6.org/">FAQs (Frequently Asked Questions)</a>.</p>
41+
3742
<p>
38-
You may also be interested in the Perl 6 <a href="http://perlcabal.org/syn">synopses</a>,
39-
which are more complete than this documentation, but targeted toward compiler writers
40-
rather than users of the language.
43+
You may also be interested in the Perl 6 <a href="http://design.perl6.org">design documents</a>,
44+
which are in some places more complete than this documentation, but targeted
45+
toward compiler writers rather than users of the language.
4146
Documentation for the different but related <a href="http://perl.org/">Perl 5</a> language
4247
can be found <a href="http://perldoc.perl.org/">here</a>.
4348
</p>

lib/Language/grammars.pod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ back up and try again if it fails to match something. This will usually do what
5555
=end code
5656
5757
The only difference between the C<token> and C<rule> declarators is that the
58-
C<rule> declarator causes L<C<:sigspace>|/language/regexes#sigspace> to go into
58+
C<rule> declarator causes L<C<:sigspace>|/language/regexes#Sigspace> to go into
5959
effect for the Regex:
6060
6161
=begin code :allow<B>
@@ -67,6 +67,8 @@ effect for the Regex:
6767
6868
=head1 X<Creating Grammars|class,Grammar;declarator,grammar>
6969
70+
=SUBTITLE Group of named regexes that form a formal grammar
71+
7072
class Grammar is Cursor { }
7173
7274
C<Grammar> is the superclass that classes automatically get when they

lib/Language/mop.pod

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,44 @@
44
55
=SUBTITLE Introspection and the Perl 6 Object System
66
7-
TODO
7+
Perl 6 is built on a meta object layer. That means that there are objects (the
8+
I<meta objects>) that control how various object-oriented constructs (such as
9+
classes, roles, methods, attributes, enums, ...) behave.
10+
11+
To get a feeling for the meta object for C<class>, here is the same example
12+
twice: once as normal declarations in Perl 6, and once expressed through the
13+
meta model:
14+
15+
class A {
16+
method x() { say 42 }
17+
}
18+
19+
A.x();
20+
21+
corresponds to:
22+
23+
constant A := Metamodel::ClassHOW.new_type( name => 'A' ); # class A {
24+
A.^add_method('x', my method x(A:) { say 42 }); # method x() .. .
25+
A.^compose; # }
26+
27+
A.x();
28+
29+
(except that the declarative form runs at comple time, and the latter form
30+
does not).
31+
32+
The meta object behind
33+
an object can be obtained with C<$obj.HOW>, where HOW stands for Higher Order
34+
Workings (or, I<HOW the *%@$ does this work?>).
35+
36+
Here the calls with C<.^> are calls to the meta object, so C<A.^compose> is a
37+
shortcut for C<A.HOW.compose(A)>. The invocant is passed along in the
38+
parameter list as well, to make it possible to support prototype-style type
39+
systems, where there is just one meta object (and not one meta object per
40+
type, as standard Perl 6 does it).
41+
42+
As the example above demonstrates, all object oriented features are available
43+
to the user, not just to the compiler. In fact the compiler also just emits
44+
call to the meta objects.
845
946
=head1 Metamethods
1047
@@ -24,17 +61,22 @@ quotes around the method name to call it indirectly:
2461
2562
The type object of the type.
2663
64+
For example C<42.WHAT> returns the C<Int> type object.
65+
2766
=head2 X<WHICH|syntax,WHICH>
2867
29-
The object's identity value.
68+
The object's identity value. This can be used for hashing and identity
69+
comparison, and is how the C<===> infix operator is implemented.
3070
3171
=head2 X<WHO|syntax,WHO>
3272
3373
The package supporting the object.
3474
3575
=head2 X<WHERE|syntax,WHERE>
3676
37-
The memory address of the object.
77+
The memory address of the object. Note that this is not stable in
78+
implementations with moving/compacting garbage collectors. Use C<WHICH> for a
79+
stable identity indicator.
3880
3981
=head2 X<HOW|syntax,HOW>
4082
@@ -47,6 +89,7 @@ The attached Pod value.
4789
=head2 X<DEFINITE|syntax,DEFINITE>
4890
4991
The object has a valid concrete representation.
92+
Returns C<True> for instances and C<False> for type objects.
5093
5194
=head2 X<VAR|syntax,VAR>
5295

lib/Language/objects.pod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,8 @@ To get rid of using the same object twice, there is a shortcut:
622622
623623
=head2 class Perl6::Metamodel::ClassHOW
624624
625+
=SUBTITLE Meta object for a class
626+
625627
Introspection is the process of getting information about an object or class
626628
at runtime. In Perl 6, all introspection goes through the meta object. The
627629
standard C<ClassHOW> for class-based objects offers these facilities:

lib/Language/operators.pod

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,21 @@ The operator for calling one method, C<$invocant.method>.
218218
219219
Technically this is not an operator, but syntax special-cased in the compiler.
220220
221+
=head2 postfix C«.=»
222+
223+
A mutating method call. C<$invocant.=method> desugars to
224+
C<$invocant = $invocant.method>, similar to L<C<op=>>.
225+
226+
Technically this is not an operator, but syntax special-cased in the compiler.
227+
228+
=head2 postfix C«.^»
229+
230+
A meta-method call. C<$invocant.^method> calls C<method> on C<$invocant>'s
231+
metaclass. It desugars to C<$invocant.HOW.method($invocant, ...)>. See L<C<HOW>>
232+
for more information.
233+
234+
Technically this is not an operator, but syntax special-cased in the compiler.
235+
221236
=head2 postfix C«.?»
222237
223238
Potential method calls. C<$invocant.?method> calls method C<method> on
@@ -240,7 +255,58 @@ L<Parcel> is returned.
240255
241256
Technically this is not an operator, but syntax special-cased in the compiler.
242257
243-
# TODO: .= .^ .:: .() .[] .{} .<>
258+
=head2 X«postfix C<.postfix>
259+
|postfix,.postfix;postcircumfix,.( );postcircumfix,.[ ];postcircumfix,.{ };postcircumfix,.< >»
260+
261+
In most cases, a dot may be placed before a postfix or postcircumfix:
262+
263+
@a[1, 2, 3];
264+
@a.[1, 2, 3]; # Same
265+
266+
This can be useful for visual clarity or brevity. For example, if an object's
267+
attribute is a function, putting a pair of paretheses after the attribute name
268+
will become part of the method call. So either two pairs of paretheses must be
269+
used, or a dot has to come before the parentheses to seperate it from the method
270+
call.
271+
272+
class Operation {
273+
has $.symbol;
274+
has &.function;
275+
}
276+
my $addition = Operation.new(:symbol<+>, :function{ $^a + $^b });
277+
say $addition.function()(1, 2); # 3
278+
# OR
279+
say $addition.function.(1,2); # 3
280+
281+
If the postfix is an identifier, however, it will be interpreted as a normal
282+
method call.
283+
284+
1.i # No such method 'i' for invocant of type 'Int'
285+
286+
Technically this is not an operator, but syntax special-cased in the compiler.
287+
288+
=head2 postfix C«.:<prefix>»
289+
290+
A prefix can be called like a method using colonpair notation. For example:
291+
292+
my $a = 1;
293+
say ++$a; # 2
294+
say $a.:<++>; # 3
295+
296+
Technically this is not an operator, but syntax special-cased in the compiler.
297+
298+
=head2 postfix C«.::»
299+
300+
A class-qualified method call, used to call a method as defined in a parent
301+
class or role, even after it has been redefined in the child class.
302+
303+
class Bar {
304+
method baz { 42 }
305+
}
306+
class Foo is Bar {
307+
method baz { "nope" }
308+
}
309+
say Foo.Bar::baz; # 42
244310
245311
=head1 Autoincrement Precedence
246312

0 commit comments

Comments
 (0)