lang: add inductive data types - #143
Conversation
The current set is missing some error cases.
|
A Q&A intended to describe the thought process behind the current design and to answer some questions one may have: Q: What's the type of a constructor? Q: Why do constructors also introduce a type? Q: How does the identifier overloading work? Don't types and values/variables share a namespace? Q: Having to Q: How do inductive data types relate to NimSkull's Q: Should there be a dedicated Q: Why is inductive data type recursion disallowed?
Recursion for inductive data types is definitely going to be revisited in the future. At the very least, the same form of recursion as is possible in NimSkull should also be possible in the source language. Q: Should inductive data types be allowed to extend existing inductive data types? Q: How will inductive data types be represented in memory? |
Add inductive data types to the source language, which are what some other programming languages call enum types, or just data types.
This is a work in progress. At the moment, there only exist tests, showcasing how the feature is intended to work.
To-Do
source2il