> >From S6:
> The call to .wrap returns a unique identifier that can later be passed
> to the .unwrap method, to undo the wrapping:
> Can we add a suppressable warning (similar to "useless use of <foo> in
> void context") that says "Id of wrapped function not stored; you will
> not be able to unwrap '<foo>'"?
Hmmm, I don't think that's necessary. Actually, I wouldn't be surprised in the
least if perl had the introspective power to unwrap a subroutine without that
$id, and if it doesn't I don't see the purpose in forcing it being stored if
you never want to undo the wrap.
However, I do wonder whether the unwrap is as streamlined as it could be.
looks to me like you need to store two things if you want to be able to undo a
wrap, and one is wholy dependant on the other. Why can't the identifier
returned be some structure that contains both?
$handle = &thermo.wrap(&wrapper);
It particularly seems useful if you're writing a module that wraps many subs.
There's no reason you should have to store references to all the subs along
with the ids. Actually, I'd argue that .unwrap could be named .undo, and in
general other things could return a handle that could undo them, though I can't
think of any examples off the top of my head.
perl -le '$_=(split q,",,`$^Xdoc -q japh`).".";y/pj/PJ/;print'