[C++-sig] pyplusplus ui / API

Nat Goodspeed ngoodspeed at solidworks.com
Tue Feb 14 17:07:28 CET 2006

> -----Original Message-----
> From: c++-sig-bounces at python.org [mailto:c++-sig-bounces at python.org]
> Behalf Of Allen Bierbaum
> Sent: Tuesday, February 14, 2006 9:52 AM
> To: Development of Python/C++ integration
> Subject: Re: [C++-sig] pyplusplus ui / API
> > 1. What about code creators? Code creators is very powerful concept.
> This is an area where I am at a loss as to how to handle this.  If we
> are "filtering" and making decisions based on the decl tree it seems
> like the cleanest interface to the user would be to allow them to make
> some of these customizations in that gccxml tree.  Unfortunately this
> tree does not have the code generators yet since it is really used to
> create the code generators.
> One idea I did have is that we graft on new nodes to the decl tree
> that are custom to pyplusplus without extending gccxml.  For example
> we could add a custom_code_t derived from declarations_t that could be
> added into the declaration tree by the user to add code anywhere.
> Similarly there could be a new node for implicitly_convertibles and so
> on.
> Is it possible for the code creators to read from something like this
> and create the correct creators?  We would lose some power with an
> interface like this though so I think it would be important to allow
> direct access to the code creators after they have been instantiated.

[Nat] Maybe I don't fully understand the discussion to date, and if so I
apologize. But I like the idea of working mostly in the pygccxml
declarations tree.

IIUC, what you have in mind is for the user to write code to decorate
that tree, then hand off the decorated tree to pyplusplus and poof!
pyplusplus does all the rest.

But would it make any sense to expose two distinct pyplusplus steps?

0. pygccxml creates the declarations tree
1. user code decorates the decl tree
2. ==> call first pyplusplus step to read decl tree and instantiate code
3. power user code now has the opportunity to mess with code creators
4. ==> call second pyplusplus step to perform all the rest of the

Of course for simple cases (no step 3 intervention required) you could
have a convenience routine that does both -- as long as the
documentation makes very clear that your convenience routine is nothing
more than


(or whatever the applicable names are for steps 2 and 4 above)

On the other hand, if you can make it that easy to compose the two
pyplusplus steps, maybe it's better to avoid the convenience function so
there's never any question about the user's opportunity to intervene
before the second call.

More information about the Cplusplus-sig mailing list