-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
Problem description
The use of _ as a function in detail/descr.h conflicts with the common macro usage of _() to denote gettext().
The use of _ for translation is baked into multiple programs, e.g. wxFormBuilder to generate code for frameworks (wxWidgets) that expect the macro.
While this macro is only a suggestion in the gettext manual [1], it is built into expectations[2][3][4][5].
Since the pybind11 usage is internal, would we be able to rename the pybind11 functions from _ to something similarly short like x?
[1] http://www.gnu.org/software/gettext/manual/gettext.html#Overview
[2] https://forums.wxwidgets.org/viewtopic.php?t=19062
[3] https://stackoverflow.com/q/15244397/995714
[4] https://stackoverflow.com/q/15244397/995714
[5] https://stackoverflow.com/questions/3336056/underscore-before-the-format-string
Reproducible example code
#define _(s) gettext(s)
#include <pybind11/pybind11.h>
namespace py = pybind11;
PYBIND11_MODULE(gettext_test, m) {
m.attr("test") = "test";
}