[C++-sig] Re: Re: sub module support in V2

David Abrahams david.abrahams at rcn.com
Fri Jun 7 00:08:08 CEST 2002


Dave,

Thanks for spending time on this...

Remarks:

1. Please send a diff which can be used with the "patch" program
(preferably compatible with emacs' ediff-patch-file)

2. One of my design goals is to keep as much code out of extension modules
as possible. Thus

-    module(const char* name)
-        : base(name) {}
+     module(const char* name = detail::module_link().get_module_name())
+        : base(name, detail::module_link()) {}

this change ought to become two overloads.

Hmm...

If we don't need to pass arguments to the outer "module", maybe we should
dispense with it.
That would remove the need to break .add() chaining when classes have an
inheritance relationship... it would look like:

BOOST_PYTHON_MODULE_INIT(my_module)
{
   def("my_function", my_function);
   class_<my_class>("my_class")
      .def("memfn", &my_class::memfn)
       ...

   module("submodule")
   [
       def("my_function", my_function)
   ];
}

And, heck, we could use the same interface for class_ if we wanted to...

3. What's the rationale behind the name "module_link"?

4. Why are you creating a new module_link object here? That seems
needlessly expensive

5. You're not following my coding conventions (members begin with m_, no
other naming warts, aligned braces, lines less than 90 characters or so...)

6. What is the point of module_link's p_primary_module? It never gets moved
to point at anything else...

7. Initialize data members in member initializer lists

8. module_link::reset() can't throw; there's no point in complicating
BOOST_PYTHON_MODULE_INIT that way. Why don't you just stick the reset()
call in the outer init##name() function?

9. What is this all about? I've been testing against MSVC without problems
since the beginning, and I'm explicitly trying to avoid a virtual table:

     function(py_function, unsigned min_args, unsigned max_args = 0);
-    ~function();
+    // Must have virtual destructors else wrong operator delete is called
in MSVC
+    virtual ~function();

10. init_sub_module is too dense and under-commented for me to evaluate
quickly


----- Original Message -----
From: "Dave Hawkes" <daveh at cadlink.com>
Newsgroups: gmane.comp.python.c++
To: <c++-sig at python.org>
Sent: Thursday, June 06, 2002 4:52 PM
Subject: [C++-sig] Re: Re: sub module support in V2


> OK, here it is.
>
>
> "David Abrahams" <david.abrahams at rcn.com> wrote in message
> news:1d9501c20d9a$1e8013b0$6601a8c0 at boostconsulting.com...
> >
> > ----- Original Message -----
> > From: "Dave Hawkes" <daveh at cadlink.com>
> >
> >
> > > I have a preliminary patch available against the current CVS (no
tests
> or
> > > docs yet...). There's a few rough edges and some tidying up to do,
but
> > it's
> > > a good proof of concept. Should I email it to you directly or to this
> > list?
> > > Its about 10k in size.
> >
> > Please check it again against the current state; I just did a massive
> > checkin :-(
> >
> > Then please send it to me or post it, compressed (your choice)
> >
> > -Dave
>
>
>


---------------------------------------------------------------------------
-----


>
>
>
>
>
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig






More information about the Cplusplus-sig mailing list