-
Notifications
You must be signed in to change notification settings - Fork 82
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
Add 'non-blocking' function attribute #442
base: main
Are you sure you want to change the base?
Changes from 1 commit
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 |
---|---|---|
|
@@ -555,12 +555,13 @@ defvaltype ::= bool | |
| (result <valtype>? (error <valtype>)?) | ||
| (own <typeidx>) | ||
| (borrow <typeidx>) | ||
| (stream <typeidx>?) | ||
| (future <typeidx>?) | ||
| (stream <typeidx>?) 🔀 | ||
| (future <typeidx>?) 🔀 | ||
valtype ::= <typeidx> | ||
| <defvaltype> | ||
resourcetype ::= (resource (rep i32) (dtor async? <funcidx> (callback <funcidx>)?)?) | ||
functype ::= (func (param "<label>" <valtype>)* (result <valtype>)?) | ||
functype ::= (func <funcattr>? (param "<label>" <valtype>)* (result <valtype>)?) | ||
funcattr ::= non-blocking 🔀 | ||
componenttype ::= (component <componentdecl>*) | ||
instancetype ::= (instance <instancedecl>*) | ||
componentdecl ::= <importdecl> | ||
|
@@ -783,7 +784,11 @@ shared-nothing functions, resources, components, and component instances: | |
|
||
The `func` type constructor describes a component-level function definition | ||
that takes a list of uniquely-named `valtype` parameters and optionally returns | ||
a `valtype`. | ||
a `valtype`. Function types can optionally be annotated with a `non-blocking` | ||
attribute which has no semantic effect and is ignored at validation- and | ||
run-time, serving primarily as a hint that tells bindings generators to lift | ||
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 the "primarily" here redundant? 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 suppose so. It felt a bit off without any word, so I tried "only", and also tightened up the rest of the sentence in this commit, PTAL |
||
and lower without setting the `async` `canonopt` (see the [async | ||
explainer](Async.md#sync-and-async-functions) for more details). | ||
|
||
The `resource` type constructor creates a fresh type for each instance of the | ||
containing component (with "freshness" and its interaction with general | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -876,6 +876,7 @@ keyword ::= 'as' | |
| 'include' | ||
| 'interface' | ||
| 'list' | ||
| 'non-blocking' | ||
| 'option' | ||
| 'own' | ||
| 'package' | ||
|
@@ -1295,7 +1296,7 @@ typedef-item ::= resource-item | |
func-item ::= id ':' func-type ';' | ||
func-type ::= 'func' param-list result-list | ||
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. Could you add some text to Wit.md briefly describing what 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. Good idea, fixed, PTAL |
||
func-type ::= 'non-blocking'? 'func' param-list result-list | ||
param-list ::= '(' named-type-list ')' | ||
|
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.
From a new Wit user perspective. the name "non-blocking" could sound like it means "no stopping the caller" rather than "no waiting for I/O", which would be confusing since it does the exact opposite of that :-}. At least we should clearly document the Wit-user-facing side of this keyword.
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.
Yeah, I suppose "blocking" does have multiple interpretations. I added this addition to the previous note, but it could probably be improved.