borglab / borglab/wrap

Reuse namespaces

Open
#100 6 comments 0 reactions 0 assignees View on GitHub
feature help wanted
Dominant language
C++
Stars
37
Forks
17
Avg merge
1d 4h
Merged PRs (30d)
9

Description

Currently, I believe the wrapper will break if you open, close, then reopen a namespace. For example:

```c++
namespace ns {
int a = 5;
}

namespace ns {
int b = 6;
}
```

Since the wrapper is not smart enough to realize that these are the same and hence it doesn't have to redefine the submodule `pybind11::module m_ns = ...`.

Aside from minor inconveniences of writing a `.i` file to remember to put all the stuff from a namespace at the same place, this causes issues using `combine_interface_headers` which just copy-pastes the contents together. Thus if you want to "add" to a namespace from a different interface header, it won't work.

Not sure whether or not the goal of having a nice pybind way to #include other `.i` files would be able to handle this, or if we just need some intelligent way of keeping track which namespaces have been handled. For example, a 2-pass approach: first go through all the namespaces and just define them and keep a `set()` of defined namespaces, then second pass do all the "real" wrapping.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.