[C++-sig] Boost.Python code generator

David Abrahams dave at boost-consulting.com
Thu Dec 5 03:32:29 CET 2002

Nicodemus <nicodemus at globalite.com.br> writes:

> David Abrahams wrote:
>>Why invent such radical new syntax? It's neither C++-like nor
>> Python-like Wouldn't       virtual void foo(int);
>>work better?
> Hello David,
> Because it would break the C++ syntax in other cases. The simple "def"
> would have to change too, since now the user has to declare types:
> Instead of:
>     def bar
> The user would now have to write:
>     void bar(int x, double y, float z);     To maintain consistency.

But your example declared types, if I'm not mistaken. Here it is

      def foo (virtual void-int)

Why not dispense with "def" and let the user just write


In the case where there's nothing to deduce?

> Also, I want to add some other directives, like for example "rename",
> which lets the user rename a function. How do that in a syntax similar
> to C++?
>     void bar(int x); rename MyBar;
> Seems weird, most likely to confuse.
>     void bar(int x); // rename MyBar
> would be better, maybe.

      void bar(int x) as MyBar

      bar as MyBar

in the case where there are no overloads or default arguments has a
nice ring to it.

> My idea is to include in the interface *only* the minimum that boost
> needs to generate the wrapper code. Using a different and consistent
> interface, seems to me a good idea in this case.
> But the objective of my post is to discuss the idea... the
> interface-file syntax is not definite, and will likely change.

Brad King has been talking about extending CABLE using GCC_XML as a
front-end and Boost.Python as a back end. I think I'd rather see the
two of you cooperate on that direction... but don't let that thwart
your enthusiasm, if you're really motivated to pursue this one! One
wrapper generator is better than none.

but-are-two-better-than-one-ly y'rs,
                       David Abrahams
   dave at boost-consulting.com * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

More information about the Cplusplus-sig mailing list