[C++-sig] Re: Refactoring, Compilation Speed, Pyste, Lua/Ruby/JavaScript...

Brett Calcott brett.calcott at paradise.net.nz
Wed Jun 18 10:25:49 CEST 2003

> >
> > As somebody who has tried to go through the library, this bit is the
> > part I'd really like to understand. I'm sure the reorganisation
> > would help, but I'd really love to read a short doc on how this
> > actually all hangs together. The registry, how the templates
> > automates the construction of the PyObject and Type, how conversions
> > are looked up (what's that graph stuff in there?).
> The graph stuff is not in this layer, it's in the core.  It
> implements something like this:
>     dst_ptr = dynamic_cast(src_void_ptr, src_type_id, dst_type_id)

Ok. So I think I need to know about the core as well then.

> >
> > I think I could use the library better and assist more in extending it
if I
> > could put all the bits together in my head.(I have in mind something
> > the big text file that Joel wrote for Phoenix.)
> >
> > Just putting in a bid for your time Dave...
> Well, I'd be happy to collaborate with you on an implementation
> document.  It's not something I can afford to do by myself, in part
> because I don't know what questions to answer.  If you would agree to
> have a conversation with me about it here, and from that create a
> RestructuredText document which we'll include in the CVS, I'd be more
> than happy to type out details at length.  I think you might have to
> dig into the code a little, too.  Deal?

Deal. It be a bit slow at first as I am relocating to another country in the
next 10 days (NZ -> Aussie), so my internet connection will be sporadic, and
I'll be busy finding a new home and settling in.

I'd like to approach it as though we are trying to write a simplified
version of boost.python, ignoring compiler workarounds, and not using the
preproc. We'll show a coded python C extension, an equivalent in
boost.python syntax, then go through the structures needed for the
boost.python code to generate the equivalently operating C extension code
that we initially showed.

We could work through examples like the ones on this page :



python extension:
PyObject *python_add(self, args)....

PyMethodDef methods[] = {
    "add", MyCommand, METH_VARARGS},
    {NULL, NULL},

void initexample()
    (void)Py_InitModule("add", methods);

equivalent in boost
    def("add", python_add);

Explain how the boost example generated equivalent code to above using very
cut-down techniques that capture the 'essence' of the boost.python
implementation, but not the detail.
1. The module def
2. how is the methods array created (or simulated)
3. How does argument parsing happen..

Does this make sense?
Comments (from anyone)?


More information about the Cplusplus-sig mailing list