Skip to content

Commit 040f663

Browse files
committed
subscripts are now functions, not methods
1 parent 611cf01 commit 040f663

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

docs/Perl6/Perl5/Differences.pod

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -427,18 +427,19 @@ C<Callable>.
427427
The roles provides the operators C<< postcircumfix:<[ ]> >> (Positional; for
428428
array indexing), C<< postcircumfix:<{ }> >>
429429
(Associative) and C<< postcircumfix:<()> >> (Callable). The are technically
430-
just methods with a fancy syntax.
431-
You should override these to provide meaningful semantics.
430+
just functions with a fancy syntax.
431+
You can override these to provide the desired semantics.
432432

433433
class OrderedHash does Associative {
434-
multi method postcircumfix:<{ }>(Int $index) {
434+
multi sub postcircumfix:<{ }>(Int $index) is export {
435435
# code for accessing single hash elements here
436436
}
437-
multi method postcircumfix:<{ }>(**@slice) {
437+
multi sub postcircumfix:<{ }>(**@slice) is export {
438438
# code for accessing hash slices here
439439
}
440440
...
441441
}
442+
import OrderedHash;
442443

443444
my %orderedHash = OrderedHash.new();
444445
say %orderedHash{'a'};
@@ -520,4 +521,5 @@ Kirrily "Skud" Robert, C<< <skud@cpan.org> >>,
520521
Mark Stosberg,
521522
Moritz Lenz,
522523
Trey Harris,
523-
Andy Lester
524+
Andy Lester,
525+
Larry Wall

0 commit comments

Comments
 (0)