On Wed, May 30, 2007 at 09:13:36AM -0700, [EMAIL PROTECTED] wrote:
> +the hash, the return value need not be recalculated.  If you use
> +this trait, the compiler will assume two things:
> +
> +=over
> +
> +=item *
> +
> +A given C<Capture> would always calculate the same return value.  That is,
> +there is no state hidden within the dynamic scope of the call.
> +
> +=item *
> +
> +The cache lookup is likely to be more efficient than recalculating
> +the value in at least some cases, because either most uncached calls
> +would be slower (and reduce throughput), or you're trying to avoid a
> +significant number of pathological cases that are unacceptably slow
> +(and increase latency).

It seems to me that the first item is only half an item: the compiler
also has to assume that evaluating the function has no side effects, or
at least is idempotent in that the side effects only happen the first
time you call it on a given Capture. Actually, that distinction raises
another point in my mind: will there be a way to distinguish pure
functions with no side-effects at all, which if called on constants are
candidates for being hoisted into BEGIN blocks, from merely idempotent
subs, which must not be called until runtime but can be memoized?

Even if there is such a distinction, and it is covered elsewhere
(reading Synopsis diffs spaghettifies them in my mind, I'm afraid), I
think the difference should be mentioned here.

"I think you look like the Mona Lisa.  You always seem to be at a window
admiring the landscape that is actually behind you."    Herve Le Tellier
http://surreal.istic.org/                            Why did you resign?

Attachment: signature.asc
Description: Digital signature

Reply via email to