Skip to content

Commit 2dd13df

Browse files
committed
Don't use private class WrapHandle
The WrapHandle class: o Isn't actual part of the signature of these methods o Is a private class (internal to the methods on Routine), so we can't refer to it at this level and expect the signatures to compile. also fix a typo. Closes #1254
1 parent 3cf943d commit 2dd13df

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

doc/Type/Routine.pod6

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,24 @@ methods, the first element of the Capture needs to be the invocant:
9090
9191
=head2 method wrap
9292
93-
method wrap(Routine:D: &wrapper --> WrapHandle:D)
93+
method wrap(Routine:D: &wrapper)
9494
9595
Wraps (i.e. in-place modifies) the routine. That means a call to this routine
9696
first calls C<&wrapper>, which then can (but doesn't have to) call the
9797
original routine with the C<callsame>, C<callwith>, C<nextsame> and
9898
C<nextwith> dispatchers. The return value from the routine is also
9999
the return value from the wrapper.
100100
101-
C<wrap> returns a L<WrapHandle|/type/WrapHandle>, which you can pass to L<unwrap> to restore
102-
the original routine.
101+
C<wrap> returns an instance of a private class called L<WrapHandle|/type/WrapHandle>,
102+
which you can pass to L<unwrap> to restore the original routine.
103103
104104
=head2 method unwrap
105105
106-
method unwrap(Routine:D: WrapHandle $wraphandle)
106+
method unwrap($wraphandle)
107107
108-
Restores the original routine after it has been wrapped with L<wrap>.
108+
Restores the original routine after it has been wrapped with L<wrap>. While
109+
the signature allows any type to be passed, only the L<WrapHandle|/type/WrapHandle>
110+
type returned from C<wrap> can usefully be.
109111
110112
=head2 method yada
111113

doc/Type/WrapHandle.pod6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
class WrapHandle { ... }
88
9-
C<WrapHandle> is created and returned by L<wrap|/type/Routine#method_wrap>. It's only use is to unwrap wrapped routines. Either call L<unwrap|/type/Routine#method_unwrap> on a routine object or call the method C<restore> on a C<WrapHandle> object.
9+
C<WrapHandle> is created and returned by L<wrap|/type/Routine#method_wrap>. Its only use is to unwrap wrapped routines. Either call L<unwrap|/type/Routine#method_unwrap> on a routine object or call the method C<restore> on a C<WrapHandle> object.
1010
1111
sub f() { say 'f was called' }
1212
my $wrap-handle = &f.wrap({ say 'before'; callsame; say 'after' });

0 commit comments

Comments
 (0)