-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More future-proof type definitions (Algebraic data types) #19
Comments
Related: #26. Fe already has some of these types, which might be another reason to include them. Also, some general points from me:
|
Supporting ADTs in the format makes sense +1 I assume that any schema for describing ADTs would be distinct from the schema for describing how types are realized for a particular data location? I could see this going either way, since it's valid to view "uint array in memory" (e.g.) as doubly wrapped, but the allocation concern seems like a distinct concept from the type semantics. |
Technically it is possible to consider locations as data type constructor on top of any type. First of, for example, a struct
can be thought of as syntactic sugar over an algebraic data type - so this can be thought of as a tuple of two A concrete occurrence of the struct in memory, i.e. For dynamic arrays like Maybe the way to do this is to actually make pointing a first class construct? All types on stack can be represented as algebraic data types, including pointers. Some of them then point to another thing at some other location that can be represented as a different algebraic data type. But yeah, I haven't yet fully thought this through myself either. |
[just dumping my comment from matrix]
For the high-level type descriptions, I'm still wondering if we should make it more future-proof from the start. We will have general algebraic data types in the future and enums and structs are just special cases of those equipped with additional name information. I'm fine with just representing the current state of the language in the format, but that means we'll very likely need to break and extend this in the not-so-distant future, so I'd recommend generalizing this a bit more from the start.
The text was updated successfully, but these errors were encountered: