Proposed improvements to the separate compilation model

Rob T alanb at ucora.com
Tue Mar 5 17:34:23 PST 2013


On Tuesday, 5 March 2013 at 00:41:23 UTC, Andrej Mitrovic wrote:
>  3/5/13, Rob T <alanb at ucora.com> wrote:
>> In that case it would be nice to avoid most of the class name
>> duplication, that's one of the things I really disliked about 
>> C++.
>
> I guess you meant:
>
> class A
> {
>     class B;
> }
>
> class A.B
> {
>     // implementation
> }
>
> Ideally both styles would be supported.

Actually I had meant this instead, which reduces duplication

class A
{

}

class A.B
{
     // implementation
}

There should be no need to define class B inside class A, because 
the compiler can easily know that class A.B means that B is 
included inside A. It adds on some more work for the compiler, 
but it's doable.

However, I'm not so sure how useful such a thing really is if all 
it does is save on adding indentations for sub classes.

--rt


More information about the Digitalmars-d mailing list