diff --git a/doc/Type/Routine.pod6 b/doc/Type/Routine.pod6 index 0e91c7889..73eeb7034 100644 --- a/doc/Type/Routine.pod6 +++ b/doc/Type/Routine.pod6 @@ -6,14 +6,15 @@ class Routine is Block { } -A C is a code object meant for larger unities of code than L. -Routine is the common superclass for L (and therefore operators) and -L, the two primary code objects for code reuse. +A C is a code object meant for larger unities of code than +L. Routine is the common superclass for L (and +therefore operators) and L, the two primary code objects +for code reuse. Routines serve as a scope limiter for C (i.e. a C returns from the innermost outer Routine). -Routine is also the level at which +The routine level is also the one at which L (multi subs and multi methods) are handled. @@ -127,14 +128,14 @@ Returns C if the routine is a stub multi sub trait_mod:(Routine $r, :$cached!) -B this feature is currently EXPERIMENTAL. - -Causes the return value of a routine to be stored, so that when subsequent -calls with the same list of arguments are made, the stored value can be -returned immediately instead of re-running the routine. +Causes the return value of a routine to be stored, so that when subsequent calls +with the same list of arguments are made, the stored value can be returned +immediately instead of re-running the routine.N> Useful when storing and returning the computed value is much faster than -re-computing it every time, and when the time saving trumps the cost of the +re-computing it every time, and when the time saved trumps the cost of the use of more memory. Even if the arguments passed to the routine are "reference types" (such as @@ -146,6 +147,9 @@ case: say foo( [1, 2, 3] ); # runs foo say foo( [1, 2, 3] ); # doesn't run foo, uses cached value +Since it's still at the experimental stage, you will have to insert the C statement in any module or script that uses it. + =begin code use experimental :cached; @@ -355,4 +359,4 @@ TODO: explain export tags =end pod -# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6 \ No newline at end of file +# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6