Split D class file
Julio César Carrascal Urquijo
jcarrascal at gmail.com
Mon Sep 24 20:02:16 PDT 2007
Hi
B.Schulte wrote:
> Hi!
>
> Is it somehow possible to store some methods of a class in another D file? The class is really getting too big.
>
> Well, maybe some of you suggest me to split the class in multiple ones, but this class is important to be one part. The only way would be to have many many friend classes. But that's also very strange.
I think you need Partial Class Definition. It has been requested before
but hasn't got much traction:
http://www.digitalmars.com/d/archives/digitalmars/D/14513.html
http://www.digitalmars.com/d/archives/digitalmars/D/Partial_class_implementation_55745.html
I think it's a very useful feature for external code generators. For
example:
* GUI code generated by a form designer stored in a Form.designer.d
file.
* Record structures generated from official specs (Something I've
personally dealt with in C# and CodeSmith and partial classes did
wonders).
* Model classes generated from a Database Schema. Very useful when the
schema changes and you have to update your database.
* etc...
I would really love to hear how difficult it would be to implement on
DMD or GDC because I really have no idea. Adding it to the language is
another matter.
Cheers.
--
Julio César Carrascal Urquijo
http://jcesar.totumo.net/
More information about the Digitalmars-d
mailing list