<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap:break-word"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"></div><div id="bloop_sign_1470334947639267840" class="bloop_sign">Thanks, cristal clear! :-)<table width="400" border="0" cellspacing="0" cellpadding="0" style="color:rgb(0,0,0);font-family:Times"><tbody></tbody></table></div> <br><p class="airmail_on">On August 3, 2016 at 9:51:38 PM, Brent Royal-Gordon (<a href="mailto:brent@architechies.com">brent@architechies.com</a>) wrote:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>> On Aug 3, 2016, at 8:39 PM, Fernando RodrÃguez via swift-corelibs-dev <<a href="mailto:swift-corelibs-dev@swift.org">swift-corelibs-dev@swift.org</a>> wrote:
<br>>
<br>> I'm having some trouble understanding what on Earth SwiftShims are. The name probably makes it obvious to native English speakers, but it's not helping me...
<br>>
<br>> Could someone please enlighten me?
<br>
<br>"Shim" is a relatively common programming term; it means a lightweight compatibility layer which corrects for differences between platforms. For instance, if you're supporting three different OSes with three different random number calls, you might write a `randomNumber()` shim function which calls whichever one is correct for that platform.
<br>
<br>(Outside of programming, a "shim" is a thin piece of material, often wood, which you put under the leg of a piece of furniture if it's crooked or wobbly.)
<br>
<br>SwiftShims specifically contains functions written in C, C++, or Objective-C++ which the Swift standard library's internals need to call. These functions often translate the parameter types of calls into forms which are easier to call from Swift, or fill in functionality that's missing on certain platforms. For instance, the I/O in the standard library's `readLine()` function is handled by a C++ function called `swift_stdlib_readLine_stdin()`. That function is part of SwiftShims; on most platforms, it calls through to a C standard library `getline()` function, but on a few it emulates that function's behavior.
<br>
<br>Unless you're working on the standard library (or Foundation, which I believe uses a couple of SwiftShims calls), you shouldn't ever interact with or care about SwiftShims. It's a private implementation detail of Swift.
<br>
<br>--
<br>Brent Royal-Gordon
<br>Architechies
<br>
<br></div></div></span></blockquote></body></html>