<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 Jun 2, 2016, at 1:43 PM, Russ Bishop <<a href="mailto:xenadu@gmail.com" class="">xenadu@gmail.com</a>> wrote:</div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class="">On Jun 2, 2016, at 11:30 AM, John McCall via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">I still think the value-based APIs are misleading and that it would be better to ask people to just use a type explicitly.</div><div class=""><br class=""></div><div class="">John.</div></div></div></blockquote></div><br class=""><div class=""><br class=""></div><div class="">I agree; in fact <i class="">why aren’t these properties on the type itself</i>? The type is what matters; why can’t the type just tell me it’s size? </div><div class="">Having free functions or magic operators seems to be another holdover from C. </div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><font face="Monaco" class=""> Int.size</font></div><div class=""><font face="Monaco" class=""> Int.alignment</font></div><div class=""><font face="Monaco" class=""> Int.spacing</font></div><div class=""><font face="Monaco" class=""><br class=""></font></div><div class=""><font face="Monaco" class=""> let x: Any = 5</font></div><div class=""><font face="Monaco" class=""> type(of: x).size</font></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">The compiler should be able to statically know the first three values and inline them. The second is discovering the size dynamically.</div></div></div></blockquote><div><br class=""></div></div>Two reasons. The first is that this is a user-extensible namespace via static members, so it's somewhat unfortunate to pollute it with names from the library. The second is that there's currently no language mechanism for adding a static member to every type, so this would have to be built-in. But I agree that in the abstract a static property would be preferable.<div class=""><br class=""></div><div class="">John.</div></body></html>