[swift-server-dev] Proposal: Structs in place of a request-handling function
me at helgehess.eu
Mon Dec 11 04:59:32 CST 2017
On 11. Dec 2017, at 02:27, George Leontiev via swift-server-dev <swift-server-dev at swift.org> wrote:
> With the current design, we effectively guarantee at least one allocation per request because we process the body by returning a closure.
Well, while I like the premise, there are *so* many allocations in the current setup (just think about all the Strings in the HTTPRequestHead), this one should really be the last we care about :-)
As mentioned before I don’t particularly like the current API, but it is something people could agree on and which I think can do what higher level frameworks require. I’m also fine w/ using a protocol. But it should support the same functionality (or at least allow it at a higher level).
What I miss in your suggestion is a demo on how something complete would look like. I.e., what does the `echo` look like:
and how would the async wait look like:
A demo of an echo w/ back-pressure would be cool too.
Note: I’m not expecting working examples here, I would just like to see how you think those would look like in your API.
More information about the swift-server-dev