<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style>
</head>
<body><div style="font-family:Arial;">I’m hugely in favor of a path forward that involves extending existing language constructs instead of introducing new ones or throwing around a bunchannotations. I want to say that I like extending `@available` (because I do), but it kind of breaks my mental model of the flags to `@available` establishing a sort of “lifecycle” for an entity (born/introduced foo, deprecated bar, died/removed baz). I know that’s not official reasoning, but it's helped me explain it to others. (As a side concern, ABI flags feel too easily forgotten  in the expanded form of `@available` where you are specifying multiple combos for multiple platforms.)<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">Maybe there’s opportunity here for clustering together the purpose of these ABI features more generally? Others have mentioned parameterizing the access control keywords, which I personally think aligns well and will also align well if/when versioning is added to those.<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">Alternatively, bucketing them together under something like `@stability(inlinable: foo)` and making sure SourceKit gets autocomplete for the parameters could be neat. I mention this kind of thing over in the closed enums thread as deserving a more holistic look as we add a new axis of syntax features to the language.<br></div>
<div style="font-family:Arial;"><br></div>
<div id="sig20055365"><div class="signature"><span class="font" style="font-family:arial, sans-serif, sans-serif">Sincerely,</span><span class="font" style="font-family:arial, sans-serif, sans-serif"></span><br></div>
<div class="signature"><span class="font" style="font-family:arial, sans-serif, sans-serif">&nbsp; Zachary Waldowski</span><span class="font" style="font-family:arial, sans-serif, sans-serif"></span><br></div>
<div class="signature"><span class="font" style="font-family:arial, sans-serif, sans-serif">&nbsp;&nbsp;</span><a href="mailto:zach@waldowski.me"><span class="font" style="font-family:arial, sans-serif, sans-serif">zach@waldowski.me</span></a><span class="font" style="font-family:arial, sans-serif, sans-serif"></span><br></div>
<div style="font-family:Arial;"><br></div>
</div>
<div>On Thu, Dec 21, 2017, at 2:14 AM, Chris Lattner via swift-evolution wrote:<br></div>
<blockquote type="cite"><div><blockquote type="cite"><div>On Dec 20, 2017, at 4:19 PM, Ted Kremenek &lt;<a href="mailto:kremenek@apple.com">kremenek@apple.com</a>&gt; wrote:<br></div>
<div style="font-family:Arial;"><br></div>
<div><div><div name="messageBodySection" style="font-size:14px;font-family:-apple-system, BlinkMacSystemFont, sans-serif;"><p style="margin-right: 0px; margin-bottom: 15px; margin-left: 0px; margin-top: 0px !important;"><span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="font" style="font-family:Helvetica, arial, sans-serif">The review of "SE-0193 - Cross-module inlining and specialization" begins now and runs through&nbsp;<b>January 5, 2018</b>.</span></span><br></p><p style="margin: 15px 0px;"><span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="font" style="font-family:Helvetica, arial, sans-serif">The proposal is available here:</span></span><br></p><blockquote style="margin-top:5px;margin-right:5px;margin-bottom:5px;margin-left:5px;padding-left:10px;border-left-width:thin;border-left-style:solid;border-left-color:rgb(26, 188, 156);"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;"><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0193-cross-module-inlining-and-specialization.md">https://github.com/apple/swift-evolution/blob/master/proposals/0193-cross-module-inlining-and-specialization.md</a><br></div>
</blockquote><p style="margin: 15px 0px;"><span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="font" style="font-family:Helvetica, arial, sans-serif">When reviewing a proposal, here are some questions to consider:</span></span><br></p><ul style="margin-top:15px;margin-right:0px;margin-bottom:15px;margin-left:0px;padding-left:30px;font-family:Helvetica, arial, sans-serif;background-color:rgb(255, 255, 255);"><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;"><p style="margin-top:0px;margin-right:0px;margin-bottom:15px;margin-left:0px;">What is your evaluation of the proposal?<br></p></li></ul></div>
</div>
</div>
</blockquote><div>I am hugely supportive of the features that these attributes enable, but I think that the spelling of this is absolutely wrong, and I’m disappointed that the extensive discussion we’ve had for months about this didn’t make it into (at least) the alternatives considered section. &nbsp;Here are my concerns:<br></div>
<div><br></div>
<div><b>Availability Ranges</b><br></div>
<div><br></div>
<div>Both of these attributes will (perhaps not for Swift 5 given the fact that these will be new then, but certainly in 5.1 or 6) need to be qualified by deployment modifiers. &nbsp;We’ll need the ability to specify not just that a declaration is inlinable or abipublic, but in *which versions* of the binary package (that they are defined in) have this property. &nbsp;<br></div>
<div><br></div>
<div>For example, while perhaps it will be common for a decl to be “born inlinable” and just need the form of attribute as specified here, it is just as clear that this is not the *only* model we need. &nbsp;It is entirely reasonable (and will be important in the future) to say that something “became ABI public in iOS14, became abiPublic in iOS 15, and became inlinable in iOS16”. &nbsp;The use of this will be relatively rare, but it is important for the model to support this in time.<br></div>
<div><br></div>
<div>Because of this, if we accept the spelling as proposed in this proposal, these attributes will need to be generalized to have an availability range, e.g.:<br></div>
<div><br></div>
<div><span style="white-space:pre;"></span>@abipublic(iOS 15, *)<br></div>
<div><br></div>
<div>The concern is that this proposal opens the door to have a family of attributes each of which have availability information on them, and this “family” of attributes will have nothing tying them together into a unified framework.<br></div>
<div><b></b><br></div>
<div><b></b><br></div>
<div><b>Pollution of the Attribute Namespace</b><br></div>
<div><br></div>
<div>Furthermore, these two attributes are the tip of the iceberg, and the core team has spent a lot of time recently discussing the fact there are potentially going to be about a dozen attributes similar to these (fixed_contents, &nbsp;global_var_is_directly_addressible, …) &nbsp;that will only be required for binary frameworks. &nbsp;It is possible that @inlinable will be prominent enough to be a global attribute (I personally am not sure if it will be commonly used or not, it depends a lot on how widely used binary frameworks are). &nbsp;That said, it is clear @abiPublic will not be commonly used, and many attributes that follow these will be even more obscure.<br></div>
<div><br></div>
<div>This is bad for three reasons:&nbsp;<br></div>
<div><br></div>
<div>1) we’re polluting the general attribute namespace with obscure things. &nbsp;Pollution of the attribute namespace may have a marginal impact today, but will start to matter if/when we ever get user defined attributes. &nbsp;<br></div>
<div><br></div>
<div>2) The other reason is that this provides no general framework to tie together these things that affect binary frameworks into a unified framework. &nbsp;<br></div>
<div><br></div>
<div>3) Furthermore, I don’t like attributes being a dumping ground for weird performance hacks required by binary frameworks. &nbsp;It is a practical necessity that we support these because they are extremely important for narrow cases, but we don’t need to put them into a syntactically prominent spot in the grammar.<br></div>
<div><br></div>
<div><b>The name “ABI”</b><br></div>
<div><br></div>
<div>A minor point, but the specific name “abiPublic” is not great in my opinion, because “ABI” is a term of art for compiler hackers. &nbsp;Most users have no idea what ABI means, and those who think they do often don’t. &nbsp;Very few people really understand what “stable ABI” means for example.<br></div>
<div><br></div>
<div>It would be better to go with something like “apiPublic” or “symbolPublic” or “linkableButNotAccessible” or something else long. &nbsp;This will not be commonly used in user code, so being long and descriptive is a good thing.<br></div>
<div><br></div>
<div><br></div>
<div><b>Counterproposal:</b><br></div>
<div><br></div>
<div>There is a simple way to address the two concerns above: we already have a framework for handling API evolution with binary frameworks, the @available attribute. &nbsp;We can spell these “attributes” as:<br></div>
<div><br></div>
<div><div><span style="white-space:pre;"></span>@available(inlinable) &nbsp; // this symbol has been inlinable since it was introduced<br></div>
<div><br></div>
<div>which generalizes properly when we add version ranges:<br></div>
<div><br></div>
<div><span style="white-space:pre;"></span>@available(iOS 14, *) &nbsp; // this was introduced in iOS 14<br></div>
</div>
<div><span style="white-space:pre;"></span>@available(linkerSymbol: iOS 15, *) &nbsp;// this decl’s symbol became “abiPublic" in iOS 15<br></div>
<div><span style="white-space:pre;"></span>@available(inlinable: iOS 16, *) &nbsp;// this decl became inlinable in iOS 16<br></div>
<div><span style="white-space:pre;"></span>public func foo() {… }<br></div>
<div><br></div>
<div>and allows us to bury weird hacks like “abiPublic” and the other even more obscure things that are coming outside of the global attribute namespace:<br></div>
<div><br></div>
<div><div><span style="white-space:pre;"></span>@available(global_var_is_directly_accessible: iOS 15, *)<br></div>
<div><span style="white-space:pre;"></span>public&nbsp;var myDispatchOnceToken : ...<br></div>
</div>
<div><br></div>
<div><br></div>
<div>Given this unified framework for handling ABI evolution, we can then separately discuss which ones of these proposals are common and important enough to sugar into a top level attribute. &nbsp;For example, given the general model for inlinable above, we could then (possibly as a later proposal) introduce:<br></div>
<div><br></div>
<div><span style="white-space:pre;"></span>@inlinable &nbsp; &nbsp;// this symbol has been inlinable since it was introduced<br></div>
<div><span style="white-space:pre;"></span>public func foo()&nbsp;<br></div>
<div><br></div>
<div>as sugar for:<br></div>
<div><br></div>
<div><div><span style="white-space:pre;"></span>@available(inlinable)<br></div>
<div><span style="white-space:pre;"></span>public func foo()&nbsp;<br></div>
<div><br></div>
<div>… which means that the sugar forms can be separately debated, and that the sugar forms don’t have to permit the full complexity of the general case (the availability list). &nbsp;It still isn’t clear to me whether @inlinable meets the bar to be a global attribute, I can see both sides of that argument, and it seems valuable to be able to separate the engineering work to introduce the feature from the bikeshed discussion about whether it should be sugared or not.<br></div>
<div><br></div>
<div><br></div>
<div>In short, respectfully request that you at least add this approach to the "alternatives considered” section. &nbsp; I also suggest you strongly consider pursuing this direction. &nbsp;It solves the same problem as your proposal but:<br></div>
<div><br></div>
<div>- scales better as we add more “attributes" in the future - which will be of increasingly narrow applicability.<br></div>
<div>- provides a unifying model for all of the binary framework hints<br></div>
<div>- puts all the availability markup into the feature we already have for this.<br></div>
<div>- provides a better naming framework for things like abiPublic, because you can say "@available(linkerSymbol)” to say that this is making the linker symbol available from the binary framework.<br></div>
<div><br></div>
<div>-Chris<br></div>
<div><br></div>
</div>
<div><br></div>
<div><br></div>
<div><br></div>
<div><br></div>
<div><br></div>
<div style="font-family:Arial;"><br></div>
<blockquote type="cite"><div><div><div name="messageBodySection" style="font-size:14px;font-family:-apple-system, BlinkMacSystemFont, sans-serif;"><ul style="margin-top:15px;margin-right:0px;margin-bottom:15px;margin-left:0px;padding-left:30px;font-family:Helvetica, arial, sans-serif;background-color:rgb(255, 255, 255);"><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;"><br></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;"><p style="margin-top:0px;margin-right:0px;margin-bottom:15px;margin-left:0px;">Is the problem being addressed significant enough to warrant a change to Swift?<br></p></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;"><p style="margin-top:0px;margin-right:0px;margin-bottom:15px;margin-left:0px;">Does this proposal fit well with the feel and direction of Swift?<br></p></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;"><p style="margin-top:0px;margin-right:0px;margin-bottom:15px;margin-left:0px;">If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?<br></p></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;"><p style="margin-top:0px;margin-right:0px;margin-bottom:15px;margin-left:0px;">How much effort did you put into your review? A glance, a quick reading, or an in-depth study?<br></p></li></ul><p style="margin-top: 15px; margin-right: 0px; margin-left: 0px; margin-bottom: 0px !important;"><span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="font" style="font-family:Helvetica, arial, sans-serif">Thanks,<br style=""> Ted Kremenek<br style=""> Review Manager</span></span></p></div>
<div name="messageReplySection" style="font-size:14px;font-family:-apple-system, BlinkMacSystemFont, sans-serif;"><div style="font-family:Arial;"><br></div>
<div><br></div>
</div>
</div>
<div style="font-family:Arial;">_______________________________________________<br></div>
<div style="font-family:Arial;">swift-evolution-announce mailing list<br></div>
<div style="font-family:Arial;"><a href="mailto:swift-evolution-announce@swift.org">swift-evolution-announce@swift.org</a><br></div>
<div style="font-family:Arial;">https://lists.swift.org/mailman/listinfo/swift-evolution-announce<br></div>
</div>
</blockquote></div>
<div style="font-family:Arial;"><br></div>
<div><u>_______________________________________________</u><br></div>
<div>swift-evolution mailing list<br></div>
<div><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br></div>
<div><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div>
</blockquote><div style="font-family:Arial;"><br></div>
</body>
</html>