[swift-server-dev] Next HTTP API meeting

Brent Royal-Gordon brent at architechies.com
Mon Mar 27 19:32:08 CDT 2017


> On Mar 27, 2017, at 1:55 PM, Helge Heß via swift-server-dev <swift-server-dev at swift.org> wrote:
> 
> Primarily this lacks an implementation of a CoW backed value type which could avoid thread safe RC and hence be significantly faster.


I've got a PR for one of those, as well as for non-`inout` argument passing: <https://github.com/tanner0101/request-types/pull/2>

Is the use of `inout` here purely a performance hack, or is it semantically significant? That is, are you *supposed* to write into the request in ways that middlewares above you will see? If so, I question whether that's a good idea—it seems to me that communication back up the stack should be through the response, not the request.

If not, though, it's worth noting that the ownership manifesto includes a `shared` argument-passing semantic where the callee does not take ownership of (i.e. copy/retain) the argument, but also cannot mutate it. In other words, a `shared` argument has the semantics of a normal argument, but the performance characteristics of an `inout` argument. And I suspect that this would not have trouble with escaping closures; they would just capture with non-`shared` semantics, incurring a copy/retain but otherwise working just fine.

If we are going to get that, and it has the semantics we're going to want, we might be better off not doing `inout` right now, and instead adding `shared` to these APIs once it's an option.

-- 
Brent Royal-Gordon
Architechies

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-server-dev/attachments/20170327/5099a2b7/attachment.html>


More information about the swift-server-dev mailing list