Evolution Primitives in the CLE Note that this same information may be obtained by with the '-help -edit' command in the CLE. +---------------------+ | | | Static Primitives | | | +---------------------+ Static primitives are primitives that execute once to alter the structure of Vejal meta-data. '' as used below denotes a ',' seperated list of type identifiers, where a 'type identifier' is a name followed by an optional '<'/'>' delineated version. Version-less types can be bound by any evolution strategies present, but otherwise will not be valid references to actual class definitions. +--------------------------------+ | | | Static Primitive Declaration | | | +--------------------------------+ The syntax below describes a static primitive. The block following the list of types will be executed on each type listed. Types are accessible in the block by the variable 'Type', which is set to the class defninition that the type refers to. All Vejal syntax rules apply within the block. Note that '*' can be used in place of the list of types to make the block execute on all loaded types. edit () { // Perform alterations here // e.g. Type.removeField(\"someFieldName\"); } +---------------------------------------+ | | | Static Method-Primitive Declaration | | | +---------------------------------------+ The syntax below describes a method-primitive, or a primitive that requires a method declaration to express the desired change. In addition to the variable 'Type' declared in a normal primitive, method-primitives also have a reference to the method declared in the primitive declaration. The method declaration can be accessed through variable 'Method'. The method declaration must follow all Vejal syntax rules. The following block serves the same purpose as the block in normal primitives. edit () : () { // method body } { // Perform alterations here // e.g. Type.addMethod(Method); } +----------------------+ | | | Runtime primitives | | | +----------------------+ The syntax below describes a runtime primitive, or a primitive that binds to an event that occurs at runtime, and then executes along with that event. Runtime primitives can be of three types, 'before', 'after', or 'around', pertainting to where the primitive is executed in reference to the runtime event(s) it is bound to. Two types of runtime primitive exist, Explicit runtime primitives, which bind to a set list of Bindings, and Parameterized Runtime Primitives which bind to Bindings based on the availability of specified objects at each binding. 'Around' runtime primitives must take in two pieces of action code, one which executes before the Binding, and another which executes afterwards. Also, 'Around' runtime primitives can control whether or not the event it is bound to executes by calling or omitting a call to the method 'proceed()' in its 'before' block. proceed() must only be called in the 'before' block. +------------------------------------------+ | | | Explicit Runtime Primitive Declaration | | | +------------------------------------------+ In the example code below, refers to a ',' delineated list of identifiers that specify which Bindings the primitive will execute at, while is 'after', 'around', or 'before'. All variables that are declared as parameters to the Binding a runtime primitive binds to are accessible in the runtime primitive's action block under the handles the Binding declares them as. () { // Action to perform at binding } // If == 'around', a second block follows: { // Around action to perform after binding } +-----------------------------------------------+ | | | Parameterized Runtime Primitive Declaration | | | +-----------------------------------------------+ Parameterized runtime primitives are declared in much the same way as explicit runtime primitives, except instead of declaring a list of Binding names, a list of Parameters is specified. Parameters dictate the types of objects which the primitive is interested in, as well as the handles by which the objects will be referred to in advice code. Parameterized runtime primitives are associated on creation with all Bindings which match have BindingArguments matching parameter types. () { // Action to perform at binding } // If == 'around', a second block follows: { // Around action to perform after binding }