[swift-server-dev] Prototype of the discussed HTTP API Spec

Michael Chiu hatsuneyuji at icloud.com
Fri May 26 19:45:48 CDT 2017


> On May 26, 2017, at 5:02 PM, Paulo Faria <paulo at zewo.io> wrote:
> 
> > I don’t think adding a prefix will add too much noise to the API, and if it does it cost less than resolving namespace collision. 
> > It is true that user can use HTTP.Request and SOAP.Request to make it clean which one ppl is referring to, but it also make code hard to debug once anyone has accidentally forgot to add the “HTTP.” preflx, and this is kind of error that the compiler cannot catch sometimes, especially when they have members and methods used in the function body with the same name and type (which for a req/res this should be pretty common). 
> 
> I honestly never seen it happen. Vapor is one of the most popular frameworks and they also use Request and Response. I'd love to see real-life reports of issues regarding this matter.


Swift is still minority in server side and early user are mostly from iOS and no real complex project AFAIK had built on any of the swift web framework available yet. And even people encounter this problem it’s not likely anyone will report it, since it’s not a bug but what the framework authors choose to do.

On the other hand, a mature example, Netty, written in Java which has a similar namespace system as swift (using . ), includes HTTP as the prefix,
https://netty.io/4.0/api/io/netty/handler/codec/http/HttpRequest.html 

Request and Response sounds like name of a protocol for me instead of a real type.

Michael

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-server-dev/attachments/20170526/8c0c07b1/attachment.html>


More information about the swift-server-dev mailing list