<div dir="ltr"><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">Woah, that formatting got really messed up. Let me try again...</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">My own responses:</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">&gt;1. Do we want to use concrete types or protocols for Request/Response?</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">When working on <a href="https://github.com/open-swift">Open Swift</a>, this was a hot topic since we believed that it would be unsafe to have a protocol that would allow both value and reference types. We arrived upon the `{Request|Response}Representable` pattern which worked but was a bit of a mess. Because of this, I would prefer concrete Request/Response types.</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">&gt;2. If we use concrete types, do we want value or reference semantics?</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">What I think makes this easier is that the &quot;big four&quot; have each taken a slightly different approach that can be used as a reference.</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal"><span style="text-decoration:underline"><a href="https://github.com/Zewo/Zewo/blob/master/Modules/HTTP/Sources/HTTP/Message/Request.swift#L3">Zewo</a></span> - struct, value semantics</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal"><span style="text-decoration:underline"><a href="https://github.com/vapor/engine/blob/master/Sources/HTTP/Models/Request/Request.swift#L4">Vapor</a></span> - closed class, reference semantics</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal"><span style="text-decoration:underline"><a href="https://github.com/IBM-Swift/Kitura/blob/master/Sources/Kitura/RouterRequest.swift#L26">Kitura</a></span> - closed class + has-a pattern, reference semantics</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal"><span style="text-decoration:underline"><a href="https://github.com/PerfectlySoft/Perfect-HTTP/blob/master/Sources/HTTPRequest.swift#L25">Perfect</a></span> - class protocol, reference semantics</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">Zewo is the outlier here, but I would like to note as a contributor to Zewo that we have not ran into situations where value semantics create an impassable roadblock. </p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">To me, it makes sense to pass them around as values since they don&#39;t have any logic of their own. Requests/Responses can&#39;t send themselves, they can only read and modified. It also gives me as a user more safety to pass them around since I know that they won&#39;t be modified implicitly.</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">Take the following pseudo-code as an example:</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">HTTPServer.onRequest { request in</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">    print(request.sourceIp)</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">    HTTPClient.send(request)</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">    print(request.sourceIp)</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">}</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">With reference semantics, there is no guarantee that sourceIp will be the same before and after sending off the request. After all, it <i>could</i> make sense for the HTTPClient to modify the sourceIp before sending off the request. This of course a contrived example, but the point stands.</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px">Anyway, I think it would be great if we could have people talk about their own experiences.</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">&gt;3. When is it more convenient to have reference semantics?</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">In the middleware chain architecture that we decided on in Zewo (the other ones have something similar), it can be convenient to modify requests in the responder and have that reflect in the middleware. I think this problem is best solved with `inout` parameters rather than reference types, but that is my personal opinion.</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">&gt;4. Are there problems that can&#39;t be solved with value semantics?</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal">I haven&#39;t found any, but I&#39;m sure others can bring something interesting to the table.</p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal;min-height:14px"><br></p><p style="font-family:helvetica;margin:0px;font-size:12px;line-height:normal"><br></p><div class="gmail_quote"><div dir="ltr">On Wed, Nov 23, 2016 at 1:07 PM Dan Appel &lt;<a href="mailto:dan.appel00@gmail.com">dan.appel00@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><span style="font-size:13px" class="gmail_msg">Hello everyone!</span><div class="gmail_msg" style="font-size:13px"><br class="gmail_msg"></div><div class="gmail_msg" style="font-size:13px">I was unable to make the kick-off meeting for the HTTP sub-team, but I looked over the <a href="https://docs.google.com/document/d/1SWK0qBDi-9DeLJwHlcXcPU7h22JU-DWW8HTVuHbTQiw/edit" class="gmail_msg" target="_blank">meeting notes</a> and found some topics that I think could use some more on-the-record discussion.</div><div class="gmail_msg" style="font-size:13px"><br class="gmail_msg"></div><div class="gmail_msg" style="font-size:13px">A few questions that I wanted to raise:</div><div class="gmail_msg" style="font-size:13px"><br class="gmail_msg"></div><div class="gmail_msg" style="font-size:13px">1. Do we want to use concrete types or protocols for Request/Response?</div><div class="gmail_msg" style="font-size:13px">2. If we use concrete types, do we want value or reference semantics?</div><div class="gmail_msg" style="font-size:13px">3. When is it more convenient to have reference semantics?</div><div class="gmail_msg" style="font-size:13px">4. Are there problems that can&#39;t be solved with value semantics?</div><div class="gmail_msg" style="font-size:13px"><br class="gmail_msg"></div><div class="gmail_msg" style="font-size:13px">I would like to avoid bike-shedding, and I think this can be done by providing real examples rather than just talking about the pros and cons.</div></div><div dir="ltr" class="gmail_msg">-- <br class="gmail_msg"></div><div data-smartmail="gmail_signature" class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg">Dan Appel<br class="gmail_msg"></div></div></div></div></blockquote></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr"><div><div>Dan Appel<br></div></div></div></div>