<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class="">On 14 Jun 2017, at 07:41, Rien via swift-server-dev &lt;<a href="mailto:swift-server-dev@swift.org" class="">swift-server-dev@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">The choices seem to be:<br class=""><br class="">1) String<br class="">2) Enum<br class="">3) Tuple<br class="">4) Struct<br class="">5) Class<br class=""><br class="">To me that leaves option 2 and 4.<br class="">Advantage of 2 over 4:<br class=""><br class="">- I find the abstraction a better match. The difference between 1, 1.1 and 2 is such that it makes little sense to be to differentiate based on the numerical values. It makes much more sense to differentiate based on the “whole number”. AFAIIC they could just as easily have named the versions A, B, C etc. The numbers do not convey any information as such.<br class="">- Switch is easier and more intuitive to use.<br class="">- Enums can have additional properties and operations similar to struct.<br class=""><br class="">Advantage of 4 over 2:<br class="">I don’t see any.<br class=""></div></div></blockquote></div><div class=""><br class=""></div><div class="">The problem with using any fixed-sized, closed set enum is that you are not going to capture every possible status code in the implementation. Sure, you might capture them as they exist /now/ but they may be added to in the future. In addition, you can't really group them into ranges (e.g. 1xx, 2xx, 3xx, 4xx, 5xx) which have definite meanings even if the actual status code is not known at the time the program was written.</div><div class=""><br class=""></div><div class="">Having worked with HTTP libraries in the early days of Java, and seeing the HTTP/1.0 -&gt; HTTP/1.1 and then subsequent RFCs adding further codes (e.g.&nbsp;<a href="https://tools.ietf.org/html/rfc6585" class="">https://tools.ietf.org/html/rfc6585</a>) expecting the set of codes to be a closed set doesn't work. You might be able to get away with an enum-of-five (corresponding to the 1xx, 2xx, 3xx, 4xx, 5xx) but that doesn't add much and you'd still need to have the numerical values stored anyway.</div><div class=""><br class=""></div><div class="">Alex</div><div class=""><br class=""></div></body></html>