|
| 1 | +<!-- markdownlint-disable-file --> |
| 2 | + |
| 3 | +# Comparison Matrix |
| 4 | + |
| 5 | +Legend: |
| 6 | + |
| 7 | +- 🟢 Available (grading added in some cases spanning: Bad, Average, Good, Excellent) |
| 8 | +- 🟡 In development |
| 9 | +- 🔵 Potential future feature |
| 10 | +- 🔴 Not currently available |
| 11 | +- ❔ Not clear |
| 12 | + |
| 13 | +| **Feature** | **Proto Buffers** | **ADL** | **JSON Schema** | **Lambda Buffers** | **CDDL** | **ASN.1** | |
| 14 | +|--------------------------------------------------------|-------------------|--------------|-----------------|--------------------|----------|--------------| |
| 15 | +| Sum types | 🟢 | 🟢 | 🔴 | 🟢 | 🟢 | 🟢 | |
| 16 | +| Record types | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 | |
| 17 | +| Product types | 🔴 | 🔴 | 🔴 | 🟢 | ❔ | 🔴 | |
| 18 | +| Recursive types | 🟢 | 🟢 | 🔴 | 🟢 | 🟢 | ❔ | |
| 19 | +| Parameterized types (generic types) | 🔴 | 🟢 | 🔴 | 🟢 | 🟢 | 🔴 | |
| 20 | +| Type annotations/constraints | 🟢 | 🟢 | 🟢 | 🔵 | 🟢 | 🟢 | |
| 21 | +| Add new builtin types | 🔴 | 🟢 | 🔴 | 🟢 | 🔴 | 🔴 | |
| 22 | +| Add new type semantics (e.g. different encodings) | 🟢 | 🟢 | 🔴 | 🟢 | 🔴 | 🟢 | |
| 23 | +| Manage type semantics (at language level) | 🔴 | 🔴 | 🔴 | 🟢 | 🔴 | 🔴 | |
| 24 | +| Codegen support | 🟢 (Excellent) | 🟢 (Average) | 🟢 (Excellent) | 🟡 | 🟢 (Bad) | 🟢 (Average) | |
| 25 | +| DevOps tooling - build system integration | 🟢 | 🔴 | ❔ | 🟡 | 🔴 | 🔴 | |
| 26 | +| Documentation tooling | 🟢 | 🔴 | 🟢 | 🔵 | 🔴 | ❔ | |
| 27 | +| Formatting, linting, and development environment tools | 🟢 | 🔴 | 🟢 | 🟢 | 🔴 | 🔴 | |
| 28 | +| Language checker API | 🟢 | 🔴 | 🟢 | 🟢 | 🔴 | 🔴 | |
| 29 | +| Codegen API | 🟢 | 🟢 | 🔴 | 🟢 | 🔴 | 🔴 | |
| 30 | +| Language specification | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 | |
| 31 | +| Backwards compatibility strategy | 🟢 | 🔴 | 🔴 | 🔴 | 🔴 | 🔴 | |
| 32 | + |
| 33 | +## Descriptions |
| 34 | + |
| 35 | +### Sum Types |
| 36 | + |
| 37 | +Types of the form `Time = Present | Past | Future`, which allow a type do be |
| 38 | +constructed by one of many variants. Think Rust's `enums`. |
| 39 | + |
| 40 | +### Product Types |
| 41 | + |
| 42 | +Types of the form `Person = MkPerson Age Name`, where `MkPerson` is of Kind |
| 43 | +`Type->Type->Type`. Product types combine multiple elements into one data type |
| 44 | +without tagging the elements. |
| 45 | + |
| 46 | +### Record Types |
| 47 | + |
| 48 | +Types of the form `Person = MkPerson { age :: Age, name :: Name }`. Record types |
| 49 | +are similar to `structs` in most programming languages. |
| 50 | + |
| 51 | +### Recursive Types |
| 52 | + |
| 53 | +Recursive types are defined by the presence of the LHS type in its RHS |
| 54 | +definition. A classic example is: |
| 55 | + |
| 56 | +```text |
| 57 | +List a = Nil | Cons a (List a) |
| 58 | +^^^^^^ ^^^^^^ |
| 59 | +``` |
| 60 | + |
| 61 | +### Parameterized Types (Generics) |
| 62 | + |
| 63 | +Type functions allow for the introduction of type variables in the LHS definition |
| 64 | +of the term - creating a parametrised type definition. The classic example is |
| 65 | +`Maybe a` which is the equivalento of `Option <A>` in rust: |
| 66 | + |
| 67 | +```text |
| 68 | +Maybe a = Nothing | Just a |
| 69 | +``` |
| 70 | + |
| 71 | +Using the above type definition we can now define another type that uses `Maybe` |
| 72 | +and instantiates it to use `Integer` |
| 73 | + |
| 74 | +```text |
| 75 | +Time_Saved_via_LambdaBuffers = Maybe Integer |
| 76 | +``` |
| 77 | + |
| 78 | +### Type Annotations / Constraints |
| 79 | + |
| 80 | +There exists a system of constraining or further annotating types - enriching |
| 81 | +the type's specification. |
| 82 | + |
| 83 | +### Add New Built-in Types |
| 84 | + |
| 85 | +Refer to [design document](design.md#extensible-to-new-types). |
| 86 | + |
| 87 | +### Add New Type Semantics |
| 88 | + |
| 89 | +Refer to the [design document](design.md#extensible-to-new-semantics). |
| 90 | + |
| 91 | +### Manage Type Semantics (at Language Level) |
| 92 | + |
| 93 | +Refer to the [design document](design.md#expressive-semantics-annotation).. |
| 94 | + |
| 95 | +### Codegen Support |
| 96 | + |
| 97 | +Codegen support relates to the language being able to generate types for other |
| 98 | +programming languages. |
| 99 | + |
| 100 | +### DevOps Tooling - Build System Integration |
| 101 | + |
| 102 | +The framework/language provides a seamless way of integrating with normal build |
| 103 | +tools and systems (eg. Bazel, Nix, etc.). |
| 104 | + |
| 105 | +### Documentation Tooling |
| 106 | + |
| 107 | +The language can generate human readable documentation in an easy to share and |
| 108 | +view format. For example HTML, or Markdown. |
| 109 | + |
| 110 | +### Formatting, Linting, and Development Environment Tools |
| 111 | + |
| 112 | +Tools that allow formatting, linting, and automating standardisation of the |
| 113 | +language specific files. |
| 114 | + |
| 115 | +### Language Checker API |
| 116 | + |
| 117 | +The language checker component exposes an API to interface with itself in a |
| 118 | +language agnostic manner. |
| 119 | + |
| 120 | +### Codegen API |
| 121 | + |
| 122 | +The language codegen component exposes an API to interface with itself in a |
| 123 | +language agnostic manner. |
| 124 | + |
| 125 | +### Language Specification |
| 126 | + |
| 127 | +There exists a well defined language specification document. |
| 128 | + |
| 129 | +### Backwards Compatibility Strategy |
| 130 | + |
| 131 | +The language makes certain backwards compatibility guarantees between versions of |
| 132 | +the same type definition. |
| 133 | + |
| 134 | +## References |
| 135 | + |
| 136 | +- https://json-schema.org/implementations.html |
| 137 | +- https://www.rfc-editor.org/rfc/rfc8610 |
| 138 | +- https://github.com/timbod7/adl |
| 139 | +- https://www.itu.int/en/ITU-T/asn1/Pages/introduction.aspx |
| 140 | +- https://protobuf.dev/ |
| 141 | +- https://github.com/dcSpark/cddl-codegen |
0 commit comments