Details
-
New Feature
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
None
-
None
-
-
2
-
Language 2016-04-20
-
Not Needed
-
This is a highly specialized feature for implementors of puppet and implementors of serialization protocols.
Description
When doing serialization between runtimes of different versions or implementation languages it is of value to be able to define the mapping between names in the puppet name space and the implementation that is performing the operation.
This relates to PUP-5928 where it is possible to define a pattern so that each class in a package does not have to be stated and instead be matched with a pattern. The functionality in PUP-5928 is used here for further functionality.
The type alias mechanism should be extended to give special meaning to a mapping of a Runtime type to a Puppet Type. The semantics of this is "this runtime type is a representation of this puppet type".
As an example - this is what puppet uses internally:
type Runtime[ruby, Float] = Float |
By making it possible to specify these mappings, there is nothing special or secret about any of the mappings. Serialization simply refers to a type model to know what the bindings are supposed to be in the implementation that serializes/deserializes.
It is of great value to use the pattern in PUP--5928 to also specify the RHS:
type Runtime['ruby', [/^Puppet::Pops::Model::(\w+)$/, 'PCore::AST::\1']] = |
[/^PCore::AST::(\w+)$/, 'Puppet::Pops::Model::\1'] |
(Or similar syntax). This would mean, all the classes in the Ruby MyPackage that has the pattern P<something>Type would be mapped to the corresponding puppet name e.g. MyPackage::PFooType is mapped to MyModule::MyPackage::Foo as a puppet name.