Exact func externtypes types#102
Conversation
Update the syntax of func externtypes and func types in the typing context to include exactness. This allows specifying exact function imports and properly typing ref.func as exact for exact imports and defined functions and otherwise as inexact.
| .. |NULL| mathdef:: \xref{syntax/types}{syntax-reftype}{\K{null}} | ||
|
|
||
| .. |EXACT| mathdef:: \xref{syntax/types}{syntax-heaptype}{\K{exact}} | ||
| .. |INEXACT| mathdef:: {} |
There was a problem hiding this comment.
These macros need to be fixed up with proper cross references after some of the questions below are answered.
| def $exactheaptype(exact, typeuse) : heaptype | ||
|
|
||
| def $exactheaptype(EXACT, typeuse) = EXACT typeuse | ||
| def $exactheaptype(INEXACT, typeuse) = typeuse |
There was a problem hiding this comment.
Having the externtype and context store explicitly EXACT or INEXACT exactness instead of just containing an EXACT? is important for ensuring that both cases are handled everywhere. At the same time, it is annoying because heaptype has a different representation of exactness (... | typeuse | EXACT typeuse), so we require this auxiliary conversion function.
Do you have a recommendation for how to simplify this? I'm thinking that maybe we should be using heaptype instead of deftype/typeuse in the externtype and context definitions because heaptype already has exactness information built-in, and we would be able to avoid conversions that way. But then we might need a new form of expansion that can fish the type use out of both exact and inexact heap types instead :/
Update the syntax of func externtypes and func types in the typing context to include exactness. This allows specifying exact function imports and properly typing ref.func as exact for exact imports and defined functions and otherwise as inexact.