On Thu, 29 Mar 2012 11:31:57 +0200, Martin Drasar <dra...@ics.muni.cz>
wrote:
On 29.3.2012 11:16, simendsjo wrote:
D has interface files, .di. These can be automatically generated by the
compiler using the -H switch.
(snip)
I would like to split the X class definition into two files. One file
would implement methods of interface IA and another of interface IB. So
it would be like this:
myfunkyclassIA.d:
class X : IA, IB
{
void a()
{
}
}
myfunkyclassIB.d:
void b(X x)
{
}
Except using UFCS in this case does not work...
Martin
Your looking for partial classes? D doesn't have this as far as I know.
"alias this" should work for more than one value in the future, and then
(I think) you should be able to do something like this:
class XIB : IB {}
class XIA : IA {}
class X : IA, IB {
XIA xia;
XIB xib;
alias xia this;
alias xib this;
}
But you can also solve it with mixin templates:
mixin template XIA {
// all IA methods
}
mixin template XIB {
// all IB methods
}
class X : IA, IB {
mixin XIA!();
mixin XIB!();
}