Skip to content

Exact func externtypes types#102

Open
tlively wants to merge 1 commit into
struct-new-desc-syntax-validationfrom
exact-extern-functype
Open

Exact func externtypes types#102
tlively wants to merge 1 commit into
struct-new-desc-syntax-validationfrom
exact-extern-functype

Conversation

@tlively

@tlively tlively commented Jul 8, 2026

Copy link
Copy Markdown
Member

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.

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.
@tlively tlively requested a review from rossberg July 8, 2026 01:37
.. |NULL| mathdef:: \xref{syntax/types}{syntax-reftype}{\K{null}}

.. |EXACT| mathdef:: \xref{syntax/types}{syntax-heaptype}{\K{exact}}
.. |INEXACT| mathdef:: {}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These macros need to be fixed up with proper cross references after some of the questions below are answered.

Comment on lines +93 to +96
def $exactheaptype(exact, typeuse) : heaptype

def $exactheaptype(EXACT, typeuse) = EXACT typeuse
def $exactheaptype(INEXACT, typeuse) = typeuse

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant