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

Michael Chiu hatsuneyuji at icloud.com
Fri May 26 18:59:56 CDT 2017


> When importing HTTP you know you'll deal with HTTP requests and not anything else. And if you do import another module which also has Request (never happened to me) you have to make it clear which one you're referring to. So you'll have to do HTTP.Request, SOAP.Request. So in both scenarios, there won't be any confusion. On the other hand prefixing everything ends up adding noise to the API. 

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). 

Michael

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


More information about the swift-server-dev mailing list