|
Boost : |
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-07-02 20:49:34
Joel de Guzman wrote:
> Jonathan Turkanis wrote:
>
>> I still haven't had time to think about Joel's proposal. However, I
>> did spend consider effort at one point trying to support simple
>> handwritten interfaces using ordinary member function syntax, and
>> convinced myself that it was probably not possible. This might be
>> because I had stronger requirements than Joel, though. Among other
>> things, I required:
>>
>> 1. support for derived interfaces, including MI
>> 2. interface instance, including those involving MI, should have the
>> size of a struct conatining two pointers (assuming the degree of EBO
>> currently provided by most compilers)
>> 3. It should be possible to define a const view const_view<IBar> of
>> an interface, in which non-const functions are disabled. (Ordinary
>> const-qualification is insufficient, since you can make a non-const
>> copy of a const interface instance)
>> 4. Implicit derived-to-base and non-const-to-const conversions
>> 5. Support for aspect oriented programming.
>
> Those are very good requirements.
Okay, good.
>> For 2 and 5 -- at least -- I concluded that interfaces need to
>> contain a nested rebind-like structure which allows them to be
>> reinstantiated with different base classes. Since it's redundant to
>> implement an interface's infrastructure twice, I put the rebind
>> stuff in a helper class, and made the actual interface derive from
>> an appropriate specialization of rebind. I was unable to find any
>> way for users to write this stuff by hand without going insane.
>>
>> The template-based IDL looks like it is potentially the most usable.
>
> Given your requirements, I have to agree. Daniel Wallin's macro
> based suggestion is also quite readable. The question now is:
> when will they be implemented?
I thought it would be done by now, but as usual I'm a bit behind schedule. The
interfaces library is definitely my most fun project, so I'm looking forward to
working on it soon. Right now, I'm working on a book which is supposed to be
done in less than three weeks.
>> The only
>> open question is whether compile-times will suffer unduly.
>
> That will only be answered when an implementation becomes available.
> In the meantime, I'll see if I can get another shot at it following
> your requirements.
I wish you the best of luck ;-)
Jonathan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk