Compile-time link type object management
A compile-time link type manager is defined to facilitate development of source code with disciplined link type object management at runtime. In one aspect, the link type manager ensures that all link type object management constructs have associated event handlers. Additionally, an event handler can be evaluated at compile time to ensure that it meets certain conditions for the particular link type, referred to as link-type criteria.
1 . A method of compiling source code, the method comprising:
encountering, in the source code, an object-management construct directed to a data type for defining an object, the object-management construct defining object-management instructions for affecting the object;
searching for an event-handler construct in the source code, the event-handler construct assigned to the object-management construct and the data type, the event-handler construct defining event-handler instructions to execute at runtime;
evaluating the event-handler construct to determine whether the event-handler construct defines event-handler instructions satisfying predetermined criteria; and
compiling, responsive to the event-handler instructions satisfying the predetermined criteria, a first intermediate-language representation corresponding to the object-management construct operating on the data type.
2 . The method of claim 1 , further comprising flagging an error responsive to an absence of the event handler.
3 . The method of claim 1 , wherein the object-management construct comprises at least one of a delete construct, a create construct, and an update construct.
4 . The method of claim 1 , wherein the source code comprises:
a second data type for defining a second object, the second data type referencing the data type, such that the second object is linked to the object.
5 . The method of claim 1 , further comprising flagging an error responsive to the event-handler instructions not satisfying the predetermined criteria.
6 . The method of claim 1 , further comprising:
compiling a second intermediate-language representation corresponding to the event-handler construct operating on the object-management construct and the data type.
7 . The method of claim 1 , wherein the predetermined criteria comprises determining the event-handler instructions include:
evaluating a constraint at runtime; and
preventing operation of the object-management construct at runtime responsive to the constraint being satisfied.
8 . The method of claim 1 , wherein the predetermined criteria comprises determining the event-handler instructions include identifying the existence of an independent data type object.
9 . The method of claim 8 , wherein the existence of the independent data type object is identified in accordance with an element of the independent data type object attributed as unique.
10 . The method of claim 1 , wherein the predetermined criteria comprises determining the event-handler instructions include identifying the existence of a dependent-link data type object.
11 . A system comprising:
a processor; and
a memory storing instructions that, when executed by the processor, cause the processor to:
encounter an object-management construct directed to a first data type for defining an object;
search for an event-handler construct assigned to the object-management construct and the data type;
evaluate the event-handler construct to determine whether it defines event-handler instructions satisfying predetermined criteria; and
compile, responsive to the event-handler instructions satisfying the predetermined criteria, an intermediate-language representation corresponding to the object-management construct operating on the data type.
12 . The system of claim 11 , wherein the object-management construct comprises a delete, create, or update construct.
13 . The system of claim 11 , wherein the instructions cause the processor to flag an error responsive to an absence of the event-handler construct.
14 . The system of claim 11 , wherein a source code comprises a second data type referencing the first data type, such that a second object of the second data type is linked to the object.
15 . The system of claim 11 , wherein the instructions further cause the processor to flag an error responsive to the event-handler instructions not satisfying predetermined criteria.
16 . The system of claim 11 , wherein the predetermined criteria comprise determining the event-handler instructions include evaluating a constraint at runtime and preventing operation of the object-management construct responsive to the constraint being satisfied.
17 . The system of claim 11 , wherein the predetermined criteria comprise determining the event-handler instructions include identifying the existence of an independent data type object.
18 . The system of claim 11 , wherein the predetermined criteria comprise determining the event-handler instructions include identifying the existence of a dependent-link data type object.
19 . The system of claim 11 , wherein the memory further stores instructions that, when executed by the processor, cause the processor to compile a second intermediate-language representation corresponding to the event-handler construct operating on the object-management construct and the data type.