Why the fast_* slots?
Jeremy @ Cowgar
jeremy at cowgar.com
Fri Jul 31 13:05:12 UTC 2009
Hello Lisaac,
I am curious, when looking at the API (right now ABSTRACT_STRING) I
see all sorts of fast_* slots then non fast_ slots that simply call
the equivelent fast_* slot. An example is:
- fast_last_index_of ch:CHARACTER :INTEGER <-
// Gives the index of the last occurrence `ch' or
// 0 if none.
(+ result:INTEGER;
result := 1 + storage.fast_reverse_index_of ch from (upper-1);
? {(result != 0) ->> {item result = ch}};
result
);
- last_index_of c:CHARACTER :INTEGER <-
// Index of last occurrence of `c' at index upper or before index upper.
(
fast_last_index_of c
);
Why is this? It seems to be duplicating a lot of work and making the
API confusing. We have two slots that do the same thing, we have to
duplicate the slot definition (with a different name of course),
then the parameters, the return type, and the documentation (which is
different in the above example).
Further, why would one use last_index_of instead of fast_last_index_of?
The existence of fast_last_index_of would infer that last_index_of
is a "slow" last_index_of.
--
Best regards,
Jeremy mailto:jeremy at cowgar.com
More information about the Lisaac-devel
mailing list