Re: [pygccxml-development] recursive import trick
Brought to you by:
mbaas,
roman_yakovenko
|
From: Roman Y. <rom...@gm...> - 2006-07-26 14:19:12
|
On 7/26/06, Allen Bierbaum <al...@vr...> wrote:
> I was just trying to trace through the code in declarations.scopdef and
> I ran across a comment in declrations._init_.py about needing to use a
> rather interesting set of dictionaries in scopdef_t to inject some types
> for use when looking up matchers.
>
> There is a comment on line 223 saying this is to prevent recursive
> imports, but it doesn't go into details about what imports cause this
> issue. Could anyone shed some light on this?
In order to improve performance scopedef_t class instance contains few
dictionaries:
_type2decls, _type2name2decls, _type2decls_nr, _type2name2decls_nr.
( nr = none recursive )
Now, in order to build all those dict, it needs to know all
declarations types. This inlcudes
namespace_t and class_t. But scopedef_t is a base class for those classes.
So, I added 2 new class variables:
_impl_all_decl_types - this is a list of all declaration classes
_impl_decl_types - this is a dict that maps between scopedef_t
select method and
declaration class.
Did my explanation help?
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|