Re: Re: syntax suggestion

Alexander Nasonov <[email protected]>
Newsgroups gmane.comp.lib.boost.langbinding
Message-ID <[email protected]>
On Thursday 04 March 2004 19:22, David Abrahams wrote:
> You can fix that by treating the result of the whole expression as an
> AST and evaluating it afterwards, but as I said, I worry about the
> compile-time costs.

Major cases are already pointed out by Daniel:

Daniel Wallin wrote:
> There are at least two cases where it won't work:
> 
> struct A { void f(); }
> struct B : A {};
> 
> class_<B>("B") [
> def("f", &B::f) // signature is void(A::*)() but A isn't
> // wrapped.
> ]
>
> and the most trivial..
> 
> class_<A>("A") [
> def(constructor<>()) // Error, we need to explicitly mention
> ]                        // the wrapped type for every constructor
> 

I agree that AST for the latter case cannot be eliminated. Though, I believe 
the former case can be represented internally as a template parameterizied 
only by a list of classes used in member pointers. The example exposes 
&B::foo which is actually &A::foo, therefore, mpl::list<A> would suffice. 
class_<B> needs mpl::list<A>for conversion from B* to A*. It's trivial to 
call A::foo after this conversion is applied.
Not the best but much better then AST of all class entities.
-- 
Alexander Nasonov
Independent Developer & Consultant
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQBAR5mPK8n/CZPtRx4RAh/QAJ9zqBluLMQ1GQR/NSyY9VkfmF+TWgCeJ9al
REnu2MbkAVPYhN9IpvEA/Sc=
=Qo8X
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.