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

Nicodemus nicodemus at globalite.com.br
Sun Aug 17 20:34:40 CEST 2003

Prabhu Ramachandran wrote:

>>>>>>"ND" == Niall Douglas <s_sourceforge at nedprod.com> writes:
>    ND> On 16 Aug 2003 at 16:51, Nicodemus wrote:
>    >> add_include('header1', 'header2', 'header3') add_code(MODULE,
>    ND> This seems to me to add complexity where you don't need
>    ND> it. You should have an "Include()" directive which lets you
>    ND> place includes before at the top, after that, module
>    ND> definitions etc.
>    ND> Then you place all the relevent code you want to insert into
>    ND> .cpp files which are then #include'd by the Include() in the
>    ND> right place.
>    ND> This makes keeping bits separate and maintainable much
>    ND> easier. It's what I use myself here using a python script to
>    ND> postprocess the pyste output.
>I beg to differ.  
> 1. In the suggested case (add_header, add_code etc.)  the source for
>    the generated .cpp file is *already* in one easy to maintain place
>    viz the .pyste file.  So I see no maintainability issue here since
>    the source is in one place already.  Splitting already well
>    organized bits into smaller pieces leads to confusion since code
>    fragments that are logically related are now spread over several
>    files.
> 2. The current approach allows users to do exactly what they want.
>    In fact, you can still include whatever files you want to in the
>    relevant sections.  So while the "include" approach straight
>    jackets the user, the more generic approach is totally flexible
>    and will also work for you.
> 3. Splitting files into smaller bits is possible when you have a few
>    files.  When you already have several .pyste files (around 40 in
>    my case) adding two or three more files per pyste file just to
>    expose a std::vector or add user defined code leads to an
>    unmanageable number of files.

I agree with Prabhu, specially because with this approach you can do 
what you want, Niall:

code_module('#include "my_header.h"')

It's not that much complexity added, in my opinion. 8)

More information about the Cplusplus-sig mailing list