1 | <!-- Copyright David Abrahams 2006. Distributed under the Boost --> |
---|
2 | <!-- Software License, Version 1.0. (See accompanying --> |
---|
3 | <!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) --> |
---|
4 | <html> |
---|
5 | <head> |
---|
6 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
7 | <link rel="stylesheet" type="text/css" href="../boost.css"> |
---|
8 | <title>Boost.Python - April 2002 Progress Report</title> |
---|
9 | </head> |
---|
10 | <body link="#0000ff" vlink="#800080"> |
---|
11 | <table border="0" cellpadding="7" cellspacing="0" width="100%" summary= |
---|
12 | "header"> |
---|
13 | <tr> |
---|
14 | <td valign="top" width="300"> |
---|
15 | <h3><a href="../../../../index.htm"><img height="86" width="277" alt= |
---|
16 | "C++ Boost" src="../../../../boost.png" border="0"></a></h3> |
---|
17 | </td> |
---|
18 | <td valign="top"> |
---|
19 | <h1 align="center"><a href="../index.html">Boost.Python</a></h1> |
---|
20 | <h2 align="center">April 2002 Progress Report</h2> |
---|
21 | </td> |
---|
22 | </tr> |
---|
23 | </table> |
---|
24 | <hr> |
---|
25 | <h2>Contents</h2> |
---|
26 | <dl class="index"> |
---|
27 | <dt><a href="#accomplishments">Accomplishments</a></dt> |
---|
28 | <dl class="index"> |
---|
29 | <dt><a href="#arity">Arbitrary Arity Support</a></dt> |
---|
30 | <dt><a href="#callbacks">New Callback Interface</a></dt> |
---|
31 | <dt><a href="#policies">Call Policies for Construtors</a></dt> |
---|
32 | <dt><a href="#bugs">Real Users, Real Bugs</a></dt> |
---|
33 | <dt><a href="#insights">New Insights</a></dt> |
---|
34 | <dt><a href="#v1">Boost.Python V1 Maintenance</a></dt> |
---|
35 | </dl> |
---|
36 | |
---|
37 | <dt><a href="#missing">What's Missing</a></dt> |
---|
38 | |
---|
39 | </dl> |
---|
40 | |
---|
41 | <h2><a name="accomplishments">Accomplishments</a></h2> |
---|
42 | |
---|
43 | April was a short month as far as Boost.Python was concerned, since |
---|
44 | the spring ISO C++ Committee Meeting (and associated vacation) |
---|
45 | occupied me for the 2nd half of the month. However, a suprising amount |
---|
46 | of work got done... |
---|
47 | |
---|
48 | <h3><a name="arity">Arbitrary Arity Support</a></h3> |
---|
49 | |
---|
50 | I began using the <a |
---|
51 | href="../../../preprocessor/doc/index.html">Boost.Preprocessor</a> |
---|
52 | metaprogramming library to generate support for functions and member |
---|
53 | functions of arbitrary arity, which was, to say the least, quite an |
---|
54 | adventure. The feedback cycle resulting from my foray into |
---|
55 | Boost.Preprocessor resulted in several improvements to the library, |
---|
56 | most notably in its documentation. |
---|
57 | |
---|
58 | <p> |
---|
59 | |
---|
60 | Boost.Python now supports calls of up to 17 arguments on most |
---|
61 | compilers. Because most EDG-based compilers have dismal preprocessor |
---|
62 | performance, I had to "manually" expand the metaprograms for |
---|
63 | arities from zero to fifteen arguments, and EDG-based compilers with |
---|
64 | <code>__EDG_VERSION__ <= 245</code> only support 15 |
---|
65 | arguments by default. If some crazy program finds a need for more than |
---|
66 | the default arity support, users can increase the base support by |
---|
67 | setting the <code>BOOST_PYTHON_MAX_ARITY</code> preprocessor symbol. |
---|
68 | |
---|
69 | <h3><a name="callbacks">New Callback Interface</a></h3> |
---|
70 | |
---|
71 | I mentioned in <a href="Mar2002.html">last month's report</a> that I |
---|
72 | wasn't pleased with the interface for the interface for calling into |
---|
73 | Python, so now it has been redesigned. The new interface is outlined |
---|
74 | in <a |
---|
75 | href="http://mail.python.org/pipermail/c++-sig/2002-April/000953.html">this |
---|
76 | message</a> (though the GCC 2.95.3 bugs have been fixed). |
---|
77 | |
---|
78 | <h3><a name="policies">Call Policies for Constructors</a></h3> |
---|
79 | |
---|
80 | On April 2nd, I <a |
---|
81 | href="http://mail.python.org/pipermail/c++-sig/2002-April/000916.html">announced</a> |
---|
82 | support for the use of call policies with constructors. |
---|
83 | |
---|
84 | <h3><a name="bugs">Real Users, Real Bugs</a></h3> |
---|
85 | |
---|
86 | At least two people outside of Kull began actually using Boost.Python |
---|
87 | v2 in earnest this month. Peter Bienstman and Pearu Pearson both |
---|
88 | provided valuable real-world bug reports that helped me to improve the |
---|
89 | library's robustness. |
---|
90 | |
---|
91 | <h3><a name="insights">New Insights</a></h3> |
---|
92 | |
---|
93 | <a |
---|
94 | href="http://mail.python.org/pipermail/c++-sig/2002-May/001010.html" |
---|
95 | >Answering some of Pearu's questions</a> about explicitly converting |
---|
96 | objects between Python and C++ actually led me to a new understanding |
---|
97 | of the role of the current conversion facilities. In Boost.Python v1, |
---|
98 | all conversions between Python and C++ were handled by a single family |
---|
99 | of functions, called <code>to_python()</code> and |
---|
100 | <code>from_python()</code>. Since the primary role of Boost.Python is |
---|
101 | to wrap C++ functions in Python, I used these names for the first kind |
---|
102 | of converters I needed: those that extract C++ objects to be used as |
---|
103 | function arguments and which C++ function return values to |
---|
104 | Python. The better-considered approach in Boost.Python v2 uses a |
---|
105 | completely different mechanism for conversions used when calling |
---|
106 | Python from C++, as in wrapped virtual function implementations. I |
---|
107 | usually think of this as a "callback", as in "calling |
---|
108 | back into Python", and I named the converters used in callbacks |
---|
109 | accordingly: <code>to_python_callback</code> and |
---|
110 | <code>from_python_callback</code>. However, as it turns out, the |
---|
111 | behavior of the "callback" converters is the appropriate one |
---|
112 | for users who want to explicitly extract a C++ value from a Python |
---|
113 | object, or create a Python object from a C++ value. The upshot is that |
---|
114 | it probably makes sense to change the name of the existing <code>to_python</code> and |
---|
115 | <code>from_python</code> so those names are available for the |
---|
116 | user-friendly explicit converters. |
---|
117 | |
---|
118 | <p> |
---|
119 | <a |
---|
120 | href="http://mail.python.org/pipermail/c++-sig/2002-May/001013.html">Another |
---|
121 | of Pearu's questions</a> pushes momentum further in the direction of a |
---|
122 | more-sophisticated overloading mechanism than the current |
---|
123 | simple-minded "first match" approach, as I suggested <a |
---|
124 | href="Mar2002.html#implicit_conversions">last month</a>. |
---|
125 | |
---|
126 | <h3><a name="v1">Boost.Python V1 Maintenance</a></h3> |
---|
127 | |
---|
128 | As much as I'm looking forward to retiring Boost.Python v1, a |
---|
129 | significant amount of effort has been being spent dealing with support |
---|
130 | problems; the saying that code rots when left alone is true, and |
---|
131 | Boost.Python is no exception. Eventually it became obvious to me that |
---|
132 | we were going to have to invest some effort in keeping V1 healthy |
---|
133 | while working on V2. Ralf and I have expanded support for various |
---|
134 | compilers and stabilized the V1 codebase considerably. We discarded |
---|
135 | the obsolete Visual Studio projects which were causing so much |
---|
136 | confusion. Still to do before the next Boost release: |
---|
137 | <ol> |
---|
138 | <li>Update the build/test documentation with detailed instructions for |
---|
139 | configuring various toolsets. |
---|
140 | <li>Provide some links to Boost.Python v2 to let people know what's |
---|
141 | coming. |
---|
142 | </ol> |
---|
143 | |
---|
144 | |
---|
145 | <h2><a name="missing">What's Missing</a></h2> |
---|
146 | |
---|
147 | Last month I announced that I would implement the following which are |
---|
148 | not yet complete: |
---|
149 | <ol> |
---|
150 | <li>Document all implemented features |
---|
151 | <li>Implement conversions for <code>char</code> types. This is |
---|
152 | implemented but not tested, so we have to assume it doesn't work. |
---|
153 | </ol> |
---|
154 | |
---|
155 | These are my first priority for this month (especially the |
---|
156 | documentation). |
---|
157 | |
---|
158 | <p>Revised |
---|
159 | <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> |
---|
160 | 13 November, 2002 |
---|
161 | <!--webbot bot="Timestamp" endspan i-checksum="39359" --> |
---|
162 | </p> |
---|
163 | <p><i>© Copyright <a href="../../../../people/dave_abrahams.htm">Dave Abrahams</a> |
---|
164 | 2002. </i></p> |
---|
165 | </body> |
---|
166 | </html> |
---|