Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions design/mvp/Binary.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ Notes:
rejects any transitive use of `borrow` in an exported value type.
* Validation of `stream` and `future` rejects element types that transitively
contain a `borrow`.
* Validation of `stream` rejects `(stream char)` as a temporary
[TODO](Concurrency.md#TODO).
* Validation of `resourcetype` requires the destructor (if present) to have
type `[i32] -> []`.
* Validation of `instancedecl` (currently) only allows the `type` and
Expand Down
5 changes: 4 additions & 1 deletion design/mvp/CanonicalABI.md
Original file line number Diff line number Diff line change
Expand Up @@ -4212,8 +4212,11 @@ Then a readable or writable buffer is created which (in `Buffer`'s constructor)
eagerly checks the alignment and bounds of (`i`, `n`). (In the future, the
restriction on futures/streams containing `borrow`s could be relaxed by
maintaining sufficient bookkeeping state to ensure that borrowed handles *or
streams/futures of borrowed handles* could not outlive their originating call.)
streams/futures of borrowed handles* could not outlive their originating call.
Additionally, `stream<char>` will be allowed and defined to encode and decode
according to the `string-encoding`.)
```python
assert(not isinstance(stream_t, CharType))
assert(not contains_borrow(stream_t))
cx = LiftLowerContext(opts, thread.task.inst, borrow_scope = None)
buffer = BufferT(stream_t.t, cx, ptr, n)
Expand Down
4 changes: 2 additions & 2 deletions design/mvp/Concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,8 @@ comes after:
* remove the temporary trap mentioned above that occurs when a `read` and
`write` of a stream/future happen from within the same component instance
* zero-copy forwarding/splicing
* allow the `stream<char>` type to validate; make it use `string-encoding`
and not split code points
* some way to say "no more elements are coming for a while"
* add an `async` effect on `component` type definitions allowing a component
type to block during instantiation
Expand All @@ -1270,8 +1272,6 @@ comes after:
* add a `strict-callback` option that adds extra trapping conditions to
provide the semantic guarantees needed for engines to statically avoid
fiber creation at component-to-component `async` call boundaries
* add `stringstream` specialization of `stream<char>` (just like `string` is
a specialization of `list<char>`)
* allow pipelining multiple `stream.read`/`write` calls
* allow chaining multiple async calls together ("promise pipelining")
* integrate with `shared`: define how to lift and lower functions `async` *and*
Expand Down
3 changes: 3 additions & 0 deletions design/mvp/Explainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,9 @@ empty futures and streams can be useful for timing-related APIs.
Currently, validation rejects `(stream T)` and `(future T)` when `T`
transitively contains a `borrow`. This restriction could be relaxed in the
future by extending the call-scoping rules of `borrow` to streams and futures.
Additionally, `(stream char)` is temporarily rejected with a future
[TODO](Concurrency.md) to allow and properly use the `string-encoding`,
taking care to not split code points.

#### Specialized value types

Expand Down
1 change: 1 addition & 0 deletions design/mvp/canonical-abi/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2362,6 +2362,7 @@ def stream_copy(EndT, BufferT, event_code, stream_t, opts, thread, i, ptr, n):
trap_if(e.shared.t != stream_t.t)
trap_if(e.state != CopyState.IDLE)

assert(not isinstance(stream_t, CharType))
assert(not contains_borrow(stream_t))
cx = LiftLowerContext(opts, thread.task.inst, borrow_scope = None)
buffer = BufferT(stream_t.t, cx, ptr, n)
Expand Down