-
Notifications
You must be signed in to change notification settings - Fork 55
Add support for enumerated values #3
Comments
Some notes about how enum types and values can be encoded into Ergo's internal notion of types and values. Enum types are encoded as branded sum types:
This encoding should provide for accurate type checking. There will be challenges in providing good error reporting for those. Most likely the compilation context should maintain a table of declared enum types. Enum values are encoded as branded sum values:
From value to JSON:
toString(data) in REPL
toString(data) in JavaScript runtime
|
Some notes about internal enum encoding, for historical preservation. Some notes about how enum types and values can be encoded into Ergo's internal notion of types and values. Enum types are encoded as branded sum types:
This encoding should provide for accurate type checking. There will be challenges in providing good error reporting for those. Most likely the compilation context should maintain a table of declared enum types. Enum values are encoded as branded sum values:
From value to JSON:
toString(data) in REPL
toString(data) in JavaScript runtime
|
Based on that encoding, with a lot of additional work (notably, enum values are translated as constants), there is a full implementation in https://github.com/accordproject/ergo/tree/js-feature-dynamic-templates |
Ergo should allow for creations of enum values. This relies on the ability to read/import CTO files.
The text was updated successfully, but these errors were encountered: