gnulib-tool-py
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnulib-tool-py] GLModule, GLFileSystem, modcache and func_cache_lookup_


From: Dmitriy Selyutin
Subject: [gnulib-tool-py] GLModule, GLFileSystem, modcache and func_cache_lookup_module
Date: Mon, 25 Jun 2012 18:02:48 +0400

Hello everyone!

Sorry for being annoying with questions, but I really need your help.
It is hard to understand what happens func_cache_lookup_module.
What does mean $have_associative? I've found such lines of the code:

if (declare -A x && { x[f/2]='foo'; x[f/3]='bar'; eval test
'${x[f/2]}' = foo; }) 2>/dev/null; then
  # Zsh 4 and Bash 4 have associative arrays.
  have_associative=true
else
  # For other shells, use 'eval' with computed shell variable names.
  have_associative=false
fi

As I can understand, it is the same as Python's dict object, which has
pair of key and value for each member of the array. If I am right,
this implements something like this: if module was already searched,
then add it to the list of already searched modules. If not, try to
find it again. However, it is still hard to understand what is cached:
module name? And what is the best way to do it?

If we just need to store the names of the already searched modules (or
to store their GLModule instances, which is seems to be better), I
suggest such implementation in the GLModuleSystem class:

1. We add new attribute self.args['cache'] = list()
2. Each time when we run GLFileSystem.find(module) successfully, we
add the new module to list. But before we check whether it was not
searched already, and if yes, do nothing.

Am I right?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]