-
Notifications
You must be signed in to change notification settings - Fork 2
Allow func type param names in the field name subsection #7
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,7 +84,7 @@ The index space for :ref:`locals <syntax-local>` is only accessible inside a :re | |
|
|
||
| Label indices reference :ref:`structured control instructions <syntax-instr-control>` inside an instruction sequence. There are two index spaces for labels: one tracks the stack of active labels during validation, while the other tracks all labels defined in a specific function. | ||
|
|
||
| Each :ref:`aggregate type <syntax-aggrtype>` provides an index space for its :ref:`fields <syntax-fieldtype>`. | ||
| Each :ref:`composite type <syntax-comptype>` provides an index space for its :ref:`parameters <syntax-resulttype>` (for :ref:`function type <syntax-functype>`) or :ref:`fields <syntax-fieldtype>` (for :ref:`aggregate types <syntax-aggrtype>`). All such address spaces use :ref:`field indices <syntax-fieldidx>`. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason not to extend this to result types? There are languages that allow naming results symmetric to parameters.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At the moment, simply because the text format doesn't allow names for results. That said, I did think about that, and it might not be that hard to add. The one wacky bit is that it still wouldn't make sense to give names to results in actual function declarations. WASM isn't like Go where you can name a return value and then assign to it like a variable. So what would it mean to do
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I guess the name section isn't really for the benefit of annotating source language names. |
||
|
|
||
|
|
||
| Conventions | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I would make such a general statement, since e.g. it doesn't make much sense for array types and none for continuation types. Perhaps better enumerate the types it can apply to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the time of writing, it's just structs, arrays, and functions, and the existing terminology talks about "aggregate types" instead of just struct types. So really I was just sticking with that. But I agree that it really only makes sense for structs and functions right now.
What I'm more curious about is whether it's ok for all of them to use
fieldidx. To be honest, it just seems exhausting to create a different type of index for every single thing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be generic, you could just use plain
idx(whose definition I just noticed was missing from the spec, but I just fixed that).