Concept: Partial

Abstract

Capable of being defined in several different source files which are merged at compile time and treated as though they were all one source file.

Body

A class of databases being partial does not simply mean that all of your .dbc files are concatenated prior to compilation. Instead it means that each one is parsed, then the parse trees are logically merged together into a single tree. That tree is what gets compiled so, to the compiler, it is as though you put everything in one .dbc file.

Take for instance, the following two files. If they were simple concatenated, then DataClass would think you wanted two databases with the exact same name.

You can click on keywords and concepts in blue.
handdatabase X { version 1.0 : initialized { } }

X-1.0.cs

You can click on keywords and concepts in blue.
handdatabase X { version 2.0 : 1.0 { } }

X-2.0.cs

However, because database classes are partial, this is what the compiler sees after parsing:

You can click on keywords and concepts in blue.
handdatabase X {
  version 1.0 : initialized { }
  version 2.0 : 1.0 { }
}

Note that not all structures are partial. In DataClass, only database classes are. Versions and their constituents are non-partial. So the following code would fail to compile:

You can click on keywords and concepts in blue.
handdatabase X {
  version 1.0 : initialized { }
  version 1.0 : initialized { }
}

Related Use Cases

Related Concepts

Related Keywords

Other Actions

documentation | all examples | use cases | concepts | keywords