method wrap

Documentation for method wrap assembled from the following types:

class Routine

From Routine

(Routine) method wrap

method wrap(Routine:D: &wrapper)

Wraps (i.e. in-place modifies) the routine. That means a call to this routine first calls &wrapper, which then can (but doesn't have to) call the original routine with the callsame, callwith, nextsame and nextwith dispatchers. The return value from the routine is also the return value from the wrapper.

wrap returns an instance of a private class called Routine::WrapHandle, which you can pass to unwrap to restore the original routine.