Partial Classes in DWScript
Partial classes allow to split the definition and implementation of a class over multiple files, or over multiple sections of the same file. Partial declarations must have the same modifiers (abstract, sealed, static…), must specify the same ancestor (or none), however each partial declaration is allowed to introduce new interfaces and their implementations.
Partial class can have multiple purposes, to quote wikipedia:
- Facilitates the implementation of code generators that have to “inject” code declarations/implementations that comes form other descriptions, such as a Visual UI designer, data and string resources, etc.
- Enables separation of concerns, in a way similar to aspect-oriented programming but without using any extra tools.
- Enables optionally composited functionality, which can be omitted or substituted depending on target or requirements..
Enables separation of a class’s interface and implementation code in a unique way. (irrelevant for Pascal!)
- Enables multiple developers to work on a single class concurrently without the need to merge individual code into one file at a later time.
- Eases navigation through large classes within a editor.