[C++-sig] Re: Pyste: support for user defined code.

Nicodemus nicodemus at globalite.com.br
Sun Aug 17 03:32:45 CEST 2003


Hi David,

David Abrahams wrote:

>Nicodemus <nicodemus at globalite.com.br> writes:
>
>
>>Yeah, no problem. The ordering is kept, since the exporters are kept
>>in a list.
>>
>>So, how about this interface:
>>
>>add_include('header1', 'header2', 'header3')
>>add_code(MODULE, <code>)
>>add_code(DECLARATION, <code>)
>>add_code(GLOBAL_DECLARATION, <code>)  # outside the namespace
>>
>
>What about, simply:
>
>    include('header1', 'header2', 'header3')
>    code(MODULE, <code>)
>    code(DECLARATION, <code>)
>    code(GLOBAL_DECLARATION, <code>)  # outside the namespace
>
>Or:
>
>    include('header1', 'header2', 'header3')
>    inline(MODULE, <code>)
>    inline(DECLARATION, <code>)
>    inline(GLOBAL_DECLARATION, <code>)  # outside the namespace
>
>But what are those ALL_CAPS names?
>

Hmm, agreed, those "add" are redundant anyway, and I like "code" better 
than "include". 8)

The names in caps indicates the sections in the source file where the 
code should go:

#include <boost/python.hpp>
<INCLUDE SECTION>

<GLOBAL_DECLARATION SECTION>

namespace {

<DECLARATION SECTION>

}

BOOST_PYTHON_MODULE(module)
{
    <MODULE SECTION>
}

I think it is interesting to let the user add code arbitrarly in the 
source file, but I might be wrong.

Thanks for the input!
Nicodemus.






More information about the Cplusplus-sig mailing list