<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></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 Jan 7, 2016, at 3:52 AM, Romain Goyet via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Hi everyone,</div><div class=""><br class=""></div><div class="">In the <a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/" class="">introduction to Swift</a>, it is presented as an "industrial-quality systems programming language".</div><div class="">According to <a href="https://en.wikipedia.org/wiki/System_programming_language" class="">Wikipedia</a>, this means that I could expect to be able to write device drivers or operating systems in Swift.</div><div class=""><br class=""></div><div class="">However it seems like this claim is only partially true, since several important low-level features seem to be completely missing:</div><div class=""><br class=""></div><div class="">- Is it possible to generate <a href="http://llvm.org/docs/LangRef.html#volatile-memory-accesses" class="">volatile memory accesses</a> in Swift? Writing device drivers is virtually impossible without a way to guarantee certain memory operations are actually made (and not optimized-out).&nbsp;</div></div></div></blockquote><div><br class=""></div><div>We haven't designed APIs for this yet, but the LLVM instructions for volatile and atomic operations are available in the stdlib-private 'Builtin' module, should you want to experiment.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">- Is it possible to embed raw binary data in Swift? For example, an equivalent of the following C code "const int8_t foo[6] = {0x00,0x11,0x22,0x33,0x44,0x55};"? The simple Swift equivalent, "let foo: [Int8] = [0x0,0x1,0x2,0x3,0x4,0x6];" is obviously wildly different. Being able to embed raw binary data is very important in a low-level environment: for example, you may need to feed specific data to a device for an initialization sequence at a point where you don't have a filesystem available yet.</div></div></div></blockquote><div><br class=""></div><div>We also haven't designed a story for this yet. We have some support for optimizing constant literal initializations like this into static initializers, but need to do more work to be able to guarantee it.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">There might be other aspects that I'm overlooking right now, but I think that's enough to start a discussion: is Swift really meant to be a systems programming language?</div></div></div></blockquote><br class=""></div><div>Like Austin said, that's a long term goal, and I think you can get pretty far today if you're careful and understand the compiler and runtime, but we're a long ways away from really productizing our low-level programming support to a degree I'd feel comfortable advertising.</div><br class=""><div class="">-Joe</div></body></html>