Skip to content

Commit 0df69d1

Browse files
committed
is cached, still experimental. Closes #2550
1 parent eb1d5d2 commit 0df69d1

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

doc/Type/Routine.pod6

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
77
class Routine is Block { }
88
9-
A C<Routine> is a code object meant for larger unities of code than L<Block|/type/Block>.
10-
Routine is the common superclass for L<Sub|/type/Sub> (and therefore operators) and
11-
L<Method|/type/Method>, the two primary code objects for code reuse.
9+
A C<Routine> is a code object meant for larger unities of code than
10+
L<Block|/type/Block>. Routine is the common superclass for L<Sub|/type/Sub> (and
11+
therefore operators) and L<Method|/type/Method>, the two primary code objects
12+
for code reuse.
1213
1314
Routines serve as a scope limiter for C<return> (i.e. a C<return> returns
1415
from the innermost outer Routine).
1516
16-
Routine is also the level at which
17+
The routine level is also the one at which
1718
L<multiness|/language/glossary#Multi-Dispatch> (multi subs and multi methods)
1819
are handled.
1920
@@ -127,14 +128,14 @@ Returns C<True> if the routine is a stub
127128
128129
multi sub trait_mod:<is>(Routine $r, :$cached!)
129130
130-
B<NOTE:> this feature is currently EXPERIMENTAL.
131-
132-
Causes the return value of a routine to be stored, so that when subsequent
133-
calls with the same list of arguments are made, the stored value can be
134-
returned immediately instead of re-running the routine.
131+
Causes the return value of a routine to be stored, so that when subsequent calls
132+
with the same list of arguments are made, the stored value can be returned
133+
immediately instead of re-running the routine.N<This is still in experimental
134+
stage. Please check
135+
L<the corresponding section in the experimental features document|/language/experimental#cached>>
135136
136137
Useful when storing and returning the computed value is much faster than
137-
re-computing it every time, and when the time saving trumps the cost of the
138+
re-computing it every time, and when the time saved trumps the cost of the
138139
use of more memory.
139140
140141
Even if the arguments passed to the routine are "reference types" (such as
@@ -146,6 +147,9 @@ case:
146147
say foo( [1, 2, 3] ); # runs foo
147148
say foo( [1, 2, 3] ); # doesn't run foo, uses cached value
148149
150+
Since it's still at the experimental stage, you will have to insert the C<use
151+
experimental :cached;> statement in any module or script that uses it.
152+
149153
=begin code
150154
use experimental :cached;
151155
@@ -355,4 +359,4 @@ TODO: explain export tags
355359
356360
=end pod
357361

358-
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6
362+
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)