partial class

Mike James foo at bar.com
Fri Oct 31 10:45:17 PDT 2008


Ary Borenszweig Wrote:

> Mike James wrote:
> > Not sure if this has been suggested before as an addition to D but what about introducing a partial class as per C# - with all the benefits it would bring...
> 
> To my understanding, partial classes were introduced by Microsoft to 
> make it easier for *them* to rewrite the UI code coming from a designer 
> without having to watch out for user code. That is, whenever you change 
> controls in the designer, now they just need to rewrite the .designer.cs 
> class and not worry about erasing or skipping code you defined besides 
> UI code.
> 
> Conclusion: the motivation is coming from the UI, and to make life 
> easier for them. (Maybe there are other reasons? I've been programming a 
> lot in C# lately, and I never needed a partial class)
> 
> Since D doesn't have a UI designer or nothing is integrated that much... 
> what would you use partial classes for?
> 
> If it's not for that reason, I think it makes it harder to know where 
> is defined the code you are looking for.

Yes - I was considering the UI case. Sometime soon D will grow from a "systems programming" language and maybe it would be useful to split that functionality. I have also seen the arguement put forward for when very large classes are created multiple software engineers can work on it - though whether this is a good argument for it I'm not sure.

Regards, Mike.



More information about the Digitalmars-d mailing list