<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 31, 2017, at 1:21 PM, Cheyo Jimenez <<a href="mailto:cheyo@masters3d.com" class="">cheyo@masters3d.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""><br class="">On Dec 31, 2017, at 8:59 AM, Ben Rimmington via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">On 21 Dec 2017, at 03:32, John McCall wrote:<br class=""><br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">On Dec 20, 2017, at 10:16 PM, Brent Royal-Gordon wrote:<br class=""><br class="">On Dec 19, 2017, at 2:58 PM, Ted Kremenek wrote:<br class=""><br class=""> • What is your evaluation of the proposal?<br class=""></blockquote><br class="">I am pleased with the broad strokes of this design. I have quibbles with three areas:<br class=""><br class="">1. The `@exhaustive` attribute may be confusing because the term doesn't suggest versioning. My best alternative suggestion is `@frozen`, which matches existing programming terminology: something that has been frozen will not be changed in the future.<br class=""></blockquote><br class="">I rather like @frozen. We could use that across language features, so that we don't end up with a keyword per kind of declaration.<br class=""></blockquote><br class="">Could this also be used on functions to make them inlinable?<br class="">i.e. The body of the function has been frozen.<br class=""><br class="">```<br class="">@frozen<br class="">public func a()<br class=""><br class="">@available(*, frozen)<br class="">public func b()<br class=""><br class="">@available(swift, introduced: 4.1, frozen: 5.0)<br class="">public func c()<br class=""><br class="">```<br class=""></blockquote><br class="">My understanding is that frozen / exhaustible is guaranteed by the compiler while inlineable is more of a strong suggestion to the compiler. It would be confusing to use the same word for both.<br class=""></div></div></blockquote><div><br class=""></div>Well, this is both true, and false, and true again.</div><div><br class=""></div><div>It's true that <font face="Menlo" class="">frozen</font>/<font face="Menlo" class="">inlineable</font> on a function leaves the choice of whether to actually perform inlining (or other interprocedural optimizations like specialization) up to the compiler, whereas the impact of <font face="Menlo" class="">frozen</font> on a type has a direct and reliably-observable impact in the sense of lifting certain semantic restrictions.</div><div><br class=""></div><div>But from another perspective, the <i class="">meaning</i> of the attribute to the implementor is the same in both cases: it means that the implementation is the same across versions. <span style="font-family: Menlo;" class="">frozen</span> on a type means that the basic storage structure of the type won't change (i.e. it has exactly the same stored properties/cases), and <span style="font-family: Menlo;" class="">frozen</span> on a function means that the behavior of the function won't change.</div><div><br class=""></div><div>But then again, while we can reliably check the correctness of <span style="font-family: Menlo;" class="">frozen</span> on a type, we can't really check that for a function. We can check <span style="font-family: Menlo;" class="">frozen</span>-correctness on a type because we don't mind forbidding non-trivial changes to the storage structure: i.e. the set of stored properties/cases (and their types) have to remain exactly the same, meaning you can't even do "obviously equivalent" changes like combining two stored properties into a single property of tuple type. But we don't want to be that strict with functions because we do want to allow some non-trivial differences: it's frequently possible to improve the implementation of a function without changing its behavior, and we don't want to make that impossible, but we also don't really want to get into the business of requiring library authors to prove the semantic equivalence of two different function bodies. That means we just have to take implementors at their word that using the new function body instead of the old isn't too annoying a difference. I know Joe Groff has proposed in the past that we use a somewhat different semantic model for <font face="Menlo" class="">inlineable</font> functions, one that promises that we use the newest available functionality, and I think there's some merit to that.</div><div><br class=""></div><div>To me, the important questions around keyword choice are:</div><div> - whether the operations feel sufficiently different that using the same keyword is going to feel awkward;</div><div> - whether we might be preventing useful expressiveness by using the same keyword (the thing that occurs to me is that having a separate attribute for <font face="Menlo" class="">inlineable</font> might let us easily mass-annotate an extension, which seems like a common use-case); and</div><div> - whether we can get community agreement about it, which might seem "meta", but sometimes one must pick one's battles.</div><div><br class=""></div><div>John.</div></body></html>