Productions and resources are a bridge between abstraction level of Paml models and actual output code in C#, which will be compiled/debugged into binaries like DLL.
Paml productions and resources syntax elements are just to define formal syntax and semantics of the language. The idea is that no need to write such Paml code manually in real projects in daily working, IDE must provide a rich functionality to make easy developing and writing output code. But formally, such Paml code can be written, parsed and interpreted correctly by Paml translator.
Objects, subjects, abstractions, and projections are a term level; they are abstractions that's models. On the model level just logically suppose that models (objects, subjects, etc.) have associated projections. A projection has an instantiating policy, for simplicity suppose that all projection instantiating policies are static and no instances need to be created/disposed.
Injection varInit is removed from Paml, now four injections are defined: beforeBlock, beforeBody, afterBody, and afterBlock. Possibly new injection will be added like body.
A production is a set of resource definitions. Productions are Paml syntax elements, but their "implementation" is written in output language such as C#.
Productions are static for now, like projections approach. That's both projections and productions are static elements and do not required any factories to create their instances.
Resources (and resource definitions) can be of two fundamental kinds: memory and algorithm. Specific kinds of resources can be defined, like locks, transactions, cycles(!) etc., but they all are just particular kind of the two. Models are just abstractions that define terms from a domain. Productions with resources are used to assign real code and memory to the models.
A resource definition consists of resource procedures. For memory resource, procedures are init, release, and recover. For algorithm resource, the only procedure is execute. Resource definitions can share some state in their production, because resource implementation can be complex enough.
Resources are injected into resource slots. Resource slots are items of metadata of Paml code elements such as variables or association properties. Metadata consist of injection points and resource slots. Depending on the kind of code element there can be a structure of injection points and resource slots.
Resource slots have a scope of two kinds: routine and object. A resource slot can be set to release the assigned resource (if any) when the slot is going outside of its scope (the control flow gets outside a routine or an object is disposed).
Assigning resources from productions into resource slots are matched via resource selectors. Unlike injection selectors, which are specified for injections, resource selectors are specified for resource slots.
A resource slot can pass some arguments to resource procedures. This is a feature to avoid global scope, all pieces of code, in Paml or output language, are assigned as "functions", that's they can use only their "parameters". This can (and probably must) be supported by IDE to display a scope for each element because such scope is expected to be very short, just a few names.
Write a comment