On Tue, 13 Jan 2004 20:37:21 -0800 David Storrs <[EMAIL PROTECTED]> wrote:
> Given this code: > > if ( some_expensive_lookup_function() >= $MAX_RECORDS ) { > mark_that_we_have_reached_max_records(); > return; > } > > After I enter that block once, I never want to evaluate the condition > again--I want the code to completely disappear from the bytecode (or, > at least, be jumped around). How would I do that in Perl 6? Another approach would be to just memoize the subroutine. Thanks to the spiffy new subroutine signature syntax it's absurdly easy e.g sub some_expensive_lookup_function() is cached { ... } That's side-stepping the implications of memoizing a subroutine of course, but it does save maintaining state in user-level code. Dan