Peter Buckingham wrote:
> but the obvious question is if
> it isn't an idempotent function what do we do? do we abort? perhaps the real
> question is not whether we can require idempotency but what are we trying to
> achieve with it --- there may be another way :)

It is easy enough to test if the function ever fails idempotency.
And it is also easy to decide we'll chuck a warning when it does.

The REAL issue is whether we really want to test for idempotency.
Sure, it's easy, but it is not cheap.  Do we want to pay the cost?
It requires caching the values from every call, but STILL calling
the function every time.  You know, if we're going to cache the
result, we may as well use it, i.e. memoize.

Unless, of course, the optimizer can't assume the function has
no side-effects.

-- 
John Porter

Give the braindead no head.

Reply via email to