|
Boost : |
From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-05-10 09:33:42
"Jonathan Turkanis" <technews_at_[hidden]> wrote
> I would like to propose the proposed Boost Interfaces library, which I
> introduced several months ago, for formal review. (Or maybe I should say:
I'd
> like to nominate the candidate Boost Interfaces library.)
>
> See http://www.kangaroologic.com/interfaces/ for download and
documentation.
Hi Jonathan,
I took a look at the documentation, and I think, the library could be very
useful. If I understand correctly, one of applications would be to apply
dynamically polymorphic proxies to statically polymotphic objects, in order,
to, for example, put them into a container. I had similar problem in the
past, and solved it by hand.
I have one quetion/suggestion:
Do you think your macro interface is flexible enough to incorporate all your
future enhancements? I mean, if you have something like:
BOOST_IDL_BEGIN(IPoint)
BOOST_IDL_CONST_FN0(x, long)
BOOST_IDL_CONST_FN0(y, long)
BOOST_IDL_FN1(x, void, long)
BOOST_IDL_FN1(y, void, long)
BOOST_IDL_END(IPoint),
you can only expand it to something that have the fixed structure: start
block, one block per every function, and then closing block. You cannot,
for example generate more than one class. I don't know if this restriction
is too strong, though. It depends on what you want to do next.
The other (minor) problem is that your user has to repeat the interface name
twice.
So, what I am leading to, is, that,using the technique described in
http://lists.boost.org/MailArchives/boost/msg79530.php, you could remove the
above restrictions, and achieve something like following:
BOOST_IDL(IPoint,
BOOST_IDL_CONST_FN0(x, long)
BOOST_IDL_CONST_FN0(y, long)
BOOST_IDL_FN1(x, void, long)
BOOST_IDL_FN1(y, void, long)
)
or, if you are willing to treat macro prefixes for a couple of extra
parenthesis,
BOOST_IDL(IPoint,
(CONST_FN0(long, x))
(CONST_FN0(long, y))
(FN1(void, x, long))
(FN1(void, y, long))
)
The drawback would be that this would imply a little more involved
preprocessor programming. I don't know how you feel about it. In any case,
using the above mentioned technique, you can keep it well structured and
easily extendable.
If you are interested, I can give you more details.
Regards,
Arkadiy
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk