Let the Baboon do the monkey job.
Stripped-down experimental DML with schema evolution support and garbage collection.
- Set-based structural inheritance with subtraction and intersections
- Automatic JSON codec derivation
- Automatic UEBA (Ultra-Efficient Binary Aggregate, a custom tagless binary format) codec derivation
- Automatic evolution derivation where possible, stubs where manual conversion is required
- Structural and nominal inheritance
- Namespaces
- Inclusions (at syntax tree level)
- Lists, sets, dictionaries and optional types.
- Codegen targets: C#
- No templates
- Only Enums, DTOs and ADTs
- Nominal inheritance support is limited to trait model
- Generic/type constructor support is limited to builtin collections
- (*) This is a DML, not an IDL, it does not support service/interface definitions
- (*) Currently only C# cogen target is supported
- (*) Comments are not preserved in the cogen output
- (*) No structural inheritance information is preserved in the transpiler output
- (*) Only integer constants may be associated with enum members
- (*) No newtypes/type aliases
- (*) No inheritance-based lenses/projections/conversions
Points marked with (*) will/may be improved in the future.
baboon \
--model-dir ./src/test/resources/baboon/ \
--model ./src/test/resources/baboon/pkg0/pkg01.baboon \
--model ./src/test/resources/baboon/pkg0/pkg02.baboon \
--output /path/to/directory
- All the types which are not transitively referenced by
root
types will be eliminated from the compiler output. - Usages in structural inheritance are not considered references, so structural parents which are not directly referenced as fields and not marked as
root
s will be eliminated
Be very careful about foreign types. It's your responsibility to make sure everything is set properly.
At the bare minimum you will have to do the following for each foreign type you use:
- Create a custom codec for your FT
- Override generated dummy codec instance with
BaboonCodecs#Register
- Override generated dummy codec instance using setter on
${Foreign_Type_Name}_UEBACodec#Instance
field - Override generated dummy codec instance using setter on
${Foreign_Type_Name}_JsonCodec#Instance
field
Make sure your foreign types are NOT primitive types or other generated types. It's a funny idea, but it will explode in runtime.
Foreign types may hold any position in generics but it's up to you to ensure correctness.