in reply to forcing contexts and micro-efficiency
While you're on the subject you ought to check out Damian Conway's Contextual::Return. It lets you specify explicitly (rather than through obscure tricks) what behavior subs will take under various contexts. The control is very fine grained, even letting you specify boolean behavior, numeric behavior, and so on.
Documented in its own POD, as well as Perl Best Practices, chapter 9.
It's probably not useful as a micro-optimization. But 97% of the time you wouldn't want to care about such things anyway. :) And when you run into one of those 3% situations, be sure to document well why an obscure trick has been applied.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: forcing contexts and micro-efficiency
by BrowserUk (Patriarch) on Nov 01, 2011 at 20:00 UTC |