On Monday, November 11, 2002, at 02:19  AM, Damian Conway wrote:
One of the reasons I like C<cached> is because it does specify
exactly the way the subroutine is to behave (i.e. be called the first time,
and not called every subsequent time the same arguments are supplied). So
I can do nasty^H^H^H^H^Hhandy things like giving the sub side-effects, in
the sure knowledge that they won't be invoked more than once.

With C<pure> I can never be sure what optimizations the compiler is
or isn't going to make, or even whether those optimzations will be the
same from platform to platform [*]. So I can never be sure what the
precise behaviour of my sub will be. :-(
Amen. The more abstract or metaphorical the name, the more difficult it is to be really sure of what it does. Of the choices, "cached" seems by far the most self-explanatory. If we used "pure", we'd have to teach people what "pure" means, which would be much harder than teaching them what "cached" means.

MikeL



Reply via email to