<div dir="ltr">On Fri, Dec 22, 2017 at 11:12 PM, Slava Pestov <span dir="ltr">&lt;<a href="mailto:spestov@apple.com" target="_blank">spestov@apple.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><br><div><span class=""><br><blockquote type="cite"><div>On Dec 22, 2017, at 7:09 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt; wrote:</div><br class="m_-3316831974516048772Apple-interchange-newline"><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">On Fri, Dec 22, 2017 at 6:12 PM, Chris Lattner<span class="m_-3316831974516048772Apple-converted-space"> </span><span dir="ltr">&lt;<a href="mailto:clattner@nondot.org" target="_blank">clattner@nondot.org</a>&gt;</span><span class="m_-3316831974516048772Apple-converted-space"> </span><wbr>wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><br><div><span><blockquote type="cite"><div>On Dec 22, 2017, at 1:03 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt; wrote:</div><br class="m_-3316831974516048772m_-2751741850073723399Apple-interchange-newline"><div><div class="m_-3316831974516048772m_-2751741850073723399Singleton"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><div><span class="m_-3316831974516048772m_-2751741850073723399gmail-"><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div>In short, respectfully request that you at least add this approach to the &quot;alternatives considered” section.</div></div></blockquote><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"></span></div><div>So, does anyone have any strong objections to Chris’s proposal?</div><div><br></div><div>From an implementation standpoint, reworking the parser to parse @available(inlinable) and @available(fixedContents) or whatever would be straightforward. I would still like to punt the version range part of this to a future proposal, though.</div><div><br></div></div></div></blockquote><div><br></div><div>I wish I had more time to compose a fully thought-out reply, but that&#39;s not going to happen in a little while because of outside constraints, so I&#39;ll spill a few thoughts here:</div></div></div></div></div></div></blockquote><div><br></div></span>No rush, no worries, enjoy the holiday!</div><div><span><br><blockquote type="cite"><div><div class="m_-3316831974516048772m_-2751741850073723399Singleton"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I&#39;m not a great fan of the @available(inlinable) notation.</div><div><br></div><div>For one, I have a hard time reasoning how Swift would behave when inlinability is tied to OS version. In this example, if the *app* (as opposed to the library) is compiled (as opposed to run) on iOS 16+, then the *library method* would potentially be emitted into the app, but if compiled on iOS 15 it wouldn&#39;t? Huh?</div></div></div></div></div></div></blockquote><div><br></div></span><div>No: availability information kicks in based on what you are *deploying* to, not what you’re compiling on.</div><div><br></div><div>I expect that this stuff will be extremely rarely used in practice, but here’s an example:</div><div><br></div><div>iOS15 declares this public:</div><div><br></div><div>public void foo() {</div><div>   bar()</div><div>}</div><div><br></div><div>iOS16 wants to promote foo to inlinable, but knows that the inlined body doesn’t work with iOS15, because iOS15 needs the call to bar to happen (for whatever reason)</div><div><br></div><div>@available(inlinable: iOS16)</div><div>public void foo() {</div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>// nothing needed on iOS16 or later.</div></div></blockquote><div><div>}</div></div></div></blockquote><div><br></div><div>Deployment platform makes more sense, but I still can&#39;t envision a real use case. What sorts of `bar()` would hypothetically be necessary for iOS 15 but not 16? Why would a third-party library need to increase its inlining availability for an app based on deployment platform?</div></div></div></div></div></blockquote><div><br></div></span><div>A better example would be if bar() was itself only available in iOS 16:</div><div><br></div><div>@available(iOS 15)</div><div>@available(inlinable: iOS 16)</div><div>public func foo() {</div><div>  bar()</div><div>}</div><div><br></div><div>@available(iOS 16)</div><div>public func bar() { … }</div><div><br></div><div>Suppose your app calls foo() and deploys to iOS 15. Then you cannot inline foo(), because bar() does not exist on iOS 15. (Presumably, foo() had a different implementation on iOS 15). But if you’re deploying to iOS 16, all is well, and you can inline foo(), which results in your app directly calling bar().</div><span class=""><br><blockquote type="cite"><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_extra"><div class="gmail_quote"><div>I&#39;m quite sure that the reason you inverted your &quot;abiPublic&quot; example is because of the same issue. Intuitively, you would want to mark something as &quot;available&quot; in version N and then maybe some special kind of &quot;available&quot; in version N+1 (which @available(inlinable) would be). But @available(linkerSymbol), as you spell it, suffers from a similar problem to that of @available(unavailable): it&#39;s _not_ a special kind of API availability, but rather indicates that something is less-than-available. That is, you would use it to indicate that something is available as ABI but not as API. In that sense, it extends the &quot;mess&quot; we have with @available(unavailable).</div></div></div></div></blockquote><br></span></div><div>I don’t think it’s quite the same thing as @available(unavailable). An @available(abiPublic) symbol would still be declared to have internal visibility, so in this case the @available attribute makes it strictly more visible than it would be without. We’re not going to spell it as ‘@available(abiPublic) public’, which indeed would be confusing because the symbol is not actually public at the source level.</div></div></blockquote><div><br></div><div>In Chris&#39;s example, it&#39;s an annotation of a public API that was once internal in a previous version:</div><div><br></div><div>  @available(apiPublic: iOS 14)</div><div>  @available(iOS 15)</div><div>  @available(inlinable: iOS 16)</div><div>  public func foo() { ... }</div><div><br></div><div>This is a sensible use, but it shows how we get to exactly the &quot;indeed confusing&quot; situation you write about above: here, @available(apiPublic) elevates the API above internal but below public *even when it annotates a public API*.</div><div><br></div></div></div></div>