TallJimbo/bp3 — Issue #1: make public API more langbinding-ish
Author: TallJimbo
Created: 2012-02-12 15:33:35+00:00
State: open

The Boost.Langbinding proposal and Luabind provide an interface for wrapping C++ that has the potential to be the same for multiple target languages - and in many respects it's prettier too (e.g. inheritance syntax).

The goal is to modify the Boost.Python wrapping interface to look more like that API. We'll do this in several stages:

1. Add the new syntax in a new namespace to prevent conflicts with existing classes.

2. Use the existing classes to provide an the implementation for the new API.

3. Modify test and example code to use the new API.

4. Move the existing class to a detail namespace, and the new API to the main boost::python namespace.

Potential problems:

- The new API does not allow the wrapping syntax objects (e.g. `class_`) to immediately be used as Python objects (in other words, `class_` can no longer inherit from `object`). We need to ensure this doesn't close off opportunities for customization.

- The langbinding syntax involves creating a full module description up front before anything target-language-specific happens. We need to come up with an interface that allows people to add Python-specific customization at the same point in the code where they create the language-agnostic definition, even if the customization code isn't executed until later. I'm imagining some sort of callback that would be passed something like the current `class_` object and be able to do Python-specific things to it that would be executed at module-import time.