From 99633620f94f45b975bdecb6177d9b232f052b13 Mon Sep 17 00:00:00 2001 From: Dave Bakker Date: Sat, 5 Jul 2025 13:19:37 +0200 Subject: [PATCH 1/4] Add `get-*` prefix --- wit-0.3.0-draft/types.wit | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/wit-0.3.0-draft/types.wit b/wit-0.3.0-draft/types.wit index f0ba605..9a259c1 100644 --- a/wit-0.3.0-draft/types.wit +++ b/wit-0.3.0-draft/types.wit @@ -262,14 +262,14 @@ interface types { ) -> tuple>>; /// Get the Method for the Request. - method: func() -> method; + get-method: func() -> method; /// Set the Method for the Request. Fails if the string present in a /// `method.other` argument is not a syntactically valid method. set-method: func(method: method) -> result; /// Get the combination of the HTTP Path and Query for the Request. When /// `none`, this represents an empty Path and empty Query. - path-with-query: func() -> option; + get-path-with-query: func() -> option; /// Set the combination of the HTTP Path and Query for the Request. When /// `none`, this represents an empty Path and empty Query. Fails is the /// string given is not a syntactically valid path and query uri component. @@ -277,7 +277,7 @@ interface types { /// Get the HTTP Related Scheme for the Request. When `none`, the /// implementation may choose an appropriate default scheme. - scheme: func() -> option; + get-scheme: func() -> option; /// Set the HTTP Related Scheme for the Request. When `none`, the /// implementation may choose an appropriate default scheme. Fails if the /// string given is not a syntactically valid uri scheme. @@ -286,7 +286,7 @@ interface types { /// Get the authority of the Request's target URI. A value of `none` may be used /// with Related Schemes which do not require an authority. The HTTP and /// HTTPS schemes always require an authority. - authority: func() -> option; + get-authority: func() -> option; /// Set the authority of the Request's target URI. A value of `none` may be used /// with Related Schemes which do not require an authority. The HTTP and /// HTTPS schemes always require an authority. Fails if the string given is @@ -342,7 +342,7 @@ interface types { constructor(); /// The timeout for the initial connect to the HTTP Server. - connect-timeout: func() -> option; + get-connect-timeout: func() -> option; /// Set the timeout for the initial connect to the HTTP Server. An error /// return value indicates that this timeout is not supported or that this @@ -350,7 +350,7 @@ interface types { set-connect-timeout: func(duration: option) -> result<_, request-options-error>; /// The timeout for receiving the first byte of the Response body. - first-byte-timeout: func() -> option; + get-first-byte-timeout: func() -> option; /// Set the timeout for receiving the first byte of the Response body. An /// error return value indicates that this timeout is not supported or that @@ -359,7 +359,7 @@ interface types { /// The timeout for receiving subsequent chunks of bytes in the Response /// body stream. - between-bytes-timeout: func() -> option; + get-between-bytes-timeout: func() -> option; /// Set the timeout for receiving subsequent chunks of bytes in the Response /// body stream. An error return value indicates that this timeout is not @@ -397,7 +397,7 @@ interface types { ) -> tuple>>; /// Get the HTTP Status Code for the Response. - status-code: func() -> status-code; + get-status-code: func() -> status-code; /// Set the HTTP Status Code for the Response. Fails if the status-code /// given is not a valid http status code. From 05acd703f4be7ffa79054981dc6e5be545adebdc Mon Sep 17 00:00:00 2001 From: Dave Bakker Date: Thu, 10 Jul 2025 10:16:44 +0200 Subject: [PATCH 2/4] Prefix `header` & `options` as well. --- wit-0.3.0-draft/types.wit | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wit-0.3.0-draft/types.wit b/wit-0.3.0-draft/types.wit index 9a259c1..b237401 100644 --- a/wit-0.3.0-draft/types.wit +++ b/wit-0.3.0-draft/types.wit @@ -301,13 +301,13 @@ interface types { /// This `request-options` resource is a child: it must be dropped before /// the parent `request` is dropped, or its ownership is transferred to /// another component by e.g. `handler.handle`. - options: func() -> option; + get-options: func() -> option; /// Get the headers associated with the Request. /// /// The returned `headers` resource is immutable: `set`, `append`, and /// `delete` operations will fail with `header-error.immutable`. - headers: func() -> headers; + get-headers: func() -> headers; /// Get body of the Request. /// @@ -407,7 +407,7 @@ interface types { /// /// The returned `headers` resource is immutable: `set`, `append`, and /// `delete` operations will fail with `header-error.immutable`. - headers: func() -> headers; + get-headers: func() -> headers; /// Get body of the Response. /// From a49c72a5766de7f4d3391f8f9de30055c206e286 Mon Sep 17 00:00:00 2001 From: Dave Bakker Date: Thu, 10 Jul 2025 10:17:34 +0200 Subject: [PATCH 3/4] Rename `entries` to `copy-all` to better indicate the associated cost. --- wit-0.3.0-draft/types.wit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wit-0.3.0-draft/types.wit b/wit-0.3.0-draft/types.wit index b237401..324a13e 100644 --- a/wit-0.3.0-draft/types.wit +++ b/wit-0.3.0-draft/types.wit @@ -216,10 +216,10 @@ interface types { /// /// The names and values are always returned in the original casing and in /// the order in which they will be serialized for transport. - entries: func() -> list>; + copy-all: func() -> list>; /// Make a deep copy of the Fields. Equivalent in behavior to calling the - /// `fields` constructor on the return value of `entries`. The resulting + /// `fields` constructor on the return value of `copy-all`. The resulting /// `fields` is mutable. clone: func() -> fields; } From d594a26edd8636a64a9d011e0ea114286273c9df Mon Sep 17 00:00:00 2001 From: Dave Bakker Date: Thu, 10 Jul 2025 10:22:47 +0200 Subject: [PATCH 4/4] Rename `body` to `consume-body` to better communicate that it is not a simple property and has side effects. --- wit-0.3.0-draft/types.wit | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/wit-0.3.0-draft/types.wit b/wit-0.3.0-draft/types.wit index 324a13e..7a072b6 100644 --- a/wit-0.3.0-draft/types.wit +++ b/wit-0.3.0-draft/types.wit @@ -312,8 +312,8 @@ interface types { /// Get body of the Request. /// /// Stream returned by this method represents the contents of the body. - /// Once the stream is reported as closed, callers should await the returned future - /// to determine whether the body was received successfully. + /// Once the stream is reported as closed, callers should await the returned + /// future to determine whether the body was received successfully. /// The future will only resolve after the stream is reported as closed. /// /// The stream and future returned by this method are children: @@ -327,8 +327,9 @@ interface types { /// - a stream or future returned by a previous call to this method is still open /// - a stream returned by a previous call to this method has reported itself as closed /// Thus there will always be at most one readable stream open for a given body. - /// Each subsequent stream picks up where the last stream left off, up until it is finished. - body: func() -> result, future, error-code>>>>; + /// Each subsequent stream picks up where the previous one left off, + /// continuing until the entire body has been consumed. + consume-body: func() -> result, future, error-code>>>>; } /// Parameters for making an HTTP Request. Each of these parameters is @@ -412,8 +413,8 @@ interface types { /// Get body of the Response. /// /// Stream returned by this method represents the contents of the body. - /// Once the stream is reported as closed, callers should await the returned future - /// to determine whether the body was received successfully. + /// Once the stream is reported as closed, callers should await the returned + /// future to determine whether the body was received successfully. /// The future will only resolve after the stream is reported as closed. /// /// The stream and future returned by this method are children: @@ -427,7 +428,8 @@ interface types { /// - a stream or future returned by a previous call to this method is still open /// - a stream returned by a previous call to this method has reported itself as closed /// Thus there will always be at most one readable stream open for a given body. - /// Each subsequent stream picks up where the last stream left off, up until it is finished. - body: func() -> result, future, error-code>>>>; + /// Each subsequent stream picks up where the previous one left off, + /// continuing until the entire body has been consumed. + consume-body: func() -> result, future, error-code>>>>; } }