You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/codegen.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# LambdaBuffers Codegen Spec & Design
1
+
# LambdaBuffers Codegen
2
2
3
3
NOTE: The implementation of the code generation framework is still in early stages and will likely undergo substantial changes as development continues. This document serves to outline general principles that any implementation of the LambdaBuffers code generation framework ought to adhere to.
4
4
@@ -9,23 +9,23 @@ NOTE: The implementation of the code generation framework is still in early stag
9
9
3. Extensible to new opaque types
10
10
4. Extensible to new type classes
11
11
12
-
### Modular & reusable components
12
+
### Modular & Reusable Components
13
13
14
14
Because the code generation modules for each target language will almost certainly constitute the bulk of the final LambdaBuffers codebase, it is essential that components of the code generation framework be as modular and reusable as is practicable.
15
15
16
16
Although each target language has its own distinct syntax and semantics, many syntactic forms exist in multiple target languages. For example, Haskell and PureScript both use a comma-separated set enclosed in square brackets (e.g. `[1,2,3]`) to represent a `List _/[_]` value, while Rust uses a similar form (in conjunction with a macro, e.g. `vec![1,2,3]`) to represent a `Vector<_>` value. To reduce redundant and superfluous code, common syntactic patterns such at this should be abstracted out into a set of functions that can be reused across languages.
17
17
18
-
### Ergonomic interface
18
+
### Ergonomic Interface
19
19
20
20
While the LambdaBuffers team will support a finite set of specific target languages, adding support for an additional language should be as painless as possible (ceteris paribus) to encourage and facilitate open source contributions by third parties. A basic set of tools which can be used to write code generation modules for any target language should be developed, and all code generation modules written by the LambdaBuffers team should employ those tools (in order to provide a robust set of examples for future contributors, among other benefits).
21
21
22
-
### Extensible to new opaque types
22
+
### Extensible to New Opaque Types
23
23
24
24
Users and contributors should be able to easily extend the default set of supported opaque types to support additional opaque types. In the context of code generation, this means: Users should have the ability to specify the target type for a given opaque type in the target language (including the package or module that contains the target type if the target type is not part of the language's standard library).
25
25
26
26
Because type class instances must be derived structurally, and because an opaque type is by definition a type with no visible internal structure, users should be provided with an ergonomic interface for noting the presence of a type class instance for an opaque type's target type in a particular language (if the instance exists in the standard library), or for referring to the module where such an instance is located (if the instance is defined in a library or by the user in one of their own modules).
27
27
28
-
### Extensible to new type classes
28
+
### Extensible to New Type Classes
29
29
30
30
Users and contributors should be able to easily extend the default set of supported type classes to support additional type classes and facilitate the derivation of instances for newly defined classes.
0 commit comments