[plt-scheme] maintaining a cached list of modules

From: Jose A. Ortega Ruiz (jao at gnu.org)
Date: Fri May 8 06:55:40 EDT 2009

Neil Van Dyke <neil at neilvandyke.org> writes:

> Jose A. Ortega Ruiz wrote at 05/07/2009 08:24 PM:
>> I've just written a bit of Scheme code that traverses the collection
>> directories and creates a list of available modules (so that i can get
>> module path completion in emacs). Since it's a big list, i cache it; but
>> now imagine that i require, say, a new PLaneT package in the same
>> mzscheme session: my cache becomes stale. Is there any way of
>> 'intercepting' calls to REQUIRE, or some other technique allowing me to
>> keep the module list fresh?
> I think it would be easiest and least intrusive to check the mtime on
> the parent directories on demand, to see if you need to rescan them to
> build your caches.
> I think this will be fast enough to be imperceptible to an interactive user.
> (Actually, building the list each time should be very fast on most
> subsequent builds, given that contemporary computers typically have
> enough RAM to cache directory info in RAM, so no disk I/O typically
> required.)

You're probably right here, but the list is big enough (around 3200
entries) that there's a perceptible (if small) delay while emacs is
talking with mzscheme to retrieve it, and i want to avoid also that


Posted on the users mailing list.