[Ecls-list] [Suggestion] Caching expansion of type-specifier

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Sun Nov 29 19:06:00 UTC 2009


On Sun, Nov 29, 2009 at 7:20 PM, Gabriel Dos Reis
<gdr at integrable-solutions.net> wrote:
> Well, I'm not sure how frequent are those exotic cases, and why
> they should weight more than the common cases.

No, well, the question is not whether they should weight more, but
whether they do count at all. If they count at all, then caching is
impossible.

"Clever" caching is not an option. How does one determine when caching
is possible? I would say that determining when a DEFTYPE function is
candidate for caching is an NP-complete problem by itself.

The problem with DEFTYPE is that it is defined to be a rather generic
function without constraints on side effects. If we eliminate the
possibility of side effects and dictate that the number of times that
DEFTYPE is invoked is completely arbitrary and unspecified, then it is
ok with caching. I would say that this is the spirit of the
specification, though.

But there are other concerns. For instance the cost of caching. ECL
does not do recursive expansion of DEFTYPE types right now. All
algorithms such as TYPEP are recursive and run through types expanding
only the parts that are required. In this context caching the
expansion of the type is too expensive when compared just to a
function call which is needed to do a single expansion.

Juanjo

-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com




More information about the ecl-devel mailing list